mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
first
This commit is contained in:
20
tests/Features/AfterEach.php
Normal file
20
tests/Features/AfterEach.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$state = new stdClass();
|
||||
|
||||
beforeEach(function () use ($state) {
|
||||
$this->state = $state;
|
||||
});
|
||||
|
||||
afterEach(function () use ($state) {
|
||||
$this->state->bar = 2;
|
||||
});
|
||||
|
||||
it('does not get executed before the test', function () {
|
||||
assertFalse(property_exists($this->state, 'bar'));
|
||||
});
|
||||
|
||||
it('gets executed after the test', function () {
|
||||
assertTrue(property_exists($this->state, 'bar'));
|
||||
assertEquals(2, $this->state->bar);
|
||||
});
|
||||
Reference in New Issue
Block a user