-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tests for interface command * add tests for `make:class` command * add testItCanGenerateInvokableClassFile
- Loading branch information
1 parent
f7f8784
commit b8313c9
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |