Skip to content

Commit

Permalink
Move the empty($cassetteName) Check Up
Browse files Browse the repository at this point in the history
Acts as a gaurd so no `substr(...)` operations are performed on a null
and break things.
  • Loading branch information
chrisguitarguy committed Jul 3, 2018
1 parent a6009d8 commit a56c7e2
Showing 1 changed file with 4 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

0 comments on commit a56c7e2

Please sign in to comment.