Debian Codegraph @

tests/phpunit/unit/includes/Settings/Source/PhpSettingsSourceTest.php

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