1 | <?php |
||
19 | class ExceptionTest extends ValueObjectVisitorBaseTest |
||
20 | { |
||
21 | const NON_VERBOSE_ERROR_DESCRIPTION = 'An error has occurred. Please try again later or contact your Administrator.'; |
||
22 | |||
23 | /** @var \Symfony\Component\Translation\TranslatorInterface|\PHPUnit\Framework\MockObject\MockObject */ |
||
24 | private $translatorMock; |
||
25 | |||
26 | /** |
||
27 | * Test the Exception visitor. |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | public function testVisit() |
||
42 | |||
43 | public function testVisitNonVerbose() |
||
62 | |||
63 | /** |
||
64 | * Test if result contains ErrorMessage element and error code. |
||
65 | * |
||
66 | * @param string $result |
||
67 | * |
||
68 | * @depends testVisit |
||
69 | */ |
||
70 | public function testResultContainsErrorCode($result) |
||
84 | |||
85 | /** |
||
86 | * Test if result contains ErrorMessage element. |
||
87 | * |
||
88 | * @param string $result |
||
89 | * |
||
90 | * @depends testVisit |
||
91 | */ |
||
92 | public function testResultContainsErrorMessage($result) |
||
106 | |||
107 | /** |
||
108 | * Test if result contains ErrorMessage element and description. |
||
109 | * |
||
110 | * @param string $result |
||
111 | * |
||
112 | * @depends testVisit |
||
113 | */ |
||
114 | public function testResultContainsErrorDescription($result) |
||
127 | |||
128 | /** |
||
129 | * @depends testVisitNonVerbose |
||
130 | */ |
||
131 | public function testNonVerboseErrorDescription($result) |
||
142 | |||
143 | /** |
||
144 | * Test if ErrorMessage element contains required attributes. |
||
145 | * |
||
146 | * @param string $result |
||
147 | * |
||
148 | * @depends testVisit |
||
149 | */ |
||
150 | public function testResultContainsExceptionAttributes($result) |
||
163 | |||
164 | /** |
||
165 | * Test if result contains ErrorMessage element. |
||
166 | * |
||
167 | * @depends testVisit |
||
168 | */ |
||
169 | public function testResultContainsPreviousError($result) |
||
179 | |||
180 | /** |
||
181 | * Get expected status code. |
||
182 | * |
||
183 | * @return int |
||
184 | */ |
||
185 | protected function getExpectedStatusCode() |
||
189 | |||
190 | /** |
||
191 | * Get expected message. |
||
192 | * |
||
193 | * @return string |
||
194 | */ |
||
195 | protected function getExpectedMessage() |
||
199 | |||
200 | /** |
||
201 | * Gets the exception. |
||
202 | * |
||
203 | * @return \Exception |
||
204 | */ |
||
205 | protected function getException() |
||
209 | |||
210 | /** |
||
211 | * Gets the exception visitor. |
||
212 | * |
||
213 | * @return \eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Exception |
||
214 | */ |
||
215 | protected function internalGetVisitor() |
||
219 | |||
220 | /** |
||
221 | * Gets the exception visitor. |
||
222 | * |
||
223 | * @return \eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Exception |
||
224 | */ |
||
225 | protected function internalGetNonDebugVisitor() |
||
229 | |||
230 | protected function getTranslatorMock() |
||
240 | |||
241 | private function generateDocument(Generator\Xml $generator, ValueObjectVisitor $visitor) |
||
262 | } |
||
263 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.