|
1 |
| -phpunit-testlistener-vcr |
| 1 | +PHPUnit testlistener |
2 | 2 | ========================
|
3 | 3 |
|
4 |
| -Integrates PHPUnit with PHP-VCR. |
| 4 | +Integrates PHPUnit with [PHP-VCR](http://github.com/adri/php-vcr) using annotations. |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +Use `@vcr cassette_name` on your tests to turn VCR automatically on and off. |
| 9 | + |
| 10 | +## Usage example |
| 11 | + |
| 12 | +Using static method calls: |
| 13 | + |
| 14 | +``` php |
| 15 | +class VCRTest extends \PHPUnit_Framework_TestCase |
| 16 | +{ |
| 17 | + /** |
| 18 | + * @vcr unittest_annotation_test |
| 19 | + */ |
| 20 | + public function testInterceptsWithAnnotations() |
| 21 | + { |
| 22 | + // Content of tests/fixtures/unittest_annotation_test: "This is a annotation test dummy". |
| 23 | + $result = file_get_contents('http://google.com'); |
| 24 | + $this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations).'); |
| 25 | + } |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +## Installation |
| 30 | + |
| 31 | +1. Add to your `composer.json`: |
| 32 | + |
| 33 | +``` json |
| 34 | + "require-dev": { |
| 35 | + "adri/phpunit-testlistener-vcr": "*" |
| 36 | + } |
| 37 | +``` |
| 38 | + |
| 39 | +2. Install using composer: |
| 40 | + |
| 41 | +``` bash |
| 42 | +composer install --dev |
| 43 | +``` |
| 44 | + |
| 45 | +3. Add listener to your `phpunit.xml`: |
| 46 | + |
| 47 | +``` bash |
| 48 | + <listeners> |
| 49 | + <listener class="PHPUnit_Util_Log_VCR" file="PHPUnit/Util/Log/VCR.php"></listener> |
| 50 | + </listeners> |
| 51 | +``` |
| 52 | + |
| 53 | +## Dependencies |
| 54 | + |
| 55 | +PHPUnit-Testlistener-VCR depends on: |
| 56 | + |
| 57 | + * PHP 5.3+ |
| 58 | + * [adri/php-vcr](https://github.com/adri/php-vcr) |
| 59 | + |
| 60 | +## Run tests |
| 61 | + |
| 62 | +In order to run all tests you need to get development dependencies using composer: |
| 63 | + |
| 64 | +``` php |
| 65 | +composer install --dev |
| 66 | +phpunit ./tests |
| 67 | +``` |
| 68 | + |
| 69 | +## Changelog |
| 70 | + |
| 71 | + * 2013-05-14 version 0.1: First prototype |
| 72 | + |
| 73 | +## Copyright |
| 74 | +Copyright (c) 2013 Adrian Philipp. Released under the terms of the MIT license. See LICENSE for details. |
| 75 | + |
| 76 | +<!-- |
| 77 | +name of the projects and all sub-modules and libraries (sometimes they are named different and very confusing to new users) |
| 78 | +descriptions of all the project, and all sub-modules and libraries |
| 79 | +5-line code snippet on how its used (if it's a library) |
| 80 | +copyright and licensing information (or "Read LICENSE") |
| 81 | +instruction to grab the documentation |
| 82 | +instructions to install, configure, and to run the programs |
| 83 | +instruction to grab the latest code and detailed instructions to build it (or quick overview and "Read INSTALL") |
| 84 | +list of authors or "Read AUTHORS" |
| 85 | +instructions to submit bugs, feature requests, submit patches, join mailing list, get announcements, or join the user or dev community in other forms |
| 86 | +other contact info (email address, website, company name, address, etc) |
| 87 | +a brief history if it's a replacement or a fork of something else |
| 88 | +legal notices (crypto stuff) |
| 89 | +--> |
0 commit comments