I am playing around with pest on a non-laravel project. It currently have a protected property defining the site type. This is then used inside the setUp() method to prepare the site
On the the test class
protected $site_name = 'some_site';
On the extended TestCase.
protected function setUp(): void
{
$_SESSION = [];
if (empty($this->site_name)) {
throw new Exception('Site property not set in test class');
}
$this->site = new Site($this->site);
setupSite($this->site);
}
Now in pest I cannot figure out how to set that protected variable.. Has anyone had any success with it? I have tried binding it in beforeEach, but that seems to run after setUp
beforeEach(function () {
$_SESSION = [];
if (empty($this->site_name)) {
throw new Exception('Site property not set in test class');
}
$this->site = new Site($this->site_name);
setupSite($this->site);
});
@wingly Sadly beforeAll is called before the class is instantiated, meaning that I will just get and error about using $this outside of object context.