mirror of
https://github.com/pestphp/pest.git
synced 2026-09-05 14:23:34 +02:00
chore: coding style changes
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests for dataset method chaining with hooks and describe blocks.
|
||||
*
|
||||
* Covers the fix from PR #1565: beforeEach()->with(), describe()->with(),
|
||||
* and nested describe blocks with datasets.
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// beforeEach()->with() inside describe blocks
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('beforeEach()->with() applies dataset to tests', function (): void {
|
||||
beforeEach()->with([10]);
|
||||
|
||||
@@ -50,10 +39,6 @@ describe('beforeEach()->with() with closure dataset', function (): void {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// describe()->with() method chaining
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('describe()->with() passes dataset to tests', function (): void {
|
||||
test('receives the dataset value', function ($value): void {
|
||||
expect($value)->toBe(42);
|
||||
@@ -85,10 +70,6 @@ describe('describe()->with() with closure dataset', function (): void {
|
||||
yield [14];
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Nested describe blocks with datasets
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('outer with dataset', function (): void {
|
||||
describe('inner without dataset', function (): void {
|
||||
test('inherits outer dataset', function (...$args): void {
|
||||
@@ -123,10 +104,6 @@ describe('deeply nested describe with datasets', function (): void {
|
||||
})->with([1]);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Combining hook datasets with test-level datasets
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('beforeEach()->with() combined with test->with()', function (): void {
|
||||
beforeEach()->with([10]);
|
||||
|
||||
@@ -143,10 +120,6 @@ describe('describe()->with() combined with test->with()', function (): void {
|
||||
})->with([50, 60]);
|
||||
})->with([5]);
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// beforeEach()->with() combined with beforeEach closure
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('beforeEach closure and beforeEach()->with() coexist', function (): void {
|
||||
beforeEach(function (): void {
|
||||
$this->setupValue = 'initialized';
|
||||
@@ -177,10 +150,6 @@ describe('beforeEach()->with() does not interfere with closure hooks', function
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Dataset isolation between describe blocks
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('first describe with dataset', function (): void {
|
||||
beforeEach()->with([111]);
|
||||
|
||||
@@ -203,10 +172,6 @@ describe('third describe without dataset', function (): void {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// describe()->with() combined with beforeEach hooks
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('describe()->with() with beforeEach closure', function (): void {
|
||||
beforeEach(function (): void {
|
||||
$this->hookRan = true;
|
||||
@@ -229,10 +194,6 @@ describe('describe()->with() with afterEach closure', function (): void {
|
||||
});
|
||||
})->with([88]);
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Multiple tests in a describe with beforeEach()->with()
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('multiple tests share the same beforeEach dataset', function (): void {
|
||||
beforeEach()->with([33]);
|
||||
|
||||
@@ -249,10 +210,6 @@ describe('multiple tests share the same beforeEach dataset', function (): void {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Nested describe with beforeEach()->with() at inner level
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('outer describe', function (): void {
|
||||
beforeEach(function (): void {
|
||||
$this->outer = true;
|
||||
@@ -272,10 +229,6 @@ describe('outer describe', function (): void {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// describe()->with() with depends
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
describe('describe()->with() preserves depends', function (): void {
|
||||
test('first', function ($value): void {
|
||||
expect($value)->toBe(9);
|
||||
|
||||
Reference in New Issue
Block a user