|
1 | | -## Welcome to GitHub Pages |
| 1 | +# Pest plugin for PHP-VCR |
2 | 2 |
|
3 | | -You can use the [editor on GitHub](https://github.com/phpjuice/pest-plugin-vcr/edit/main/docs/index.md) to maintain and preview the content for your website in Markdown files. |
| 3 | + |
| 4 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
| 5 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
| 6 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
4 | 7 |
|
5 | | -Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. |
| 8 | +Integrates Pest with [PHP-VCR](http://php-vcr.github.io) using plugins. |
6 | 9 |
|
7 | | -### Markdown |
| 10 | +## Installation |
8 | 11 |
|
9 | | -Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for |
| 12 | +You can install the package via composer: |
10 | 13 |
|
11 | | -```markdown |
12 | | -Syntax highlighted code block |
| 14 | +```bash |
| 15 | +composer require phpjuice/pest-plugin-vcr --dev |
| 16 | +``` |
| 17 | + |
| 18 | +## Setup |
13 | 19 |
|
14 | | -# Header 1 |
15 | | -## Header 2 |
16 | | -### Header 3 |
| 20 | +Add new folder inside tests to store cassettes: |
| 21 | + |
| 22 | +```bash |
| 23 | +mkdir tests/cassettes |
| 24 | +``` |
17 | 25 |
|
18 | | -- Bulleted |
19 | | -- List |
| 26 | +Add the following line to your `Pest.php` file, inorder to instruct |
| 27 | +php vcr of our cassettes folder: |
20 | 28 |
|
21 | | -1. Numbered |
22 | | -2. List |
| 29 | +```php |
| 30 | +use VCR\VCR; |
23 | 31 |
|
24 | | -**Bold** and _Italic_ and `Code` text |
25 | 32 |
|
26 | | -[Link](url) and  |
| 33 | +VCR::configure()->setCassettePath(__DIR__.'/cassettes'); |
27 | 34 | ``` |
28 | 35 |
|
29 | | -For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). |
| 36 | +## Usage |
| 37 | + |
| 38 | +This plugin will provide you with two handy functions `vcrTurnOn` & `vcrTurnOff` to turn on and off the http recording : |
| 39 | + |
| 40 | +```php |
| 41 | +it('records requests to pestphp.com', function () { |
| 42 | + |
| 43 | + vcrTurnOn('pestphp.com'); |
| 44 | + |
| 45 | + $result = file_get_contents('https://pestphp.com/'); |
| 46 | + |
| 47 | + expect($result) |
| 48 | + ->toBe('Hello from pestphp.'); |
| 49 | + |
| 50 | + vcrTurnOff(); |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | +The previous testsuite, will first send a request to `pestphp.com` and |
| 55 | +Record your test suite's HTTP interactions into a cassette and replay them |
| 56 | +during future test runs for fast, deterministic, accurate tests. |
| 57 | + |
| 58 | +> **Important** before running your tests make sure to have the following folder `tests/cassettes` |
| 59 | +
|
| 60 | +### Testing |
| 61 | + |
| 62 | +```bash |
| 63 | +composer test |
| 64 | +``` |
| 65 | + |
| 66 | +### Changelog |
| 67 | + |
| 68 | +Please see [CHANGELOG](../CHANGELOG.md) for more information what has changed recently. |
| 69 | + |
| 70 | +## Contributing |
| 71 | + |
| 72 | +Please see [CONTRIBUTING](../CONTRIBUTING.md) for details. |
| 73 | + |
| 74 | +### Security |
| 75 | + |
| 76 | +If you discover any security related issues, reach out to me @tsd_mohammed instead of using the issue tracker. |
| 77 | + |
| 78 | +## Credits |
| 79 | + |
| 80 | +- [All Contributors](../../../contributors) |
| 81 | + |
| 82 | +## License |
30 | 83 |
|
31 | | -### Jekyll Themes |
| 84 | +The MIT License (MIT). Please see [License File](../LICENSE.md) for more information. |
32 | 85 |
|
33 | | -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/phpjuice/pest-plugin-vcr/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file. |
| 86 | +## PHP Package Boilerplate |
34 | 87 |
|
35 | | -### Support or Contact |
| 88 | +This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com) by [Beyond Code](http://beyondco.de/). |
36 | 89 |
|
37 | | -Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. |
| 90 | + |
| 91 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
| 92 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
| 93 | +[](https://packagist.org/packages/phpjuice/pest-plugin-vcr) |
0 commit comments