Files
pest/tests/Features/AfterEach.php
2020-07-14 23:37:02 +02:00

21 lines
431 B
PHP

<?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 () {
expect($this->state)->not->toHaveProperty('bar');
});
it('gets executed after the test', function () {
expect($this->state)->toHaveProperty('bar');
expect($this->state->bar)->toBe(2);
});