mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
Add reference method
This commit is contained in:
@ -48,6 +48,13 @@ final class TestCall
|
|||||||
*/
|
*/
|
||||||
private readonly bool $descriptionLess;
|
private readonly bool $descriptionLess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This property is not actually used in the codebase, it's only here to make Rector happy.
|
||||||
|
*
|
||||||
|
* @var string|array<class-string|string>
|
||||||
|
*/
|
||||||
|
public array|string $references;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Pending Call.
|
* Creates a new Pending Call.
|
||||||
*/
|
*/
|
||||||
@ -615,6 +622,21 @@ final class TestCall
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a reference to the tested method or class.
|
||||||
|
* This helps to link test cases to the source code
|
||||||
|
* for easier navigation during development.
|
||||||
|
*
|
||||||
|
* @param string|array<class-string|string> $classes
|
||||||
|
*/
|
||||||
|
public function reference(string|array ...$classes): self
|
||||||
|
{
|
||||||
|
// For rector
|
||||||
|
$this->references = $classes; // @phpstan-ignore-line
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the test runner that no expectations happen in this test,
|
* Informs the test runner that no expectations happen in this test,
|
||||||
* and its purpose is simply to check whether the given code can
|
* and its purpose is simply to check whether the given code can
|
||||||
|
|||||||
Reference in New Issue
Block a user