mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
test: adding tests for beforeEach and afterEach + empty tests for *All
This commit is contained in:
@ -1,11 +1,27 @@
|
||||
<?php
|
||||
|
||||
beforeEach(function (): void {
|
||||
expect($this->baz)->toBe(1); // set from Pest.php global/shared hook
|
||||
uses()->beforeEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('baz')
|
||||
->and($this->baz)
|
||||
->toBe(0);
|
||||
|
||||
$this->baz = 1;
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
expect($this)
|
||||
->toHaveProperty('baz')
|
||||
->and($this->baz)
|
||||
->toBe(1);
|
||||
|
||||
$this->baz = 2;
|
||||
});
|
||||
|
||||
test('global before each', function (): void {
|
||||
expect($this->baz)->toBe(2);
|
||||
test('global beforeEach execution order', function () {
|
||||
expect($this)
|
||||
->toHaveProperty('baz')
|
||||
->and($this->baz)
|
||||
->toBe(2);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user