| @@ 58-80 (lines=23) @@ | ||
| 55 | /** |
|
| 56 | * @test |
|
| 57 | */ |
|
| 58 | public function onlyMissingOptionsAreAsked() |
|
| 59 | { |
|
| 60 | $choice = $this->io->choice(Argument::cetera())->willReturn('chosen'); |
|
| 61 | $ask = $this->io->ask(Argument::cetera())->willReturn('asked'); |
|
| 62 | $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); |
|
| 63 | $config = new CustomizableAppConfig(); |
|
| 64 | $config->setUrlShortener([ |
|
| 65 | 'SCHEMA' => 'foo', |
|
| 66 | 'HOSTNAME' => 'foo', |
|
| 67 | ]); |
|
| 68 | ||
| 69 | $this->plugin->process($this->io->reveal(), $config); |
|
| 70 | ||
| 71 | $this->assertEquals([ |
|
| 72 | 'SCHEMA' => 'foo', |
|
| 73 | 'HOSTNAME' => 'foo', |
|
| 74 | 'CHARS' => 'asked', |
|
| 75 | 'VALIDATE_URL' => false, |
|
| 76 | ], $config->getUrlShortener()); |
|
| 77 | $choice->shouldNotHaveBeenCalled(); |
|
| 78 | $ask->shouldHaveBeenCalledTimes(1); |
|
| 79 | $confirm->shouldHaveBeenCalledTimes(1); |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @test |
|
| @@ 85-110 (lines=26) @@ | ||
| 82 | /** |
|
| 83 | * @test |
|
| 84 | */ |
|
| 85 | public function noQuestionsAskedIfImportedConfigContainsEverything() |
|
| 86 | { |
|
| 87 | $choice = $this->io->choice(Argument::cetera())->willReturn('chosen'); |
|
| 88 | $ask = $this->io->ask(Argument::cetera())->willReturn('asked'); |
|
| 89 | $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); |
|
| 90 | ||
| 91 | $config = new CustomizableAppConfig(); |
|
| 92 | $config->setUrlShortener([ |
|
| 93 | 'SCHEMA' => 'foo', |
|
| 94 | 'HOSTNAME' => 'foo', |
|
| 95 | 'CHARS' => 'foo', |
|
| 96 | 'VALIDATE_URL' => true, |
|
| 97 | ]); |
|
| 98 | ||
| 99 | $this->plugin->process($this->io->reveal(), $config); |
|
| 100 | ||
| 101 | $this->assertEquals([ |
|
| 102 | 'SCHEMA' => 'foo', |
|
| 103 | 'HOSTNAME' => 'foo', |
|
| 104 | 'CHARS' => 'foo', |
|
| 105 | 'VALIDATE_URL' => true, |
|
| 106 | ], $config->getUrlShortener()); |
|
| 107 | $choice->shouldNotHaveBeenCalled(); |
|
| 108 | $ask->shouldNotHaveBeenCalled(); |
|
| 109 | $confirm->shouldNotHaveBeenCalled(); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||