Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fmasa/php-vcr-matchers
Useful request matchers for php-vcr test HTTP recorder
https://github.com/fmasa/php-vcr-matchers
Last synced: 19 days ago
JSON representation
Useful request matchers for php-vcr test HTTP recorder
- Host: GitHub
- URL: https://github.com/fmasa/php-vcr-matchers
- Owner: fmasa
- Created: 2018-05-06T15:15:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T15:17:11.000Z (over 6 years ago)
- Last Synced: 2024-12-21T04:12:11.446Z (21 days ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Additional request matchers for PHP-VCR
## Installation
The best way to install fmasa/php-vcr-matchers is is using [Composer](https://getcomposer.org/):```bash
composer require fmasa/php-vcr-matchers
```## Avialable matchers
### BodyMatcherWithXpathExceptions
Tags matching XPath expression are ignored for comparison
Useful for matching XML requests with variable tags (such as nonce, or request time).
#### Usage
```php
\VCR\VCR::configure()
->addRequestMatcher(
'body',
new \Fmasa\VCR\Matchers\BodyMatcherWithXpathExceptions([
'//*[local-name() = "Nonce"]',
'//*[local-name() = "Created"]',
])
);
```This will match request even when <Nonce> and <Created> tags do not match those in recorded request.
### QueryMatcherWithIgnoredParameters
Query parameters with specified names are ignored for comparison.
Useful for variable query parameters like timestamp or session ID.
#### Usage
```php
\VCR\VCR::configure()
->addRequestMatcher(
'query',
new \Fmasa\VCR\Matchers\QueryMatcherWithIgnoredParameters([
'timestamp',
])
)
```This will match request even when timestamp parameter values are different.