|
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
|
|
|
->append($this->addOptionsNode()) |
|
29
|
3 |
|
->append($this->addKernelOptionsNode()) |
|
30
|
|
|
->append($this->addManagerOptionsNode()) |
|
31
|
|
|
->end(); |
|
32
|
3 |
|
|
|
33
|
|
|
return $treeBuilder; |
|
34
|
3 |
|
} |
|
35
|
|
|
|
|
36
|
3 |
|
public function addOptionsNode(): ArrayNodeDefinition |
|
37
|
|
|
{ |
|
38
|
|
|
$treeBuilder = new TreeBuilder('options'); |
|
39
|
3 |
|
|
|
40
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
|
41
|
|
|
$root = $treeBuilder->getRootNode(); |
|
42
|
|
|
} else { |
|
43
|
3 |
|
$root = $treeBuilder->root('options'); |
|
44
|
3 |
|
} |
|
45
|
|
|
|
|
46
|
3 |
|
$node = $root |
|
47
|
3 |
|
->info( |
|
48
|
3 |
|
"These are the options passed as first argument to PantherTestCaseTrait::createPantherClient client constructor." |
|
49
|
|
|
) |
|
50
|
|
|
->ignoreExtraKeys() |
|
51
|
3 |
|
->scalarPrototype() |
|
52
|
|
|
->end() |
|
53
|
|
|
; |
|
54
|
|
|
|
|
55
|
|
|
return $node; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function addKernelOptionsNode(): ArrayNodeDefinition |
|
59
|
|
|
{ |
|
60
|
|
|
$treeBuilder = new TreeBuilder('kernel_options'); |
|
61
|
|
|
|
|
62
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
|
63
|
|
|
$root = $treeBuilder->getRootNode(); |
|
64
|
|
|
} else { |
|
65
|
|
|
$root = $treeBuilder->root('kernel_options'); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
$node = $root |
|
69
|
|
|
->info( |
|
70
|
|
|
"These are the options passed as second argument to PantherTestCaseTrait::createPantherClient client constructor." |
|
71
|
|
|
) |
|
72
|
|
|
->ignoreExtraKeys() |
|
73
|
|
|
->scalarPrototype() |
|
74
|
|
|
->end() |
|
75
|
|
|
; |
|
76
|
|
|
|
|
77
|
|
|
return $node; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function addManagerOptionsNode(): ArrayNodeDefinition |
|
81
|
|
|
{ |
|
82
|
|
|
$treeBuilder = new TreeBuilder('manager_options'); |
|
83
|
|
|
|
|
84
|
|
|
if (\method_exists($treeBuilder, 'getRootNode')) { |
|
85
|
|
|
$root = $treeBuilder->getRootNode(); |
|
86
|
|
|
} else { |
|
87
|
|
|
$root = $treeBuilder->root('manager_options'); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
$node = $root |
|
91
|
|
|
->info( |
|
92
|
|
|
"These are the options passed as third argument to PantherTestCaseTrait::createPantherClient client constructor." |
|
93
|
|
|
) |
|
94
|
|
|
->ignoreExtraKeys() |
|
95
|
|
|
->variablePrototype() |
|
96
|
|
|
->end() |
|
97
|
|
|
; |
|
98
|
|
|
|
|
99
|
|
|
return $node; |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.