Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Mar 12, 2024
1 parent 2ef6915 commit 18273f3
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
33 changes: 33 additions & 0 deletions workbench/tests/ClassMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Integration\Generators;

use Illuminate\Tests\Integration\Generators\TestCase;

class ClassMakeCommandTest extends TestCase
{
public function testItCanGenerateClassFile()
{
$this->artisan('make:class', ['name' => 'Reverb'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'class Reverb',
'public function __construct()',
], 'app/Reverb.php');
}

public function testItCanGenerateInvokableClassFile()
{
$this->artisan('make:class', ['name' => 'Notification', '--invokable' => true])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'class Notification',
'public function __construct()',
'public function __invoke()',
], 'app/Notification.php');
}
}
19 changes: 19 additions & 0 deletions workbench/tests/InterfaceMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Integration\Generators;

use Illuminate\Tests\Integration\Generators\TestCase;

class InterfaceMakeCommandTest extends TestCase
{
public function testItCanGenerateEnumFile()
{
$this->artisan('make:interface', ['name' => 'Gateway'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'interface Gateway',
], 'app/Gateway.php');
}
}
19 changes: 19 additions & 0 deletions workbench/tests/TraitMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Illuminate\Tests\Integration\Generators;

class TraitMakeCommandTest extends TestCase
{
public function testItCanGenerateTraitFile()
{
$this->artisan('make:trait', ['name' => 'FooTrait'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'trait FooTrait',
], 'app/FooTrait.php');
}
}

0 comments on commit 18273f3

Please sign in to comment.