|
2 | 2 |
|
3 | 3 | namespace BlameButton\LaravelDockerBuilder\Tests\Feature\Commands;
|
4 | 4 |
|
| 5 | +use BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\AlpineQuestion; |
| 6 | +use BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\ArtisanOptimizeQuestion; |
| 7 | +use BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\PhpExtensionsQuestion; |
| 8 | +use BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\PhpVersionQuestion; |
| 9 | +use BlameButton\LaravelDockerBuilder\Detectors\NodePackageManagerDetector; |
5 | 10 | use BlameButton\LaravelDockerBuilder\Integrations\SupportedPhpExtensions;
|
6 | 11 | use BlameButton\LaravelDockerBuilder\Tests\TestCase;
|
7 | 12 | use Illuminate\Support\Facades\File;
|
@@ -113,7 +118,7 @@ public function testItAsksQuestions(string $isCorrect): void
|
113 | 118 | $command->expectsChoice('Which Node package manager do you use?', 'npm', ['npm', 'yarn', 'none']);
|
114 | 119 | $command->expectsChoice('Which Node build tool do you use?', 'vite', ['vite', 'mix']);
|
115 | 120 | $command->expectsConfirmation('Does this look correct?', $isCorrect);
|
116 |
| - if ($isCorrect == 'yes') { |
| 121 | + if ($isCorrect === 'yes') { |
117 | 122 | $command->expectsOutput('Configuration:');
|
118 | 123 | $command->expectsTable(['Key', 'Value'], [
|
119 | 124 | ['PHP version', '8.2'],
|
@@ -164,4 +169,27 @@ public function testItThrowsExceptions(string $expected, string $command): void
|
164 | 169 | $command->expectsOutput($expected);
|
165 | 170 | $command->assertFailed();
|
166 | 171 | }
|
| 172 | + |
| 173 | + public function testItAcceptsNodePackageManagerNone(): void |
| 174 | + { |
| 175 | + $this->mock(PhpVersionQuestion::class, function (MockInterface $mock) { |
| 176 | + $mock->shouldReceive('getAnswer')->once()->andReturn('8.2'); |
| 177 | + }); |
| 178 | + $this->mock(PhpExtensionsQuestion::class, function (MockInterface $mock) { |
| 179 | + $mock->shouldReceive('getAnswer')->once()->andReturn(['bcmath']); |
| 180 | + }); |
| 181 | + $this->mock(ArtisanOptimizeQuestion::class, function (MockInterface $mock) { |
| 182 | + $mock->shouldReceive('getAnswer')->once()->andReturn(true); |
| 183 | + }); |
| 184 | + $this->mock(AlpineQuestion::class, function (MockInterface $mock) { |
| 185 | + $mock->shouldReceive('getAnswer')->once()->andReturn(true); |
| 186 | + }); |
| 187 | + $this->mock(NodePackageManagerDetector::class, function (MockInterface $mock) { |
| 188 | + $mock->shouldReceive('detect')->once()->andReturn(false); |
| 189 | + }); |
| 190 | + |
| 191 | + $this->artisan('docker:generate', ['--detect' => true]) |
| 192 | + ->expectsChoice('Which Node package manager do you use?', 'none', ['npm', 'yarn', 'none']) |
| 193 | + ->expectsConfirmation('Does this look correct?', 'yes'); |
| 194 | + } |
167 | 195 | }
|
0 commit comments