https://github.com/php-vcr/phpunit-testlistener-vcr
Integrates PHPUnit with PHP-VCR.
https://github.com/php-vcr/phpunit-testlistener-vcr
Last synced: 8 months ago
JSON representation
Integrates PHPUnit with PHP-VCR.
- Host: GitHub
- URL: https://github.com/php-vcr/phpunit-testlistener-vcr
- Owner: php-vcr
- License: mit
- Created: 2013-05-15T02:42:13.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T19:26:04.000Z (about 1 year ago)
- Last Synced: 2024-10-29T21:29:54.024Z (about 1 year ago)
- Language: PHP
- Size: 55.7 KB
- Stars: 61
- Watchers: 8
- Forks: 50
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PHPUnit TestListener for PHP-VCR
Integrates PHPUnit with [PHP-VCR](http://github.com/php-vcr/php-vcr) using annotations.

Use `@vcr cassette_name` on your tests to turn VCR automatically on and off.
[](https://travis-ci.org/php-vcr/phpunit-testlistener-vcr)
## Usage example
``` php
use PHPUnit\Framework\TestCase;
class VCRTest extends TestCase
{
/**
* @vcr unittest_annotation_test
*/
public function testInterceptsWithAnnotations()
{
// Content of tests/fixtures/unittest_annotation_test: "This is a annotation test dummy".
$result = file_get_contents('http://google.com');
$this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations).');
}
}
```
## Installation
1) Install using composer:
``` sh
composer require --dev php-vcr/phpunit-testlistener-vcr
```
2) Add listener to your `phpunit.xml`:
``` xml
```
## Dependencies
PHPUnit-Testlistener-VCR depends on:
* PHP 7.1+
* PHP 7.0+ (use <3.0)
* [php-vcr/php-vcr](https://github.com/php-vcr/php-vcr)
## Run tests
In order to run all tests you need to get development dependencies using composer:
``` php
composer install
./vendor/bin/phpunit
```
## Changelog
**The changelog is manage at [PHPUnit testlistener for PHP-VCR releases page](https://github.com/php-vcr/phpunit-testlistener-vcr/releases).**
## Copyright
Copyright (c) 2013-2018 Adrian Philipp. Released under the terms of the MIT license. See LICENSE for details.
[Contributors](https://github.com/php-vcr/phpunit-testlistener-vcr/graphs/contributors)