Add reference method

This commit is contained in:
Mert Aşan
2024-09-12 02:45:37 +03:00
parent 0d50d35b5e
commit f720be862e

View File

@ -48,6 +48,13 @@ final class TestCall
*/
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.
*/
@ -615,6 +622,21 @@ final class TestCall
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,
* and its purpose is simply to check whether the given code can