| @@ 86-105 (lines=20) @@ | ||
| 83 | /** |
|
| 84 | * @test |
|
| 85 | */ |
|
| 86 | public function onlyMissingOptionsAreAsked() |
|
| 87 | { |
|
| 88 | $ask = $this->io->ask(Argument::cetera())->willReturn('disable_param'); |
|
| 89 | $config = new CustomizableAppConfig(); |
|
| 90 | $config->setApp([ |
|
| 91 | 'SECRET' => 'foo', |
|
| 92 | 'CHECK_VISITS_THRESHOLD' => true, |
|
| 93 | 'VISITS_THRESHOLD' => 20, |
|
| 94 | ]); |
|
| 95 | ||
| 96 | $this->plugin->process($this->io->reveal(), $config); |
|
| 97 | ||
| 98 | $this->assertEquals([ |
|
| 99 | 'SECRET' => 'foo', |
|
| 100 | 'DISABLE_TRACK_PARAM' => 'disable_param', |
|
| 101 | 'CHECK_VISITS_THRESHOLD' => true, |
|
| 102 | 'VISITS_THRESHOLD' => 20, |
|
| 103 | ], $config->getApp()); |
|
| 104 | $ask->shouldHaveBeenCalledTimes(1); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * @test |
|
| @@ 110-131 (lines=22) @@ | ||
| 107 | /** |
|
| 108 | * @test |
|
| 109 | */ |
|
| 110 | public function noQuestionsAskedIfImportedConfigContainsEverything() |
|
| 111 | { |
|
| 112 | $ask = $this->io->ask(Argument::cetera())->willReturn('the_new_secret'); |
|
| 113 | ||
| 114 | $config = new CustomizableAppConfig(); |
|
| 115 | $config->setApp([ |
|
| 116 | 'SECRET' => 'foo', |
|
| 117 | 'DISABLE_TRACK_PARAM' => 'the_new_secret', |
|
| 118 | 'CHECK_VISITS_THRESHOLD' => true, |
|
| 119 | 'VISITS_THRESHOLD' => 20, |
|
| 120 | ]); |
|
| 121 | ||
| 122 | $this->plugin->process($this->io->reveal(), $config); |
|
| 123 | ||
| 124 | $this->assertEquals([ |
|
| 125 | 'SECRET' => 'foo', |
|
| 126 | 'DISABLE_TRACK_PARAM' => 'the_new_secret', |
|
| 127 | 'CHECK_VISITS_THRESHOLD' => true, |
|
| 128 | 'VISITS_THRESHOLD' => 20, |
|
| 129 | ], $config->getApp()); |
|
| 130 | $ask->shouldNotHaveBeenCalled(); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * @test |
|