1 | <?php |
||
22 | abstract class AbstractElasticsearchTestCase extends WebTestCase |
||
23 | { |
||
24 | use SetUpTearDownTrait; |
||
25 | |||
26 | /** |
||
27 | * @var Manager[] Holds used managers. |
||
28 | */ |
||
29 | private $managers = []; |
||
30 | |||
31 | /** |
||
32 | * @var ContainerInterface |
||
33 | */ |
||
34 | protected static $container; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | protected function doSetUp() |
||
47 | |||
48 | /** |
||
49 | * Can be overwritten in child class to populate elasticsearch index with the data. |
||
50 | * |
||
51 | * Example: |
||
52 | * "manager_name" => |
||
53 | * [ |
||
54 | * 'type_name' => [ |
||
55 | * [ |
||
56 | * '_id' => 1, |
||
57 | * 'title' => 'foo', |
||
58 | * ], |
||
59 | * [ |
||
60 | * '_id' => 2, |
||
61 | * 'title' => 'bar', |
||
62 | * ] |
||
63 | * ] |
||
64 | * ] |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | protected function getDataArray() |
||
72 | |||
73 | /** |
||
74 | * Ignores versions specified. |
||
75 | * |
||
76 | * Returns two dimensional array, first item in sub array is version to ignore, second is comparator, |
||
77 | * last test name. If no test name is provided it will be used on all test class. |
||
78 | * |
||
79 | * Comparator types can be found in `version_compare` documentation. |
||
80 | * |
||
81 | * Example: [ |
||
82 | * ['1.2.7', '<='], |
||
83 | * ['1.2.9', '==', 'testSmth'] |
||
84 | * ] |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | protected function getIgnoredVersions() |
||
92 | |||
93 | /** |
||
94 | * Ignores version specified. |
||
95 | * |
||
96 | * @param Manager $manager |
||
97 | */ |
||
98 | private function ignoreVersions(Manager $manager) |
||
119 | |||
120 | /** |
||
121 | * Removes manager from local cache and drops its index. |
||
122 | * |
||
123 | * @param string $name |
||
124 | */ |
||
125 | protected function removeManager($name) |
||
132 | |||
133 | /** |
||
134 | * Populates elasticsearch with data. |
||
135 | * |
||
136 | * @param Manager $manager |
||
137 | * @param array $data |
||
138 | */ |
||
139 | private function populateElasticsearchWithData($manager, array $data) |
||
151 | |||
152 | /** |
||
153 | * {@inheritdoc} |
||
154 | */ |
||
155 | protected function doTearDown() |
||
167 | |||
168 | /** |
||
169 | * Returns service container. |
||
170 | * |
||
171 | * @param array $kernelOptions Options used passed to kernel if it needs to be initialized. |
||
172 | * |
||
173 | * @return ContainerInterface |
||
174 | */ |
||
175 | protected function getContainer($kernelOptions = []) |
||
184 | |||
185 | /** |
||
186 | * Returns manager instance with injected connection if does not exist creates new one. |
||
187 | * |
||
188 | * @param string $name Manager name |
||
189 | * |
||
190 | * @return Manager |
||
191 | * |
||
192 | * @throws \LogicException |
||
193 | */ |
||
194 | protected function getManager($name = 'default') |
||
222 | } |
||
223 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.