wiki.techinc.nl/tests/phpunit/unit/includes/Settings/Source/PhpSettingsSourceTest.php
Derick Alangi 6aac95eb44 Settings: Introduce PhpSettingsSource for provisioning settings
This is an intermediate step before converting the merge strategies or
other configs/config schemas to YAML.

Bug: T297320
Change-Id: I91cd04d14f0ff86125fc8870984dab045c2098b5
2021-12-09 20:35:32 +00:00

32 lines
910 B
PHP

<?php
namespace MediaWiki\Tests\Unit\Settings\Source;
use MediaWiki\Settings\SettingsBuilderException;
use MediaWiki\Settings\Source\PhpSettingsSource;
use PHPUnit\Framework\TestCase;
/**
* @covers \MediaWiki\Settings\Source\FileSource
*/
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();
}
}