From f720be862ea4aa9b77ae18ed17f3bf8be1589dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20As=CC=A7an?= Date: Thu, 12 Sep 2024 02:45:37 +0300 Subject: [PATCH] Add reference method --- src/PendingCalls/TestCall.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 1b02ed1e..6f1732b7 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -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 + */ + 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 $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