Skip to content

Commit

Permalink
Test Improvements (#1005)
Browse files Browse the repository at this point in the history
fix following errors:

```
1) Laravel\Octane\Tests\ApplicationFactoryTest::test_application_can_be_created
* Test code or tested code did not remove its own error handlers

* Test code or tested code did not remove its own exception handlers

/home/runner/work/octane/octane/tests/ApplicationFactoryTest.php:9
```

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone authored Mar 6, 2025
1 parent 7be271d commit dcd0e57
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Carbon\Laravel\ServiceProvider as CarbonServiceProvider;
use Illuminate\Container\Container;
use Illuminate\Foundation\Bootstrap\HandleExceptions;
use Illuminate\Support\Facades\Facade;
use Laravel\Octane\ApplicationFactory;
use Laravel\Octane\Contracts\Client;
Expand All @@ -17,6 +18,7 @@
use Swoole\Table;

use function Orchestra\Testbench\default_skeleton_path;
use function Orchestra\Testbench\laravel_version_compare;

class TestCase extends BaseTestCase
{
Expand Down Expand Up @@ -76,6 +78,12 @@ protected function tearDown(): void
{
parent::tearDown();

if (laravel_version_compare('11.0', '>=')) {
HandleExceptions::flushState();
} else {
HandleExceptions::forgetApp();
}

Container::setInstance(null);

Facade::clearResolvedInstances();
Expand Down

0 comments on commit dcd0e57

Please sign in to comment.