Skip to content

Commit

Permalink
Changes conventional method name from setUp to handle to avoid potent…
Browse files Browse the repository at this point in the history
…ial confusion with linters confusing it for a PHPUnit test
  • Loading branch information
craigpaul committed Nov 27, 2023
1 parent 59f2920 commit 2f7674b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To create a new test case, use the `make:blitz` Artisan command. Tests will be p
php artisan make:blitz ExampleTest
```

Once the test has been generated, you may begin writing out your workflow using the scaffolded `setUp` method.
Once the test has been generated, you may begin writing out your workflow using the scaffolded `handle` method.

> [!NOTE]
> Unlike the way you would write multiple test cases with a framework like PHPUnit in Laravel, each class is it's own unique test case (or workflow).
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/stubs/test.stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class {{ class }} extends TestCase
*
* @return void
*/
public function setUp(): void
public function handle(): void
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/TargetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function store(Request $request): JsonResponse
{
$instance = $this->app->make($request->post('namespace'));

$instance->setUp();
$instance->handle();

return $this->response->json($instance->getTargets());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/CanGenerateTargetsFromWorkflowNamespaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testCanGenerateTargetsFromAnExistingWorkflowNamespace()

$this->mock($namespace, function (MockInterface $mock) use ($response) {
return $mock->makePartial()
->shouldReceive('setUp')
->shouldReceive('handle')
->andReturnSelf()
->getMock()
->shouldReceive('getTargets')
Expand Down

0 comments on commit 2f7674b

Please sign in to comment.