Skip to content

Commit 180e0f8

Browse files
Mathieu DarseK-Phoen
authored andcommitted
Make request matchers configurable
1 parent 3d7508c commit 180e0f8

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ protected function addCassetteNode(ArrayNodeDefinition $rootNode)
3737
->booleanNode('soap')->defaultValue(false)->end()
3838
->end()
3939
->end()
40+
->arrayNode('request_matchers')
41+
->addDefaultsIfNotSet()
42+
->children()
43+
->booleanNode('method')->defaultValue(true)->end()
44+
->booleanNode('url')->defaultValue(true)->end()
45+
->booleanNode('query_string')->defaultValue(true)->end()
46+
->booleanNode('host')->defaultValue(true)->end()
47+
->booleanNode('headers')->defaultValue(true)->end()
48+
->booleanNode('body')->defaultValue(true)->end()
49+
->booleanNode('post_fields')->defaultValue(true)->end()
50+
->end()
51+
->end()
4052
->arrayNode('cassette')
4153
->addDefaultsIfNotSet()
4254
->children()

DependencyInjection/VCRVCRExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public function load(array $configs, ContainerBuilder $container)
2020
$enabled_library_hooks = array_keys(array_filter($config['library_hooks']));
2121
$container->setParameter('vcr.library_hooks', $enabled_library_hooks);
2222

23+
$enabled_request_matchers = array_keys(array_filter($config['request_matchers']));
24+
$container->setParameter('vcr.request_matchers', $enabled_request_matchers);
25+
2326
$container->setParameter('vcr.cassette.path', $config['cassette']['path']);
2427
$container->setParameter('vcr.cassette.type', $config['cassette']['type']);
2528
$container->setParameter('vcr.cassette.name', $config['cassette']['name']);

Resources/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
class: VCR\Configuration
1313
calls:
1414
- [ enableLibraryHooks, [ %vcr.library_hooks% ]]
15+
- [ enableRequestMatchers, [ %vcr.request_matchers% ] ]
1516
- [ setCassettePath, [ %vcr.cassette.path% ] ]
1617
- [ setStorage, [ %vcr.cassette.type% ] ]
1718

0 commit comments

Comments
 (0)