mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Fix an issue where beforeEach/afterEach functions were called on other describe blocks with the same name
This commit is contained in:
@ -44,6 +44,36 @@ describe('nested', function () {
|
||||
})->note('This is a nested describe static note');
|
||||
})->note('This is describe static note');
|
||||
|
||||
describe('matching describe names', function () {
|
||||
beforeEach(function () {
|
||||
$this->note('This is before each matching describe runtime note');
|
||||
})->note('This is before each matching describe static note');
|
||||
|
||||
describe('describe block', function () {
|
||||
beforeEach(function () {
|
||||
$this->note('This is before each matching describe runtime note');
|
||||
})->note('This is before each matching describe static note');
|
||||
|
||||
it('may have a static note and runtime note', function () {
|
||||
expect(true)->toBeTrue(true);
|
||||
|
||||
$this->note('This is a runtime note within a matching describe');
|
||||
})->note('This is a static note within a matching describe');
|
||||
})->note('This is a nested matching static note');
|
||||
|
||||
describe('describe block', function () {
|
||||
beforeEach(function () {
|
||||
$this->note('This is before each matching describe runtime note, and should not contain the matching describe notes');
|
||||
})->note('This is before each matching describe static note, and should not contain the matching describe notes');
|
||||
|
||||
it('may have a static note and runtime note, that are different than the matching describe block', function () {
|
||||
expect(true)->toBeTrue(true);
|
||||
|
||||
$this->note('This is a runtime note within a matching describe, and should not contain the matching describe notes');
|
||||
})->note('This is a static note within a matching describe, and should not contain the matching describe notes');
|
||||
})->note('This is a nested matching static note, and should not contain the matching describe notes');
|
||||
});
|
||||
|
||||
test('multiple notes', function () {
|
||||
expect(true)->toBeTrue(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user