Open raonikhil opened 8 months ago
$this->seed()
requires the framework to be booted. Which requires the testcase to be booted. This can't be used within a beforeAll()
usage, as it runs before the testcase has booted. 👍🏻 Try using beforeEach()
instead.
$this->seed()
requires the framework to be booted. Which requires the testcase to be booted. This can't be used within abeforeAll()
usage, as it runs before the testcase has booted. 👍🏻 Try usingbeforeEach()
instead.
But to run $this->seed()
before each test case would not be very ideal, right? how to then ideally seed the db?
I have a similar use case where i wish to run some code before all tests that is not ideal to run before each, is there any plans to offer a hook where the test suite/framework is available?
What Happened
PHP version: 8.2.8 Operating system: Linux str_replace(): Argument #3 ($subject) must be of type array|string, null given
at vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php:43 39▕ @return FrameCollection 40▕ / 41▕ public function filter($callable) 42▕ { ➜ 43▕ $this->frames = array_values(array_filter($this->frames, $callable)); 44▕ return $this; 45▕ } 46▕ 47▕ /**
INFO Warning: Cannot unbind $this of closure using $this in /var/www/html/vendor/pestphp/pest/src/Support/Closure.php on line 27.
How to Reproduce
uses( Tests\TestCase::class, Illuminate\Foundation\Testing\RefreshDatabase::class, ) ->beforeAll(function() { $this->seed(); }) ->in('Feature');
Sample Repository
No response
Pest Version
2.24.3
PHP Version
8.2
Operation System
Linux
Notes
No response