mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
Fix an issue where beforeEach/afterEach functions were called on other describe blocks with the same name
This commit is contained in:
@ -6,6 +6,7 @@ namespace Pest\PendingCalls;
|
||||
|
||||
use Closure;
|
||||
use Pest\Support\Backtrace;
|
||||
use Pest\Support\Description;
|
||||
use Pest\TestSuite;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ final class DescribeCall
|
||||
/**
|
||||
* The current describe call.
|
||||
*
|
||||
* @var array<int, string>
|
||||
* @var array<int, Description>
|
||||
*/
|
||||
private static array $describing = [];
|
||||
|
||||
@ -25,22 +26,27 @@ final class DescribeCall
|
||||
*/
|
||||
private ?BeforeEachCall $currentBeforeEachCall = null;
|
||||
|
||||
/**
|
||||
* The unique description for this describe block
|
||||
*/
|
||||
private readonly Description $description;
|
||||
|
||||
/**
|
||||
* Creates a new Pending Call.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly TestSuite $testSuite,
|
||||
public readonly string $filename,
|
||||
public readonly string $description,
|
||||
string $description,
|
||||
public readonly Closure $tests
|
||||
) {
|
||||
//
|
||||
$this->description = new Description($description);
|
||||
}
|
||||
|
||||
/**
|
||||
* What is the current describing.
|
||||
*
|
||||
* @return array<int, string>
|
||||
* @return array<int, Description>
|
||||
*/
|
||||
public static function describing(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user