diff --git a/src/Console/Commands/MakeTest.php b/src/Console/Commands/MakeTest.php index 0dc7dd53..dfafe08e 100644 --- a/src/Console/Commands/MakeTest.php +++ b/src/Console/Commands/MakeTest.php @@ -47,6 +47,10 @@ protected function outputDirectory(): string protected function stub(): string { + if ($this->input->getOption('unit')) { + return 'test.unit.stub'; + } + return 'test.stub'; } diff --git a/src/Testing/TestCase.php b/src/Testing/TestCase.php index 547f67d0..4485968a 100644 --- a/src/Testing/TestCase.php +++ b/src/Testing/TestCase.php @@ -13,6 +13,7 @@ use Phenix\Facades\Mail; use Phenix\Facades\Queue; use Phenix\Facades\View; +use Phenix\Testing\Concerns\InteractWithDatabase; use Phenix\Testing\Concerns\InteractWithResponses; use Phenix\Testing\Concerns\RefreshDatabase; use Symfony\Component\Console\Tester\CommandTester; @@ -22,6 +23,7 @@ abstract class TestCase extends AsyncTestCase { use InteractWithResponses; + use InteractWithDatabase; protected ?AppProxy $app; protected string $appDir; diff --git a/src/stubs/test.stub b/src/stubs/test.stub index 904678e8..a3dd14ac 100644 --- a/src/stubs/test.stub +++ b/src/stubs/test.stub @@ -2,6 +2,8 @@ declare(strict_types=1); +// uses(RefreshDatabase::class); + it('asserts truthy', function () { expect(true)->toBeTruthy(); }); diff --git a/src/stubs/test.unit.stub b/src/stubs/test.unit.stub new file mode 100644 index 00000000..904678e8 --- /dev/null +++ b/src/stubs/test.unit.stub @@ -0,0 +1,7 @@ +toBeTruthy(); +}); diff --git a/tests/Internal/FakeCancellation.php b/tests/Internal/FakeCancellation.php new file mode 100644 index 00000000..99d7b891 --- /dev/null +++ b/tests/Internal/FakeCancellation.php @@ -0,0 +1,33 @@ +