Task: #53687 Handle missing mode fallback and add no-mode cfg tests
This commit is contained in:
parent
832b37e613
commit
e2cc59fe91
5 changed files with 45 additions and 3 deletions
|
|
@ -44,6 +44,25 @@ class CfgTest extends TestCase
|
|||
$this->assertSame('218523', $cfg['auth']['projectId']);
|
||||
}
|
||||
|
||||
public function testWriteWithoutModeFallsBackToDefaultMode(): void
|
||||
{
|
||||
file_put_contents(
|
||||
$this->tmpDir.'/config/myCEESV.default.conf.php',
|
||||
"<?php return [\n\t'auth' => [\n\t\t'projectId' => '',\n\t],\n];\n"
|
||||
);
|
||||
|
||||
$result = $this->runCfg([
|
||||
'-a',
|
||||
$this->tmpDir,
|
||||
'write',
|
||||
'myCEESV',
|
||||
'auth:projectId="218523"',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $result['code'], $result['output']);
|
||||
$this->assertFileExists($this->tmpDir.'/config/myCEESV.conf.php');
|
||||
}
|
||||
|
||||
public function testWriteWithDirectoryNameCreatesAndWritesSiteConfig(): void
|
||||
{
|
||||
$result = $this->runCfg([
|
||||
|
|
|
|||
|
|
@ -192,6 +192,15 @@ class SettingsTest extends TestCase
|
|||
$cfg = $this->appPath($cfg, 'localOverride')->load();
|
||||
$this->assertEquals(42, $cfg->answer);
|
||||
}
|
||||
|
||||
public function testLoadWithoutModeFallsBackToFirstKnownMode(): void
|
||||
{
|
||||
$cfg = new Settings();
|
||||
$cfg = $this->appPath($cfg, 'noMode')->load();
|
||||
|
||||
$this->assertEquals('prod', $cfg->mode);
|
||||
$this->assertEquals('default', $cfg->testFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider fileNameData
|
||||
|
|
|
|||
3
tests/cfg/noMode/config/default.conf.php
Normal file
3
tests/cfg/noMode/config/default.conf.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php return [
|
||||
'testFiles' => 'default',
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue