mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
80 lines
1.4 KiB
PHP
80 lines
1.4 KiB
PHP
<?php
|
|
|
|
beforeEach(function () {
|
|
$this->ith = 0;
|
|
});
|
|
|
|
pest()->afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(3);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
pest()->afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(4);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(5);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
describe('nested', function () {
|
|
afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(6);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
test('nested afterEach execution order', function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(0);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(7);
|
|
|
|
$this->ith++;
|
|
});
|
|
});
|
|
|
|
afterEach(function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBeBetween(6, 8);
|
|
|
|
$this->ith++;
|
|
});
|
|
|
|
test('global afterEach execution order', function () {
|
|
expect($this)
|
|
->toHaveProperty('ith')
|
|
->and($this->ith)
|
|
->toBe(0);
|
|
|
|
$this->ith++;
|
|
});
|