1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<?php
namespace MediaWiki\Tests\Unit\Settings\Source;
use MediaWiki\Settings\SettingsBuilderException;
use MediaWiki\Settings\Source\PhpSettingsSource;
use PHPUnit\Framework\TestCase;
/**
* @covers \MediaWiki\Settings\Source\PhpSettingsSource
*/
class PhpSettingsSourceTest extends TestCase {
public function testLoad() {
$source = new PhpSettingsSource( __DIR__ . '/fixtures/strategies.php' );
$this->assertSame( [], $source->load() );
}
public function testLoadInvalidPhpSource() {
$this->expectException( SettingsBuilderException::class );
$source = new PhpSettingsSource( __DIR__ . '/fixtures/bad-strategies.php' );
$source->load();
}
public function testLoadFileNotArray() {
$this->expectException( SettingsBuilderException::class );
// Let this just be an empty string.
$source = new PhpSettingsSource( __DIR__ . '/fixtures/strategies-bad-structure.php' );
$source->load();
}
}
|