Skip to content

Commit 299aaf8

Browse files
authored
Merge pull request #30 from chrisguitarguy/fix_substr
Move the Empty Check on $cassetteName Up
2 parents 7ef7225 + a56c7e2 commit 299aaf8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/VCRTestListener.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public function startTest(Test $test): void
4545
$parsed = self::parseDocBlock($docBlock, '@vcr');
4646
$cassetteName = array_pop($parsed);
4747

48+
if (empty($cassetteName)) {
49+
return;
50+
}
51+
4852
// If the cassette name ends in .json, then use the JSON storage format
4953
if (substr($cassetteName, -5) === '.json') {
5054
VCR::configure()->setStorage('json');
5155
}
5256

53-
if (empty($cassetteName)) {
54-
return;
55-
}
56-
5757
VCR::turnOn();
5858
VCR::insertCassette($cassetteName);
5959
}

tests/VCRTestListenerTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ public function testInterceptsWithAnnotationsWhenUsingDataProvider(int $dummyVal
4040
$this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations with data provider).');
4141
}
4242

43+
/**
44+
* @group https://github.com/php-vcr/phpunit-testlistener-vcr/issues/29
45+
*/
46+
public function testNoVcrAnnotationRunsSuccessfulAndDoesNotProduceWarnings()
47+
{
48+
$this->assertTrue(true, 'just adding an assertion here');
49+
}
50+
4351
public function dummyDataProvider(): array
4452
{
4553
return [

0 commit comments

Comments
 (0)