test: adding tests for beforeEach and afterEach + empty tests for *All

This commit is contained in:
jordanbrauer
2021-04-06 19:26:42 -05:00
parent 99500d0cae
commit 53333b56ab
5 changed files with 82 additions and 7 deletions

View File

@ -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);
});