Fixed consig customizer tests

This commit is contained in:
Alejandro Celaya
2018-10-06 10:05:25 +02:00
parent fa595f7aa3
commit 3b95925217
9 changed files with 104 additions and 110 deletions

View File

@@ -50,10 +50,9 @@ class ApplicationConfigCustomizerTest extends TestCase
/**
* @test
*/
public function overwriteIsRequestedIfValueIsAlreadySet()
public function onlyMissingOptionsAreAsked()
{
$ask = $this->io->ask(Argument::cetera())->willReturn('the_new_secret');
$confirm = $this->io->confirm(Argument::cetera())->willReturn(false);
$ask = $this->io->ask(Argument::cetera())->willReturn('disable_param');
$config = new CustomizableAppConfig();
$config->setApp([
'SECRET' => 'foo',
@@ -62,19 +61,18 @@ class ApplicationConfigCustomizerTest extends TestCase
$this->plugin->process($this->io->reveal(), $config);
$this->assertEquals([
'SECRET' => 'the_new_secret',
'DISABLE_TRACK_PARAM' => 'the_new_secret',
'SECRET' => 'foo',
'DISABLE_TRACK_PARAM' => 'disable_param',
], $config->getApp());
$ask->shouldHaveBeenCalledTimes(2);
$confirm->shouldHaveBeenCalledTimes(1);
$ask->shouldHaveBeenCalledTimes(1);
}
/**
* @test
*/
public function existingValueIsKeptIfRequested()
public function noQuestionsAskedIfImportedConfigContainsEverything()
{
$confirm = $this->io->confirm(Argument::cetera())->willReturn(true);
$ask = $this->io->ask(Argument::cetera())->willReturn('the_new_secret');
$config = new CustomizableAppConfig();
$config->setApp([
@@ -88,6 +86,6 @@ class ApplicationConfigCustomizerTest extends TestCase
'SECRET' => 'foo',
'DISABLE_TRACK_PARAM' => 'the_new_secret',
], $config->getApp());
$confirm->shouldHaveBeenCalledTimes(1);
$ask->shouldNotHaveBeenCalled();
}
}