mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Add ability to define multiple hooks for the same directory in Pest.php
This commit is contained in:
committed by
Nuno Maduro
parent
9c077ed352
commit
9d58e1a77e
@ -33,6 +33,41 @@ uses()
|
||||
})
|
||||
->in('Hooks');
|
||||
|
||||
uses()
|
||||
->beforeEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('baz')
|
||||
->and($this->baz)
|
||||
->toBe(0);
|
||||
|
||||
$this->baz = 1;
|
||||
})
|
||||
->beforeAll(function () {
|
||||
expect($_SERVER['globalHook'])
|
||||
->toHaveProperty('beforeAll')
|
||||
->and($_SERVER['globalHook']->beforeAll)
|
||||
->toBe(0);
|
||||
|
||||
$_SERVER['globalHook']->beforeAll = 1;
|
||||
})
|
||||
->afterEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('ith')
|
||||
->and($this->ith)
|
||||
->toBe(0);
|
||||
|
||||
$this->ith = 1;
|
||||
})
|
||||
->afterAll(function () {
|
||||
expect($_SERVER['globalHook'])
|
||||
->toHaveProperty('afterAll')
|
||||
->and($_SERVER['globalHook']->afterAll)
|
||||
->toBe(0);
|
||||
|
||||
$_SERVER['globalHook']->afterAll = 1;
|
||||
})
|
||||
->in('Hooks');
|
||||
|
||||
function helper_returns_string()
|
||||
{
|
||||
return 'string';
|
||||
|
||||
Reference in New Issue
Block a user