1 | <?php |
||
22 | abstract class ConstraintTestCase extends DataTestCase |
||
23 | { |
||
24 | private $expectedExceptionClass; |
||
25 | private $expectedExceptionPath; |
||
26 | private $expectedExceptionTarget; |
||
27 | |||
28 | /** |
||
29 | * @dataProvider fileDataProvider |
||
30 | * |
||
31 | * @param string $file |
||
32 | * @param string $title |
||
33 | * @param mixed $instance |
||
34 | * @param \stdClass $schema |
||
35 | * @param bool $isInstanceValid |
||
36 | * @param array $expectedErrors |
||
37 | */ |
||
38 | 185 | public function testApply( |
|
68 | |||
69 | /** |
||
70 | * Returns an instance of the constraint to be tested. |
||
71 | * |
||
72 | * @return Constraint |
||
73 | */ |
||
74 | abstract protected function getConstraint(); |
||
75 | |||
76 | /** |
||
77 | * @codeCoverageIgnore (called from a data provider, before test execution) |
||
78 | * |
||
79 | * {@inheritDoc} |
||
80 | */ |
||
81 | protected function getDataDirectory() |
||
85 | |||
86 | /** |
||
87 | * Returns a mocked walker instance. |
||
88 | * |
||
89 | * @return \PHPUnit_Framework_MockObject_MockObject|Walker |
||
90 | */ |
||
91 | 83 | protected function mockWalker() |
|
95 | |||
96 | /** |
||
97 | * Asserts a constraint exception will be thrown at a given path |
||
98 | * and optionally on a given target. |
||
99 | * |
||
100 | * @param string $exceptionName |
||
101 | * @param string $path |
||
102 | * @param string $target |
||
103 | */ |
||
104 | 61 | protected function expectConstraintException($exceptionName, $path, $target = null) |
|
111 | |||
112 | /** |
||
113 | * Implements the default hook, asserting that the exception thrown |
||
114 | * is an instance of ConstraintException and that its path and target |
||
115 | * match the expectations. |
||
116 | * |
||
117 | * @param \Exception $ex |
||
118 | * |
||
119 | * @throws \Exception |
||
120 | */ |
||
121 | 61 | protected function exceptionHook(\Exception $ex) |
|
156 | } |
||
157 |