Skip to content

Commit 21a9f2c

Browse files
committed
(WIP)
0 parents  commit 21a9f2c

39 files changed

+1644
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.editorconfig export-ignore
2+
.gitattributes export-ignore
3+
.github/ export-ignore
4+
.gitignore export-ignore
5+
.php_cs export-ignore
6+
.scrutinizer.yml export-ignore
7+
.styleci.yml export-ignore
8+
.travis.yml export-ignore
9+
phpunit.xml.dist export-ignore
10+
tests/ export-ignore

.github/CONTRIBUTING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please see http://docs.php-http.org/en/latest/development/contributing.html

.github/ISSUE_TEMPLATE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
| Q | A
2+
| ------------ | ---
3+
| Bug? | no
4+
| New Feature? | no
5+
| Version | Specific version or SHA of a commit
6+
7+
8+
#### Actual Behavior
9+
10+
What is the actual behavior?
11+
12+
13+
#### Expected Behavior
14+
15+
What is the behavior you expect?
16+
17+
18+
#### Steps to Reproduce
19+
20+
What are the steps to reproduce this bug? Please add code examples,
21+
screenshots or links to GitHub repositories that reproduce the problem.
22+
23+
24+
#### Possible Solutions
25+
26+
If you have already ideas how to solve the issue, add them here.
27+
(remove this section if not needed)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
| Q | A
2+
| --------------- | ---
3+
| Bug fix? | no|yes
4+
| New feature? | no|yes
5+
| BC breaks? | no|yes
6+
| Deprecations? | no|yes
7+
| Related tickets | fixes #X, partially #Y, mentioned in #Z
8+
| License | MIT
9+
10+
11+
#### What's in this PR?
12+
13+
Explain the contents of the PR.
14+
15+
16+
#### Why?
17+
18+
Which problem does the PR fix? (remove this section if you linked an issue above)
19+
20+
21+
#### Example Usage
22+
23+
``` php
24+
// If you added new features, show examples of how to use them here
25+
// (remove this section if not a new feature)
26+
27+
$foo = new Foo();
28+
29+
// Now we can do
30+
$foo->doSomething();
31+
```
32+
33+
34+
#### BC Breaks/Deprecations
35+
36+
Describe BC breaks/deprecations here. (remove this section if not needed)
37+
38+
39+
#### To Do
40+
41+
- [ ] Add tests

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/build
2+
/vendor
3+
/composer.lock
4+
/phpunit.xml

.php_cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/*
4+
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
5+
* with composer.
6+
*
7+
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
8+
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
9+
*/
10+
11+
use SLLH\StyleCIBridge\ConfigBridge;
12+
13+
return ConfigBridge::create();

.scrutinizer.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
filter:
2+
paths: [src/*]
3+
checks:
4+
php:
5+
code_rating: true
6+
duplication: true
7+
tools:
8+
external_code_coverage: true

.styleci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
preset: symfony
2+
3+
finder:
4+
path:
5+
- "src"
6+
- "tests"
7+
8+
enabled:
9+
- short_array_syntax

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
language: php
2+
3+
sudo: false
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
8+
9+
php:
10+
- 5.6
11+
- 7.0
12+
- hhvm
13+
14+
env:
15+
global:
16+
- TEST_COMMAND="composer test"
17+
18+
branches:
19+
except:
20+
- /^analysis-.*$/
21+
22+
matrix:
23+
fast_finish: true
24+
include:
25+
- php: 5.6
26+
env: COVERAGE=true TEST_COMMAND="composer test-ci"
27+
28+
before_install:
29+
- travis_retry composer self-update
30+
31+
install:
32+
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
33+
34+
script:
35+
- $TEST_COMMAND
36+
37+
after_success:
38+
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
39+
- if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Change Log
2+
3+
## Unreleased

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2016 PHP HTTP Team <team@php-http.org>
2+
Copyright (c) 2016 Jérôme Gamez <jerome@gamez.name>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is furnished
9+
to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# VCR Plugin
2+
3+
[![Latest Version](https://img.shields.io/github/release/php-http/vcr-plugin.svg?style=flat-square)](https://github.com/php-http/vcr-plugin/releases)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5+
[![Build Status](https://img.shields.io/travis/php-http/vcr-plugin.svg?style=flat-square)](https://travis-ci.org/php-http/vcr-plugin)
6+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/vcr-plugin.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/vcr-plugin)
7+
[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/vcr-plugin.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/vcr-plugin)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/php-http/vcr-plugin.svg?style=flat-square)](https://packagist.org/packages/php-http/vcr-plugin)
9+
10+
## Work in Progress
11+
12+
Please don't use/clone this repo yet, it will be force pushed for a clean first commit on initial release.
13+
14+
**Record your test suite's HTTP interactions and replay them during future test runs.**
15+
16+
## Install
17+
18+
Via Composer
19+
20+
``` bash
21+
$ composer require --dev php-http/vcr-plugin
22+
```
23+
24+
## Usage
25+
26+
27+
## Testing
28+
29+
``` bash
30+
$ composer test
31+
```
32+
33+
34+
## Contributing
35+
36+
Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
37+
38+
39+
## Security
40+
41+
If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
42+
43+
44+
## License
45+
46+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "php-http/vcr-plugin",
3+
"description": "Record your test suite's HTTP interactions and replay them during future test runs.",
4+
"license": "MIT",
5+
"keywords": ["http", "vcr", "plugin", "psr7"],
6+
"homepage": "http://httplug.io",
7+
"authors": [
8+
{
9+
"name": "Jérôme Gamez",
10+
"email": "jerome@gamez.name"
11+
}
12+
],
13+
"require-dev": {
14+
"php": "^5.6|^7.0",
15+
"php-http/plugins": "^1.0",
16+
"phpunit/phpunit": "^5.2",
17+
"guzzlehttp/psr7": "^1.2",
18+
"mikey179/vfsStream": "^1.6"
19+
},
20+
"autoload-dev": {
21+
"psr-4": {
22+
"Http\\Client\\Plugin\\Vcr\\": "src"
23+
}
24+
},
25+
"scripts": {
26+
"test": "vendor/bin/phpunit",
27+
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
28+
},
29+
"config": {
30+
"platform": {
31+
"php": "5.6"
32+
}
33+
},
34+
"extra": {
35+
"branch-alias": {
36+
"dev-master": "1.0-dev"
37+
}
38+
},
39+
"prefer-stable": true,
40+
"minimum-stability": "dev"
41+
}

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
5+
bootstrap="tests/bootstrap.php"
6+
forceCoversAnnotation="true"
7+
colors="true">
8+
<testsuites>
9+
<testsuite name="VCR Plugin Test Suite">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
14+
<filter>
15+
<whitelist>
16+
<directory suffix=".php">.</directory>
17+
<exclude>
18+
<directory>./tests</directory>
19+
<directory>./vendor</directory>
20+
</exclude>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

src/Exception/CannotBeReplayed.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr\Exception;
4+
5+
class CannotBeReplayed extends \RuntimeException implements VcrException
6+
{
7+
}

src/Exception/InvalidState.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr\Exception;
4+
5+
class InvalidState extends \RuntimeException implements VcrException
6+
{
7+
}

src/Exception/NotFound.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr\Exception;
4+
5+
class NotFound extends \RuntimeException implements VcrException
6+
{
7+
}

src/Exception/Storage.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr\Exception;
4+
5+
class Storage extends \RuntimeException implements VcrException
6+
{
7+
}

src/Exception/VcrException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr\Exception;
4+
5+
interface VcrException
6+
{
7+
}

src/Storage.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Http\Client\Plugin\Vcr;
4+
5+
use Http\Client\Plugin\Vcr\Exception\NotFound;
6+
7+
interface Storage
8+
{
9+
/**
10+
* Stores the given tape.
11+
*
12+
* @param Tape $tape
13+
*/
14+
public function store(Tape $tape);
15+
16+
/**
17+
* Returns a tape with the given name.
18+
*
19+
* @param string $name
20+
*
21+
* @throws NotFound If the requested tape has not been found.
22+
*
23+
* @return Tape
24+
*/
25+
public function fetch($name);
26+
}

0 commit comments

Comments
 (0)