Add filename test

This commit is contained in:
Barry vd. Heuvel
2024-12-28 19:25:22 +01:00
parent f5d940fe0f
commit 5f7e2fd32e
4 changed files with 45350 additions and 2 deletions
@@ -13,7 +13,6 @@ abstract class AbstractGeneratorCommand extends TestCase
protected function setUp(): void protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
// $this->artisan('key:gen');
$this->mockFilesystem(); $this->mockFilesystem();
} }
@@ -9,7 +9,7 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\GeneratorCommand\AbstractGeneratorCo
class Test extends AbstractGeneratorCommand class Test extends AbstractGeneratorCommand
{ {
public function test(): void public function testGenerator(): void
{ {
$command = $this->app->make(GeneratorCommand::class); $command = $this->app->make(GeneratorCommand::class);
@@ -19,4 +19,17 @@ class Test extends AbstractGeneratorCommand
$this->assertStringContainsString('A new helper file was written to _ide_helper.php', $tester->getDisplay()); $this->assertStringContainsString('A new helper file was written to _ide_helper.php', $tester->getDisplay());
$this->assertMatchesMockedSnapshot(); $this->assertMatchesMockedSnapshot();
} }
public function testFilename(): void
{
$command = $this->app->make(GeneratorCommand::class);
$tester = $this->runCommand($command, [
'filename' => 'foo.php',
]);
$this->assertSame(0, $tester->getStatusCode());
$this->assertStringContainsString('A new helper file was written to foo.php', $tester->getDisplay());
$this->assertMatchesMockedSnapshot();
}
} }