Skip to content

Commit

Permalink
Merge pull request #30 from chrisguitarguy/fix_substr
Browse files Browse the repository at this point in the history
Move the Empty Check on $cassetteName Up
  • Loading branch information
renatomefi authored Jul 6, 2018
2 parents 7ef7225 + a56c7e2 commit 299aaf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/VCRTestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions tests/VCRTestListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 299aaf8

Please sign in to comment.