1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Robertfausk\Behat\PantherExtension\ServiceContainer; |
5
|
|
|
|
6
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
7
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
8
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @author Robert Freigang <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class PantherConfiguration implements ConfigurationInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @inheritDoc |
17
|
|
|
*/ |
18
|
3 |
|
public function getConfigTreeBuilder() |
19
|
|
|
{ |
20
|
3 |
|
$treeBuilder = new TreeBuilder('panther'); |
21
|
3 |
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
22
|
|
|
$root = $treeBuilder->getRootNode(); |
23
|
|
|
} else { |
24
|
3 |
|
$root = $treeBuilder->root('panther'); |
|
|
|
|
25
|
|
|
} |
26
|
|
|
|
27
|
3 |
|
$root->children() |
28
|
|
|
->arrayNode('options') |
29
|
3 |
|
->info("These are the options passed as first argument to PantherTestCaseTrait::createPantherClient client constructor.") |
30
|
|
|
->ignoreExtraKeys() |
31
|
|
|
->scalarPrototype() |
32
|
3 |
|
->end() |
33
|
|
|
->arrayNode('kernel_options') |
34
|
3 |
|
->info("These are the options passed as second argument to PantherTestCaseTrait::createPantherClient client constructor.") |
35
|
|
|
->ignoreExtraKeys() |
36
|
3 |
|
->scalarPrototype() |
37
|
|
|
->end() |
38
|
|
|
->arrayNode('manager_options') |
39
|
3 |
|
->info("These are the options passed as third argument to PantherTestCaseTrait::createPantherClient client constructor.") |
40
|
|
|
->ignoreExtraKeys() |
41
|
|
|
->scalarPrototype() |
42
|
|
|
->end() |
43
|
3 |
|
->end(); |
44
|
3 |
|
|
45
|
|
|
return $treeBuilder; |
46
|
3 |
|
} |
47
|
3 |
|
|
48
|
3 |
|
public function addOptionsNode(): ArrayNodeDefinition |
49
|
|
|
{ |
50
|
|
|
$treeBuilder = new TreeBuilder('options'); |
51
|
3 |
|
|
52
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
53
|
|
|
$root = $treeBuilder->getRootNode(); |
54
|
|
|
} else { |
55
|
|
|
$root = $treeBuilder->root('options'); |
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
$node = $root |
59
|
|
|
->info( |
60
|
|
|
"These are the options passed as first argument to PantherTestCaseTrait::createPantherClient client constructor." |
61
|
|
|
) |
62
|
|
|
->ignoreExtraKeys() |
|
|
|
|
63
|
|
|
->scalarPrototype() |
64
|
|
|
->end() |
65
|
|
|
; |
66
|
|
|
|
67
|
|
|
return $node; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function addKernelOptionsNode(): ArrayNodeDefinition |
71
|
|
|
{ |
72
|
|
|
$treeBuilder = new TreeBuilder('kernel_options'); |
73
|
|
|
|
74
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
75
|
|
|
$root = $treeBuilder->getRootNode(); |
76
|
|
|
} else { |
77
|
|
|
$root = $treeBuilder->root('kernel_options'); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
$node = $root |
81
|
|
|
->info( |
82
|
|
|
"These are the options passed as second argument to PantherTestCaseTrait::createPantherClient client constructor." |
83
|
|
|
) |
84
|
|
|
->ignoreExtraKeys() |
85
|
|
|
->scalarPrototype() |
86
|
|
|
->end() |
87
|
|
|
; |
88
|
|
|
|
89
|
|
|
return $node; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function addManagerOptionsNode(): ArrayNodeDefinition |
93
|
|
|
{ |
94
|
|
|
$treeBuilder = new TreeBuilder('manager_options'); |
95
|
|
|
|
96
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
97
|
|
|
$root = $treeBuilder->getRootNode(); |
98
|
|
|
} else { |
99
|
|
|
$root = $treeBuilder->root('manager_options'); |
|
|
|
|
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
$node = $root |
103
|
|
|
->info( |
104
|
|
|
"These are the options passed as third argument to PantherTestCaseTrait::createPantherClient client constructor." |
105
|
|
|
) |
106
|
|
|
->ignoreExtraKeys() |
107
|
|
|
->scalarPrototype() |
108
|
|
|
->end() |
109
|
|
|
; |
110
|
|
|
|
111
|
|
|
return $node; |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.