From 7eb5478c42db969779eebcde4630010d4bb1a2f3 Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Sun, 28 Mar 2021 01:54:43 -0500 Subject: [PATCH] test: add tests for shared/global before each hooks --- tests/Hooks/BeforeEachTest.php | 11 +++++++++++ tests/Pest.php | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 tests/Hooks/BeforeEachTest.php 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');