diff --git a/src/Subscribers/OnTestPrepared.php b/src/Subscribers/OnTestPrepared.php index 89a3667..2d748ba 100644 --- a/src/Subscribers/OnTestPrepared.php +++ b/src/Subscribers/OnTestPrepared.php @@ -50,8 +50,13 @@ public function getCassette(Test $test, string $tag = '@vcr'): ?string } $reflection = new \ReflectionMethod($class, $method); - $docblock = $reflection->getDocComment(); + $attributes = $reflection->getAttributes(\VCR\PHPUnit\TestListener\Attributes\Vcr::class); + if (!empty($attributes)) { + return $attributes[0]->getArguments()[0]; + } + + $docblock = $reflection->getDocComment(); if (!empty($docblock)) { $parsed = self::parseDocBlock($docblock, $tag); return array_pop($parsed);