php-vcr / phpunit-testlistener-vcr

Integrates PHPUnit with PHP-VCR.
MIT License
61 stars 50 forks source link

Cassette Name Passed to `substr` May be Null #29

Closed chrisguitarguy closed 6 years ago

chrisguitarguy commented 6 years ago

https://github.com/php-vcr/phpunit-testlistener-vcr/blob/7ef72250d99e6cacf9cca8670b8884bc936c1842/src/VCRTestListener.php#L49-L51

If, for instance, the test doesn't have a @vcr annotation, that value (from array_pop($parsed)) may be null. This causes a TypeError due to the strict_types declaration.

Probably could be fixed by moving the empty($cassetteName) check before the check for a .json extension.

https://github.com/php-vcr/phpunit-testlistener-vcr/blob/7ef72250d99e6cacf9cca8670b8884bc936c1842/src/VCRTestListener.php#L53-L55

renatomefi commented 6 years ago

Hello @chrisguitarguy thanks for the report and the findings!

Would you be willing to open a PR? We can check together the tests to ensure BC!

Thanks again

chrisguitarguy commented 6 years ago

Done @renatomefi !