mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: global afterEach being called twice
This commit is contained in:
@ -32,7 +32,12 @@ pest()
|
||||
$_SERVER['globalHook']->calls->beforeAll++;
|
||||
})
|
||||
->afterEach(function () {
|
||||
$this->ith = 0;
|
||||
if (! isset($this->ith)) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert($this->ith === 1, 'Expected $this->ith to be 1, but got '.$this->ith);
|
||||
$this->ith++;
|
||||
})
|
||||
->afterAll(function () {
|
||||
$_SERVER['globalHook']->afterAll = 0;
|
||||
@ -57,12 +62,12 @@ pest()->in('Hooks')
|
||||
$_SERVER['globalHook']->beforeAll = 1;
|
||||
})
|
||||
->afterEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('ith')
|
||||
->and($this->ith)
|
||||
->toBe(0);
|
||||
if (! isset($this->ith)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ith = 1;
|
||||
assert($this->ith === 2, 'Expected $this->ith to be 1, but got '.$this->ith);
|
||||
$this->ith++;
|
||||
})
|
||||
->afterAll(function () {
|
||||
expect($_SERVER['globalHook'])
|
||||
|
||||
Reference in New Issue
Block a user