https://github.com/php-vcr/vcrbundle
Integrates php-vcr into Symfony and its web profiler.
https://github.com/php-vcr/vcrbundle
Last synced: 3 months ago
JSON representation
Integrates php-vcr into Symfony and its web profiler.
- Host: GitHub
- URL: https://github.com/php-vcr/vcrbundle
- Owner: php-vcr
- Created: 2014-11-26T08:07:14.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T11:47:04.000Z (about 3 years ago)
- Last Synced: 2025-03-21T18:07:02.326Z (10 months ago)
- Language: PHP
- Size: 263 KB
- Stars: 12
- Watchers: 6
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
VCRBundle
=========
Integrates [php-vcr](https://github.com/php-vcr/php-vcr) into Symfony and its
web profiler.
It also provides a VideoRecorderBrowser for testing purpose with extra helper methods handling php-vcr recordings.

## Installation
Install the behavior adding `php-vcr/vcr-bundle` to your composer.json or
from CLI:
```bash
composer require php-vcr/vcr-bundle
```
And declare the bundle in your `config/bundles.php` file:
```php
['test' => true],
];
```
## Usage
Enable the required library hooks for your purpose and write test cases.
### VideoRecorderBrowser (without Trait)
```php
getContainer()->get('test.client.vcr');
$client->insertVideoRecorderCassette('my-test-cassette-name');
// this is an example, normally services inside you project do stuff like this and you trigger them by
// execute requests via the KernelBrowser client
file_get_contents('https://www.google.de');
// cassette.path is configured to '%kernel.project_dir%/tests/Fixtures'
// recordings are written to %kernel.project_dir%/tests/Fixtures/my-test-cassette-name
// cassette.path + cassetteName (done by inserting the cassette)
}
}
```
### VideoRecorderBrowser (with Trait)
```php