An open API service indexing awesome lists of open source software.

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.

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.

PHP-VCR Symfony web profiler panel
PHP-VCR Symfony web profiler panel - request details
PHP-VCR Symfony web profiler panel - response details

## 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