mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-17 03:08:12 +00:00
b6682f6f93
Depends-On: I237a9f82e4d1b05cf2f08b3e4bb7ffcd8d47111c Change-Id: I42ca6c315584ae04289b28efa766bf4e67fda67a
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\MediaWiki\Minerva;
|
|
|
|
use MediaWiki\Minerva\SkinOptions;
|
|
|
|
/**
|
|
* Class SkinMinervaTest
|
|
* @package Tests\MediaWiki\Minerva
|
|
* @group MinervaNeue
|
|
* @coversDefaultClass \MediaWiki\Minerva\SkinOptions
|
|
*/
|
|
class SkinOptionsTest extends \MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::get
|
|
* @covers ::getAll
|
|
* @covers ::setMultiple
|
|
*/
|
|
public function testSettersAndGetters() {
|
|
$options = new SkinOptions();
|
|
$defaultValue = $options->get( SkinOptions::OPTION_AMC );
|
|
$options->setMultiple( [ SkinOptions::OPTION_AMC => !$defaultValue ] );
|
|
|
|
$allOptions = $options->getAll();
|
|
|
|
$this->assertEquals( !$defaultValue, $options->get( SkinOptions::OPTION_AMC ) );
|
|
$this->assertArrayHasKey( SkinOptions::OPTION_AMC, $allOptions );
|
|
$this->assertEquals( !$defaultValue, $allOptions[ SkinOptions::OPTION_AMC ] );
|
|
}
|
|
|
|
/**
|
|
* @covers ::hasSkinOptions
|
|
*/
|
|
public function testHasSkinOptions() {
|
|
$options = new SkinOptions();
|
|
// set OPTION_AMC to true just in case someone decides to set everything to false
|
|
// sometime in the future.
|
|
$options->setMultiple( [ SkinOptions::OPTION_AMC => true ] );
|
|
$this->assertTrue( $options->hasSkinOptions() );
|
|
$options->setMultiple( [ SkinOptions::OPTION_BACK_TO_TOP => true ] );
|
|
$this->assertTrue( $options->hasSkinOptions() );
|
|
$options->setMultiple( [
|
|
SkinOptions::OPTION_AMC => false,
|
|
SkinOptions::OPTION_BACK_TO_TOP => false
|
|
] );
|
|
$this->assertFalse( $options->hasSkinOptions() );
|
|
}
|
|
}
|