Skip to content

Commit

Permalink
Update Stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone authored and github-actions[bot] committed Oct 1, 2024
1 parent 6758af2 commit 37ffebb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
33 changes: 33 additions & 0 deletions workbench/tests/JobMiddlewareMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Illuminate\Tests\Integration\Generators;

class JobMiddlewareMakeCommandTest extends TestCase
{
protected $files = [
'app/Jobs/Middleware/Foo.php',
'tests/Feature/Jobs/Middleware/FooTest.php',
];

public function testItCanGenerateJobFile()
{
$this->artisan('make:job-middleware', ['name' => 'Foo'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App\Jobs\Middleware;',
'class Foo',
], 'app/Jobs/Middleware/Foo.php');

$this->assertFilenameNotExists('tests/Feature/Jobs/Middleware/FooTest.php');
}

public function testItCanGenerateJobFileWithTest()
{
$this->artisan('make:job-middleware', ['name' => 'Foo', '--test' => true])
->assertExitCode(0);

$this->assertFilenameExists('app/Jobs/Middleware/Foo.php');
$this->assertFilenameExists('tests/Feature/Jobs/Middleware/FooTest.php');
}
}
7 changes: 7 additions & 0 deletions workbench/tests/ModelMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public function testItCanGenerateModelFile()
'class Foo extends Model',
], 'app/Models/Foo.php');

$this->assertFileDoesNotContains([
'{{ factoryDocBlock }}',
'/** @use HasFactory<\Database\Factories\FooFactory> */',
], 'app/Models/Foo.php');

$this->assertFilenameNotExists('app/Http/Controllers/FooController.php');
$this->assertFilenameNotExists('database/factories/FooFactory.php');
$this->assertFilenameNotExists('database/seeders/FooSeeder.php');
Expand Down Expand Up @@ -96,6 +101,8 @@ public function testItCanGenerateModelFileWithFactoryOption()
'namespace App\Models;',
'use Illuminate\Database\Eloquent\Model;',
'class Foo extends Model',
'/** @use HasFactory<\Database\Factories\FooFactory> */',
'use HasFactory;',
], 'app/Models/Foo.php');

$this->assertFilenameNotExists('app/Http/Controllers/FooController.php');
Expand Down

0 comments on commit 37ffebb

Please sign in to comment.