diff --git a/tests/Hooks/BeforeEachTest.php b/tests/Hooks/BeforeEachTest.php new file mode 100644 index 00000000..199d6162 --- /dev/null +++ b/tests/Hooks/BeforeEachTest.php @@ -0,0 +1,11 @@ +baz)->toBe(1); // set from Pest.php global/shared hook + + $this->baz = 2; +}); + +test('global before each', function (): void { + expect($this->baz)->toBe(2); +}); diff --git a/tests/Pest.php b/tests/Pest.php index 2090100f..e2d51397 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,3 +1,6 @@ group('integration')->in('Visual'); +uses()->beforeEach(function (): void { + $this->baz = 1; +})->in('Hooks');