diff --git a/src/VCRTestListener.php b/src/VCRTestListener.php index efc87d4..0c8cae2 100644 --- a/src/VCRTestListener.php +++ b/src/VCRTestListener.php @@ -45,15 +45,15 @@ public function startTest(Test $test): void $parsed = self::parseDocBlock($docBlock, '@vcr'); $cassetteName = array_pop($parsed); + if (empty($cassetteName)) { + return; + } + // If the cassette name ends in .json, then use the JSON storage format if (substr($cassetteName, -5) === '.json') { VCR::configure()->setStorage('json'); } - if (empty($cassetteName)) { - return; - } - VCR::turnOn(); VCR::insertCassette($cassetteName); } diff --git a/tests/VCRTestListenerTest.php b/tests/VCRTestListenerTest.php index c2608f9..652d9bc 100644 --- a/tests/VCRTestListenerTest.php +++ b/tests/VCRTestListenerTest.php @@ -40,6 +40,14 @@ public function testInterceptsWithAnnotationsWhenUsingDataProvider(int $dummyVal $this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations with data provider).'); } + /** + * @group https://github.com/php-vcr/phpunit-testlistener-vcr/issues/29 + */ + public function testNoVcrAnnotationRunsSuccessfulAndDoesNotProduceWarnings() + { + $this->assertTrue(true, 'just adding an assertion here'); + } + public function dummyDataProvider(): array { return [