Skip to content

Commit 4054acc

Browse files
authored
Release v1.0.0 (#1)
1 parent 074073a commit 4054acc

File tree

13 files changed

+3980
-14
lines changed

13 files changed

+3980
-14
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
matrix:
1111
os: [ubuntu-latest, windows-latest]
1212
php: [8.0, 7.4]
13-
stability: [prefer-lowest, prefer-stable]
13+
stability: [prefer-stable]
1414

15-
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
15+
name: PHP${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
1616

1717
steps:
1818
- name: Checkout code
@@ -33,4 +33,4 @@ jobs:
3333
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
3434

3535
- name: Execute tests
36-
run: vendor/bin/phpunit
36+
run: vendor/bin/pest

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
.php_cs
3+
.php_cs.cache
4+
.phpunit.result.cache
5+
build
6+
coverage
7+
psalm.xml
8+
testbench.yaml
9+
vendor
10+
.php-cs-fixer.cache
11+
.phpunit.cache

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
All notable changes to `pest-plugin-vcr` will be documented in this file
44

5-
## 1.0.0 - 2021-08-28
5+
## 1.0.0 - 2021-08-29
66

77
- initial release

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/phpjuice/pest-plugin-vcr.svg?style=flat-square)](https://packagist.org/packages/phpjuice/pest-plugin-vcr)
44
[![Total Downloads](https://img.shields.io/packagist/dt/phpjuice/pest-plugin-vcr.svg?style=flat-square)](https://packagist.org/packages/phpjuice/pest-plugin-vcr)
5-
![GitHub Actions](https://github.com/phpjuice/pest-plugin-vcr/actions/workflows/main.yml/badge.svg)
5+
![GitHub Actions](https://github.com/phpjuice/pest-plugin-vcr/actions/workflows/ci.yml/badge.svg)
66

77
Integrates Pest with PHP-VCR using plugins.
88

@@ -16,12 +16,35 @@ composer require phpjuice/pest-plugin-vcr --dev
1616

1717
## Usage
1818

19+
To make this plugin functionality available, we need to let Pest know that it should use it.
20+
21+
We will do this by adding the following to your `Pest.php`:
22+
1923
```php
2024
use PHPJuice\PestPluginVcr\PestPluginVcr;
2125

2226
Pest\Plugin::uses(PestPluginVcr::class);
2327
```
2428

29+
## Example
30+
31+
The following testsuite, will first send a request to `pestphp.com` and
32+
Record your test suite's HTTP interactions into a cassette and replay them
33+
during future test runs for fast, deterministic, accurate tests...
34+
35+
```php
36+
it('records requests to pestphp.com', function () {
37+
38+
vcrTurnOn('pestphp.com');
39+
40+
$result = file_get_contents('https://pestphp.com/');
41+
42+
expect($result)
43+
->toBe('Hello from pestphp.');
44+
45+
vcrTurnOff();
46+
});
47+
```
2548
### Testing
2649

2750
```bash
@@ -38,11 +61,10 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
3861

3962
### Security
4063

41-
If you discover any security related issues, please email mohammed@amalyet.com instead of using the issue tracker.
64+
If you discover any security related issues, reach out to me @tsd_mohammed instead of using the issue tracker.
4265

4366
## Credits
4467

45-
- [Mohammed](https://github.com/phpjuice)
4668
- [All Contributors](../../contributors)
4769

4870
## License

bootstrap/autoload.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* Register The Auto Loader
5+
*
6+
* We are using our custom bootstrap file for phpunit,
7+
* in order for vcr to mock curl calls.
8+
* @see http://php-vcr.github.io/documentation/installation/
9+
*/
10+
require __DIR__.'/../vendor/autoload.php';
11+
12+
use VCR\VCR;
13+
14+
VCR::configure()->setCassettePath(__DIR__."/../tests/cassettes");
15+
VCR::turnOn();

composer.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,34 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.4|^8.0"
19+
"php": "^7.4|^8.0",
20+
"php-vcr/php-vcr": "^1.5"
2021
},
2122
"require-dev": {
23+
"ext-curl": "*",
24+
"filp/whoops": "^2.9",
25+
"pestphp/pest": "^1.17",
2226
"phpunit/phpunit": "^9.0"
2327
},
2428
"autoload": {
2529
"psr-4": {
2630
"PHPJuice\\PestPluginVcr\\": "src"
27-
}
31+
},
32+
"files": [
33+
"src/PestPluginVcr.php"
34+
]
2835
},
2936
"autoload-dev": {
3037
"psr-4": {
3138
"PHPJuice\\PestPluginVcr\\Tests\\": "tests"
32-
}
39+
},
40+
"files": [
41+
"vendor/filp/whoops/src/Whoops/Util/Misc.php"
42+
]
3343
},
3444
"scripts": {
35-
"test": "vendor/bin/phpunit",
36-
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
45+
"test": "vendor/bin/pest",
46+
"test-coverage": "XDEBUG_MODE=coverage vendor/bin/pest --coverage"
3747
},
3848
"config": {
3949
"sort-packages": true

0 commit comments

Comments
 (0)