@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | if (!defined('TEST_FILES_PATH')) { |
3 | - define('TEST_FILES_PATH', __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR); |
|
3 | + define('TEST_FILES_PATH', __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | ini_set('precision', 14); |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php |
2 | 2 | if (!defined('TEST_FILES_PATH')) { |
3 | - define('TEST_FILES_PATH', __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR); |
|
3 | + define('TEST_FILES_PATH', __DIR__.DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | ini_set('precision', 14); |
7 | 7 | ini_set('serialize_precision', 14); |
8 | 8 | |
9 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
9 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
10 | 10 | |
11 | 11 | // TODO: Figure out why (some of) these are required (the classes should be autoloaded instead) |
12 | -require_once TEST_FILES_PATH . 'BeforeAndAfterTest.php'; |
|
13 | -require_once TEST_FILES_PATH . 'BeforeClassAndAfterClassTest.php'; |
|
14 | -require_once TEST_FILES_PATH . 'TestWithTest.php'; |
|
15 | -require_once TEST_FILES_PATH . 'BeforeClassWithOnlyDataProviderTest.php'; |
|
16 | -require_once TEST_FILES_PATH . 'DataProviderSkippedTest.php'; |
|
17 | -require_once TEST_FILES_PATH . 'DataProviderDependencyTest.php'; |
|
18 | -require_once TEST_FILES_PATH . 'DataProviderIncompleteTest.php'; |
|
19 | -require_once TEST_FILES_PATH . 'InheritedTestCase.php'; |
|
20 | -require_once TEST_FILES_PATH . 'NoTestCaseClass.php'; |
|
21 | -require_once TEST_FILES_PATH . 'NoTestCases.php'; |
|
22 | -require_once TEST_FILES_PATH . 'NotPublicTestCase.php'; |
|
23 | -require_once TEST_FILES_PATH . 'NotVoidTestCase.php'; |
|
24 | -require_once TEST_FILES_PATH . 'OverrideTestCase.php'; |
|
25 | -require_once TEST_FILES_PATH . 'RequirementsClassBeforeClassHookTest.php'; |
|
26 | -require_once TEST_FILES_PATH . 'NoArgTestCaseTest.php'; |
|
27 | -require_once TEST_FILES_PATH . 'Singleton.php'; |
|
28 | -require_once TEST_FILES_PATH . 'Mockable.php'; |
|
29 | -require_once TEST_FILES_PATH . 'CoverageNamespacedFunctionTest.php'; |
|
30 | -require_once TEST_FILES_PATH . 'NamespaceCoveredFunction.php'; |
|
12 | +require_once TEST_FILES_PATH.'BeforeAndAfterTest.php'; |
|
13 | +require_once TEST_FILES_PATH.'BeforeClassAndAfterClassTest.php'; |
|
14 | +require_once TEST_FILES_PATH.'TestWithTest.php'; |
|
15 | +require_once TEST_FILES_PATH.'BeforeClassWithOnlyDataProviderTest.php'; |
|
16 | +require_once TEST_FILES_PATH.'DataProviderSkippedTest.php'; |
|
17 | +require_once TEST_FILES_PATH.'DataProviderDependencyTest.php'; |
|
18 | +require_once TEST_FILES_PATH.'DataProviderIncompleteTest.php'; |
|
19 | +require_once TEST_FILES_PATH.'InheritedTestCase.php'; |
|
20 | +require_once TEST_FILES_PATH.'NoTestCaseClass.php'; |
|
21 | +require_once TEST_FILES_PATH.'NoTestCases.php'; |
|
22 | +require_once TEST_FILES_PATH.'NotPublicTestCase.php'; |
|
23 | +require_once TEST_FILES_PATH.'NotVoidTestCase.php'; |
|
24 | +require_once TEST_FILES_PATH.'OverrideTestCase.php'; |
|
25 | +require_once TEST_FILES_PATH.'RequirementsClassBeforeClassHookTest.php'; |
|
26 | +require_once TEST_FILES_PATH.'NoArgTestCaseTest.php'; |
|
27 | +require_once TEST_FILES_PATH.'Singleton.php'; |
|
28 | +require_once TEST_FILES_PATH.'Mockable.php'; |
|
29 | +require_once TEST_FILES_PATH.'CoverageNamespacedFunctionTest.php'; |
|
30 | +require_once TEST_FILES_PATH.'NamespaceCoveredFunction.php'; |
@@ -12,21 +12,21 @@ |
||
12 | 12 | |
13 | 13 | class BaseTestListenerTest extends TestCase |
14 | 14 | { |
15 | - /** |
|
16 | - * @var TestResult |
|
17 | - */ |
|
18 | - private $result; |
|
15 | + /** |
|
16 | + * @var TestResult |
|
17 | + */ |
|
18 | + private $result; |
|
19 | 19 | |
20 | - public function testEndEventsAreCounted() |
|
21 | - { |
|
22 | - $this->result = new TestResult; |
|
23 | - $listener = new \BaseTestListenerSample; |
|
20 | + public function testEndEventsAreCounted() |
|
21 | + { |
|
22 | + $this->result = new TestResult; |
|
23 | + $listener = new \BaseTestListenerSample; |
|
24 | 24 | |
25 | - $this->result->addListener($listener); |
|
25 | + $this->result->addListener($listener); |
|
26 | 26 | |
27 | - $test = new \Success; |
|
28 | - $test->run($this->result); |
|
27 | + $test = new \Success; |
|
28 | + $test->run($this->result); |
|
29 | 29 | |
30 | - $this->assertEquals(1, $listener->endCount); |
|
31 | - } |
|
30 | + $this->assertEquals(1, $listener->endCount); |
|
31 | + } |
|
32 | 32 | } |
@@ -18,614 +18,614 @@ discard block |
||
18 | 18 | |
19 | 19 | class ConstraintTest extends TestCase |
20 | 20 | { |
21 | - public function testConstraintArrayHasKey() |
|
22 | - { |
|
23 | - $constraint = Assert::arrayHasKey(0); |
|
24 | - |
|
25 | - $this->assertFalse($constraint->evaluate([], '', true)); |
|
26 | - $this->assertEquals('has the key 0', $constraint->toString()); |
|
27 | - $this->assertCount(1, $constraint); |
|
28 | - |
|
29 | - try { |
|
30 | - $constraint->evaluate([]); |
|
31 | - } catch (ExpectationFailedException $e) { |
|
32 | - $this->assertEquals( |
|
33 | - <<<EOF |
|
21 | + public function testConstraintArrayHasKey() |
|
22 | + { |
|
23 | + $constraint = Assert::arrayHasKey(0); |
|
24 | + |
|
25 | + $this->assertFalse($constraint->evaluate([], '', true)); |
|
26 | + $this->assertEquals('has the key 0', $constraint->toString()); |
|
27 | + $this->assertCount(1, $constraint); |
|
28 | + |
|
29 | + try { |
|
30 | + $constraint->evaluate([]); |
|
31 | + } catch (ExpectationFailedException $e) { |
|
32 | + $this->assertEquals( |
|
33 | + <<<EOF |
|
34 | 34 | Failed asserting that an array has the key 0. |
35 | 35 | |
36 | 36 | EOF |
37 | - , |
|
38 | - TestFailure::exceptionToString($e) |
|
39 | - ); |
|
37 | + , |
|
38 | + TestFailure::exceptionToString($e) |
|
39 | + ); |
|
40 | 40 | |
41 | - return; |
|
42 | - } |
|
41 | + return; |
|
42 | + } |
|
43 | 43 | |
44 | - $this->fail(); |
|
45 | - } |
|
44 | + $this->fail(); |
|
45 | + } |
|
46 | 46 | |
47 | - public function testConstraintArrayHasKey2() |
|
48 | - { |
|
49 | - $constraint = Assert::arrayHasKey(0); |
|
47 | + public function testConstraintArrayHasKey2() |
|
48 | + { |
|
49 | + $constraint = Assert::arrayHasKey(0); |
|
50 | 50 | |
51 | - try { |
|
52 | - $constraint->evaluate([], 'custom message'); |
|
53 | - } catch (ExpectationFailedException $e) { |
|
54 | - $this->assertEquals( |
|
55 | - <<<EOF |
|
51 | + try { |
|
52 | + $constraint->evaluate([], 'custom message'); |
|
53 | + } catch (ExpectationFailedException $e) { |
|
54 | + $this->assertEquals( |
|
55 | + <<<EOF |
|
56 | 56 | custom message\nFailed asserting that an array has the key 0. |
57 | 57 | |
58 | 58 | EOF |
59 | - , |
|
60 | - TestFailure::exceptionToString($e) |
|
61 | - ); |
|
59 | + , |
|
60 | + TestFailure::exceptionToString($e) |
|
61 | + ); |
|
62 | 62 | |
63 | - return; |
|
64 | - } |
|
63 | + return; |
|
64 | + } |
|
65 | 65 | |
66 | - $this->fail(); |
|
67 | - } |
|
66 | + $this->fail(); |
|
67 | + } |
|
68 | 68 | |
69 | - public function testConstraintArrayNotHasKey() |
|
70 | - { |
|
71 | - $constraint = Assert::logicalNot( |
|
72 | - Assert::arrayHasKey(0) |
|
73 | - ); |
|
69 | + public function testConstraintArrayNotHasKey() |
|
70 | + { |
|
71 | + $constraint = Assert::logicalNot( |
|
72 | + Assert::arrayHasKey(0) |
|
73 | + ); |
|
74 | 74 | |
75 | - $this->assertFalse($constraint->evaluate([0 => 1], '', true)); |
|
76 | - $this->assertEquals('does not have the key 0', $constraint->toString()); |
|
77 | - $this->assertCount(1, $constraint); |
|
75 | + $this->assertFalse($constraint->evaluate([0 => 1], '', true)); |
|
76 | + $this->assertEquals('does not have the key 0', $constraint->toString()); |
|
77 | + $this->assertCount(1, $constraint); |
|
78 | 78 | |
79 | - try { |
|
80 | - $constraint->evaluate([0 => 1]); |
|
81 | - } catch (ExpectationFailedException $e) { |
|
82 | - $this->assertEquals( |
|
83 | - <<<EOF |
|
79 | + try { |
|
80 | + $constraint->evaluate([0 => 1]); |
|
81 | + } catch (ExpectationFailedException $e) { |
|
82 | + $this->assertEquals( |
|
83 | + <<<EOF |
|
84 | 84 | Failed asserting that an array does not have the key 0. |
85 | 85 | |
86 | 86 | EOF |
87 | - , |
|
88 | - TestFailure::exceptionToString($e) |
|
89 | - ); |
|
87 | + , |
|
88 | + TestFailure::exceptionToString($e) |
|
89 | + ); |
|
90 | 90 | |
91 | - return; |
|
92 | - } |
|
91 | + return; |
|
92 | + } |
|
93 | 93 | |
94 | - $this->fail(); |
|
95 | - } |
|
94 | + $this->fail(); |
|
95 | + } |
|
96 | 96 | |
97 | - public function testConstraintArrayNotHasKey2() |
|
98 | - { |
|
99 | - $constraint = Assert::logicalNot( |
|
100 | - Assert::arrayHasKey(0) |
|
101 | - ); |
|
97 | + public function testConstraintArrayNotHasKey2() |
|
98 | + { |
|
99 | + $constraint = Assert::logicalNot( |
|
100 | + Assert::arrayHasKey(0) |
|
101 | + ); |
|
102 | 102 | |
103 | - try { |
|
104 | - $constraint->evaluate([0], 'custom message'); |
|
105 | - } catch (ExpectationFailedException $e) { |
|
106 | - $this->assertEquals( |
|
107 | - <<<EOF |
|
103 | + try { |
|
104 | + $constraint->evaluate([0], 'custom message'); |
|
105 | + } catch (ExpectationFailedException $e) { |
|
106 | + $this->assertEquals( |
|
107 | + <<<EOF |
|
108 | 108 | custom message |
109 | 109 | Failed asserting that an array does not have the key 0. |
110 | 110 | |
111 | 111 | EOF |
112 | - , |
|
113 | - TestFailure::exceptionToString($e) |
|
114 | - ); |
|
112 | + , |
|
113 | + TestFailure::exceptionToString($e) |
|
114 | + ); |
|
115 | 115 | |
116 | - return; |
|
117 | - } |
|
116 | + return; |
|
117 | + } |
|
118 | 118 | |
119 | - $this->fail(); |
|
120 | - } |
|
119 | + $this->fail(); |
|
120 | + } |
|
121 | 121 | |
122 | - public function testConstraintIsReadable() |
|
123 | - { |
|
124 | - $constraint = Assert::isReadable(); |
|
122 | + public function testConstraintIsReadable() |
|
123 | + { |
|
124 | + $constraint = Assert::isReadable(); |
|
125 | 125 | |
126 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
127 | - $this->assertEquals('is readable', $constraint->toString()); |
|
128 | - $this->assertCount(1, $constraint); |
|
126 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
127 | + $this->assertEquals('is readable', $constraint->toString()); |
|
128 | + $this->assertCount(1, $constraint); |
|
129 | 129 | |
130 | - try { |
|
131 | - $constraint->evaluate('foo'); |
|
132 | - } catch (ExpectationFailedException $e) { |
|
133 | - $this->assertEquals( |
|
134 | - <<<EOF |
|
130 | + try { |
|
131 | + $constraint->evaluate('foo'); |
|
132 | + } catch (ExpectationFailedException $e) { |
|
133 | + $this->assertEquals( |
|
134 | + <<<EOF |
|
135 | 135 | Failed asserting that "foo" is readable. |
136 | 136 | |
137 | 137 | EOF |
138 | - , |
|
139 | - TestFailure::exceptionToString($e) |
|
140 | - ); |
|
138 | + , |
|
139 | + TestFailure::exceptionToString($e) |
|
140 | + ); |
|
141 | 141 | |
142 | - return; |
|
143 | - } |
|
142 | + return; |
|
143 | + } |
|
144 | 144 | |
145 | - $this->fail(); |
|
146 | - } |
|
145 | + $this->fail(); |
|
146 | + } |
|
147 | 147 | |
148 | - public function testConstraintIsWritable() |
|
149 | - { |
|
150 | - $constraint = Assert::isWritable(); |
|
148 | + public function testConstraintIsWritable() |
|
149 | + { |
|
150 | + $constraint = Assert::isWritable(); |
|
151 | 151 | |
152 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
153 | - $this->assertEquals('is writable', $constraint->toString()); |
|
154 | - $this->assertCount(1, $constraint); |
|
152 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
153 | + $this->assertEquals('is writable', $constraint->toString()); |
|
154 | + $this->assertCount(1, $constraint); |
|
155 | 155 | |
156 | - try { |
|
157 | - $constraint->evaluate('foo'); |
|
158 | - } catch (ExpectationFailedException $e) { |
|
159 | - $this->assertEquals( |
|
160 | - <<<EOF |
|
156 | + try { |
|
157 | + $constraint->evaluate('foo'); |
|
158 | + } catch (ExpectationFailedException $e) { |
|
159 | + $this->assertEquals( |
|
160 | + <<<EOF |
|
161 | 161 | Failed asserting that "foo" is writable. |
162 | 162 | |
163 | 163 | EOF |
164 | - , |
|
165 | - TestFailure::exceptionToString($e) |
|
166 | - ); |
|
164 | + , |
|
165 | + TestFailure::exceptionToString($e) |
|
166 | + ); |
|
167 | 167 | |
168 | - return; |
|
169 | - } |
|
168 | + return; |
|
169 | + } |
|
170 | 170 | |
171 | - $this->fail(); |
|
172 | - } |
|
171 | + $this->fail(); |
|
172 | + } |
|
173 | 173 | |
174 | - public function testConstraintDirectoryExists() |
|
175 | - { |
|
176 | - $constraint = Assert::directoryExists(); |
|
174 | + public function testConstraintDirectoryExists() |
|
175 | + { |
|
176 | + $constraint = Assert::directoryExists(); |
|
177 | 177 | |
178 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
179 | - $this->assertEquals('directory exists', $constraint->toString()); |
|
180 | - $this->assertCount(1, $constraint); |
|
178 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
179 | + $this->assertEquals('directory exists', $constraint->toString()); |
|
180 | + $this->assertCount(1, $constraint); |
|
181 | 181 | |
182 | - try { |
|
183 | - $constraint->evaluate('foo'); |
|
184 | - } catch (ExpectationFailedException $e) { |
|
185 | - $this->assertEquals( |
|
186 | - <<<EOF |
|
182 | + try { |
|
183 | + $constraint->evaluate('foo'); |
|
184 | + } catch (ExpectationFailedException $e) { |
|
185 | + $this->assertEquals( |
|
186 | + <<<EOF |
|
187 | 187 | Failed asserting that directory "foo" exists. |
188 | 188 | |
189 | 189 | EOF |
190 | - , |
|
191 | - TestFailure::exceptionToString($e) |
|
192 | - ); |
|
190 | + , |
|
191 | + TestFailure::exceptionToString($e) |
|
192 | + ); |
|
193 | 193 | |
194 | - return; |
|
195 | - } |
|
194 | + return; |
|
195 | + } |
|
196 | 196 | |
197 | - $this->fail(); |
|
198 | - } |
|
197 | + $this->fail(); |
|
198 | + } |
|
199 | 199 | |
200 | - public function testConstraintFileExists() |
|
201 | - { |
|
202 | - $constraint = Assert::fileExists(); |
|
200 | + public function testConstraintFileExists() |
|
201 | + { |
|
202 | + $constraint = Assert::fileExists(); |
|
203 | 203 | |
204 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
205 | - $this->assertEquals('file exists', $constraint->toString()); |
|
206 | - $this->assertCount(1, $constraint); |
|
204 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
205 | + $this->assertEquals('file exists', $constraint->toString()); |
|
206 | + $this->assertCount(1, $constraint); |
|
207 | 207 | |
208 | - try { |
|
209 | - $constraint->evaluate('foo'); |
|
210 | - } catch (ExpectationFailedException $e) { |
|
211 | - $this->assertEquals( |
|
212 | - <<<EOF |
|
208 | + try { |
|
209 | + $constraint->evaluate('foo'); |
|
210 | + } catch (ExpectationFailedException $e) { |
|
211 | + $this->assertEquals( |
|
212 | + <<<EOF |
|
213 | 213 | Failed asserting that file "foo" exists. |
214 | 214 | |
215 | 215 | EOF |
216 | - , |
|
217 | - TestFailure::exceptionToString($e) |
|
218 | - ); |
|
216 | + , |
|
217 | + TestFailure::exceptionToString($e) |
|
218 | + ); |
|
219 | 219 | |
220 | - return; |
|
221 | - } |
|
220 | + return; |
|
221 | + } |
|
222 | 222 | |
223 | - $this->fail(); |
|
224 | - } |
|
223 | + $this->fail(); |
|
224 | + } |
|
225 | 225 | |
226 | - public function testConstraintFileExists2() |
|
227 | - { |
|
228 | - $constraint = Assert::fileExists(); |
|
226 | + public function testConstraintFileExists2() |
|
227 | + { |
|
228 | + $constraint = Assert::fileExists(); |
|
229 | 229 | |
230 | - try { |
|
231 | - $constraint->evaluate('foo', 'custom message'); |
|
232 | - } catch (ExpectationFailedException $e) { |
|
233 | - $this->assertEquals( |
|
234 | - <<<EOF |
|
230 | + try { |
|
231 | + $constraint->evaluate('foo', 'custom message'); |
|
232 | + } catch (ExpectationFailedException $e) { |
|
233 | + $this->assertEquals( |
|
234 | + <<<EOF |
|
235 | 235 | custom message |
236 | 236 | Failed asserting that file "foo" exists. |
237 | 237 | |
238 | 238 | EOF |
239 | - , |
|
240 | - TestFailure::exceptionToString($e) |
|
241 | - ); |
|
239 | + , |
|
240 | + TestFailure::exceptionToString($e) |
|
241 | + ); |
|
242 | 242 | |
243 | - return; |
|
244 | - } |
|
243 | + return; |
|
244 | + } |
|
245 | 245 | |
246 | - $this->fail(); |
|
247 | - } |
|
246 | + $this->fail(); |
|
247 | + } |
|
248 | 248 | |
249 | - public function testConstraintFileNotExists() |
|
250 | - { |
|
251 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
249 | + public function testConstraintFileNotExists() |
|
250 | + { |
|
251 | + $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
252 | 252 | |
253 | - $constraint = Assert::logicalNot( |
|
254 | - Assert::fileExists() |
|
255 | - ); |
|
253 | + $constraint = Assert::logicalNot( |
|
254 | + Assert::fileExists() |
|
255 | + ); |
|
256 | 256 | |
257 | - $this->assertFalse($constraint->evaluate($file, '', true)); |
|
258 | - $this->assertEquals('file does not exist', $constraint->toString()); |
|
259 | - $this->assertCount(1, $constraint); |
|
257 | + $this->assertFalse($constraint->evaluate($file, '', true)); |
|
258 | + $this->assertEquals('file does not exist', $constraint->toString()); |
|
259 | + $this->assertCount(1, $constraint); |
|
260 | 260 | |
261 | - try { |
|
262 | - $constraint->evaluate($file); |
|
263 | - } catch (ExpectationFailedException $e) { |
|
264 | - $this->assertEquals( |
|
265 | - <<<EOF |
|
261 | + try { |
|
262 | + $constraint->evaluate($file); |
|
263 | + } catch (ExpectationFailedException $e) { |
|
264 | + $this->assertEquals( |
|
265 | + <<<EOF |
|
266 | 266 | Failed asserting that file "$file" does not exist. |
267 | 267 | |
268 | 268 | EOF |
269 | - , |
|
270 | - TestFailure::exceptionToString($e) |
|
271 | - ); |
|
269 | + , |
|
270 | + TestFailure::exceptionToString($e) |
|
271 | + ); |
|
272 | 272 | |
273 | - return; |
|
274 | - } |
|
273 | + return; |
|
274 | + } |
|
275 | 275 | |
276 | - $this->fail(); |
|
277 | - } |
|
276 | + $this->fail(); |
|
277 | + } |
|
278 | 278 | |
279 | - public function testConstraintFileNotExists2() |
|
280 | - { |
|
281 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
279 | + public function testConstraintFileNotExists2() |
|
280 | + { |
|
281 | + $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
282 | 282 | |
283 | - $constraint = Assert::logicalNot( |
|
284 | - Assert::fileExists() |
|
285 | - ); |
|
283 | + $constraint = Assert::logicalNot( |
|
284 | + Assert::fileExists() |
|
285 | + ); |
|
286 | 286 | |
287 | - try { |
|
288 | - $constraint->evaluate($file, 'custom message'); |
|
289 | - } catch (ExpectationFailedException $e) { |
|
290 | - $this->assertEquals( |
|
291 | - <<<EOF |
|
287 | + try { |
|
288 | + $constraint->evaluate($file, 'custom message'); |
|
289 | + } catch (ExpectationFailedException $e) { |
|
290 | + $this->assertEquals( |
|
291 | + <<<EOF |
|
292 | 292 | custom message |
293 | 293 | Failed asserting that file "$file" does not exist. |
294 | 294 | |
295 | 295 | EOF |
296 | - , |
|
297 | - TestFailure::exceptionToString($e) |
|
298 | - ); |
|
296 | + , |
|
297 | + TestFailure::exceptionToString($e) |
|
298 | + ); |
|
299 | 299 | |
300 | - return; |
|
301 | - } |
|
300 | + return; |
|
301 | + } |
|
302 | 302 | |
303 | - $this->fail(); |
|
304 | - } |
|
303 | + $this->fail(); |
|
304 | + } |
|
305 | 305 | |
306 | - public function testConstraintGreaterThan() |
|
307 | - { |
|
308 | - $constraint = Assert::greaterThan(1); |
|
306 | + public function testConstraintGreaterThan() |
|
307 | + { |
|
308 | + $constraint = Assert::greaterThan(1); |
|
309 | 309 | |
310 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
311 | - $this->assertTrue($constraint->evaluate(2, '', true)); |
|
312 | - $this->assertEquals('is greater than 1', $constraint->toString()); |
|
313 | - $this->assertCount(1, $constraint); |
|
310 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
311 | + $this->assertTrue($constraint->evaluate(2, '', true)); |
|
312 | + $this->assertEquals('is greater than 1', $constraint->toString()); |
|
313 | + $this->assertCount(1, $constraint); |
|
314 | 314 | |
315 | - try { |
|
316 | - $constraint->evaluate(0); |
|
317 | - } catch (ExpectationFailedException $e) { |
|
318 | - $this->assertEquals( |
|
319 | - <<<EOF |
|
315 | + try { |
|
316 | + $constraint->evaluate(0); |
|
317 | + } catch (ExpectationFailedException $e) { |
|
318 | + $this->assertEquals( |
|
319 | + <<<EOF |
|
320 | 320 | Failed asserting that 0 is greater than 1. |
321 | 321 | |
322 | 322 | EOF |
323 | - , |
|
324 | - TestFailure::exceptionToString($e) |
|
325 | - ); |
|
323 | + , |
|
324 | + TestFailure::exceptionToString($e) |
|
325 | + ); |
|
326 | 326 | |
327 | - return; |
|
328 | - } |
|
327 | + return; |
|
328 | + } |
|
329 | 329 | |
330 | - $this->fail(); |
|
331 | - } |
|
330 | + $this->fail(); |
|
331 | + } |
|
332 | 332 | |
333 | - public function testConstraintGreaterThan2() |
|
334 | - { |
|
335 | - $constraint = Assert::greaterThan(1); |
|
333 | + public function testConstraintGreaterThan2() |
|
334 | + { |
|
335 | + $constraint = Assert::greaterThan(1); |
|
336 | 336 | |
337 | - try { |
|
338 | - $constraint->evaluate(0, 'custom message'); |
|
339 | - } catch (ExpectationFailedException $e) { |
|
340 | - $this->assertEquals( |
|
341 | - <<<EOF |
|
337 | + try { |
|
338 | + $constraint->evaluate(0, 'custom message'); |
|
339 | + } catch (ExpectationFailedException $e) { |
|
340 | + $this->assertEquals( |
|
341 | + <<<EOF |
|
342 | 342 | custom message |
343 | 343 | Failed asserting that 0 is greater than 1. |
344 | 344 | |
345 | 345 | EOF |
346 | - , |
|
347 | - TestFailure::exceptionToString($e) |
|
348 | - ); |
|
346 | + , |
|
347 | + TestFailure::exceptionToString($e) |
|
348 | + ); |
|
349 | 349 | |
350 | - return; |
|
351 | - } |
|
350 | + return; |
|
351 | + } |
|
352 | 352 | |
353 | - $this->fail(); |
|
354 | - } |
|
353 | + $this->fail(); |
|
354 | + } |
|
355 | 355 | |
356 | - public function testConstraintNotGreaterThan() |
|
357 | - { |
|
358 | - $constraint = Assert::logicalNot( |
|
359 | - Assert::greaterThan(1) |
|
360 | - ); |
|
356 | + public function testConstraintNotGreaterThan() |
|
357 | + { |
|
358 | + $constraint = Assert::logicalNot( |
|
359 | + Assert::greaterThan(1) |
|
360 | + ); |
|
361 | 361 | |
362 | - $this->assertTrue($constraint->evaluate(1, '', true)); |
|
363 | - $this->assertEquals('is not greater than 1', $constraint->toString()); |
|
364 | - $this->assertCount(1, $constraint); |
|
362 | + $this->assertTrue($constraint->evaluate(1, '', true)); |
|
363 | + $this->assertEquals('is not greater than 1', $constraint->toString()); |
|
364 | + $this->assertCount(1, $constraint); |
|
365 | 365 | |
366 | - try { |
|
367 | - $constraint->evaluate(2); |
|
368 | - } catch (ExpectationFailedException $e) { |
|
369 | - $this->assertEquals( |
|
370 | - <<<EOF |
|
366 | + try { |
|
367 | + $constraint->evaluate(2); |
|
368 | + } catch (ExpectationFailedException $e) { |
|
369 | + $this->assertEquals( |
|
370 | + <<<EOF |
|
371 | 371 | Failed asserting that 2 is not greater than 1. |
372 | 372 | |
373 | 373 | EOF |
374 | - , |
|
375 | - TestFailure::exceptionToString($e) |
|
376 | - ); |
|
374 | + , |
|
375 | + TestFailure::exceptionToString($e) |
|
376 | + ); |
|
377 | 377 | |
378 | - return; |
|
379 | - } |
|
378 | + return; |
|
379 | + } |
|
380 | 380 | |
381 | - $this->fail(); |
|
382 | - } |
|
381 | + $this->fail(); |
|
382 | + } |
|
383 | 383 | |
384 | - public function testConstraintNotGreaterThan2() |
|
385 | - { |
|
386 | - $constraint = Assert::logicalNot( |
|
387 | - Assert::greaterThan(1) |
|
388 | - ); |
|
384 | + public function testConstraintNotGreaterThan2() |
|
385 | + { |
|
386 | + $constraint = Assert::logicalNot( |
|
387 | + Assert::greaterThan(1) |
|
388 | + ); |
|
389 | 389 | |
390 | - try { |
|
391 | - $constraint->evaluate(2, 'custom message'); |
|
392 | - } catch (ExpectationFailedException $e) { |
|
393 | - $this->assertEquals( |
|
394 | - <<<EOF |
|
390 | + try { |
|
391 | + $constraint->evaluate(2, 'custom message'); |
|
392 | + } catch (ExpectationFailedException $e) { |
|
393 | + $this->assertEquals( |
|
394 | + <<<EOF |
|
395 | 395 | custom message |
396 | 396 | Failed asserting that 2 is not greater than 1. |
397 | 397 | |
398 | 398 | EOF |
399 | - , |
|
400 | - TestFailure::exceptionToString($e) |
|
401 | - ); |
|
399 | + , |
|
400 | + TestFailure::exceptionToString($e) |
|
401 | + ); |
|
402 | 402 | |
403 | - return; |
|
404 | - } |
|
403 | + return; |
|
404 | + } |
|
405 | 405 | |
406 | - $this->fail(); |
|
407 | - } |
|
406 | + $this->fail(); |
|
407 | + } |
|
408 | 408 | |
409 | - public function testConstraintGreaterThanOrEqual() |
|
410 | - { |
|
411 | - $constraint = Assert::greaterThanOrEqual(1); |
|
409 | + public function testConstraintGreaterThanOrEqual() |
|
410 | + { |
|
411 | + $constraint = Assert::greaterThanOrEqual(1); |
|
412 | 412 | |
413 | - $this->assertTrue($constraint->evaluate(1, '', true)); |
|
414 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
415 | - $this->assertEquals('is equal to 1 or is greater than 1', $constraint->toString()); |
|
416 | - $this->assertCount(2, $constraint); |
|
413 | + $this->assertTrue($constraint->evaluate(1, '', true)); |
|
414 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
415 | + $this->assertEquals('is equal to 1 or is greater than 1', $constraint->toString()); |
|
416 | + $this->assertCount(2, $constraint); |
|
417 | 417 | |
418 | - try { |
|
419 | - $constraint->evaluate(0); |
|
420 | - } catch (ExpectationFailedException $e) { |
|
421 | - $this->assertEquals( |
|
422 | - <<<EOF |
|
418 | + try { |
|
419 | + $constraint->evaluate(0); |
|
420 | + } catch (ExpectationFailedException $e) { |
|
421 | + $this->assertEquals( |
|
422 | + <<<EOF |
|
423 | 423 | Failed asserting that 0 is equal to 1 or is greater than 1. |
424 | 424 | |
425 | 425 | EOF |
426 | - , |
|
427 | - TestFailure::exceptionToString($e) |
|
428 | - ); |
|
426 | + , |
|
427 | + TestFailure::exceptionToString($e) |
|
428 | + ); |
|
429 | 429 | |
430 | - return; |
|
431 | - } |
|
430 | + return; |
|
431 | + } |
|
432 | 432 | |
433 | - $this->fail(); |
|
434 | - } |
|
433 | + $this->fail(); |
|
434 | + } |
|
435 | 435 | |
436 | - public function testConstraintGreaterThanOrEqual2() |
|
437 | - { |
|
438 | - $constraint = Assert::greaterThanOrEqual(1); |
|
436 | + public function testConstraintGreaterThanOrEqual2() |
|
437 | + { |
|
438 | + $constraint = Assert::greaterThanOrEqual(1); |
|
439 | 439 | |
440 | - try { |
|
441 | - $constraint->evaluate(0, 'custom message'); |
|
442 | - } catch (ExpectationFailedException $e) { |
|
443 | - $this->assertEquals( |
|
444 | - <<<EOF |
|
440 | + try { |
|
441 | + $constraint->evaluate(0, 'custom message'); |
|
442 | + } catch (ExpectationFailedException $e) { |
|
443 | + $this->assertEquals( |
|
444 | + <<<EOF |
|
445 | 445 | custom message |
446 | 446 | Failed asserting that 0 is equal to 1 or is greater than 1. |
447 | 447 | |
448 | 448 | EOF |
449 | - , |
|
450 | - TestFailure::exceptionToString($e) |
|
451 | - ); |
|
449 | + , |
|
450 | + TestFailure::exceptionToString($e) |
|
451 | + ); |
|
452 | 452 | |
453 | - return; |
|
454 | - } |
|
453 | + return; |
|
454 | + } |
|
455 | 455 | |
456 | - $this->fail(); |
|
457 | - } |
|
456 | + $this->fail(); |
|
457 | + } |
|
458 | 458 | |
459 | - public function testConstraintNotGreaterThanOrEqual() |
|
460 | - { |
|
461 | - $constraint = Assert::logicalNot( |
|
462 | - Assert::greaterThanOrEqual(1) |
|
463 | - ); |
|
459 | + public function testConstraintNotGreaterThanOrEqual() |
|
460 | + { |
|
461 | + $constraint = Assert::logicalNot( |
|
462 | + Assert::greaterThanOrEqual(1) |
|
463 | + ); |
|
464 | 464 | |
465 | - $this->assertFalse($constraint->evaluate(1, '', true)); |
|
466 | - $this->assertEquals('not( is equal to 1 or is greater than 1 )', $constraint->toString()); |
|
467 | - $this->assertCount(2, $constraint); |
|
465 | + $this->assertFalse($constraint->evaluate(1, '', true)); |
|
466 | + $this->assertEquals('not( is equal to 1 or is greater than 1 )', $constraint->toString()); |
|
467 | + $this->assertCount(2, $constraint); |
|
468 | 468 | |
469 | - try { |
|
470 | - $constraint->evaluate(1); |
|
471 | - } catch (ExpectationFailedException $e) { |
|
472 | - $this->assertEquals( |
|
473 | - <<<EOF |
|
469 | + try { |
|
470 | + $constraint->evaluate(1); |
|
471 | + } catch (ExpectationFailedException $e) { |
|
472 | + $this->assertEquals( |
|
473 | + <<<EOF |
|
474 | 474 | Failed asserting that not( 1 is equal to 1 or is greater than 1 ). |
475 | 475 | |
476 | 476 | EOF |
477 | - , |
|
478 | - TestFailure::exceptionToString($e) |
|
479 | - ); |
|
477 | + , |
|
478 | + TestFailure::exceptionToString($e) |
|
479 | + ); |
|
480 | 480 | |
481 | - return; |
|
482 | - } |
|
481 | + return; |
|
482 | + } |
|
483 | 483 | |
484 | - $this->fail(); |
|
485 | - } |
|
484 | + $this->fail(); |
|
485 | + } |
|
486 | 486 | |
487 | - public function testConstraintNotGreaterThanOrEqual2() |
|
488 | - { |
|
489 | - $constraint = Assert::logicalNot( |
|
490 | - Assert::greaterThanOrEqual(1) |
|
491 | - ); |
|
487 | + public function testConstraintNotGreaterThanOrEqual2() |
|
488 | + { |
|
489 | + $constraint = Assert::logicalNot( |
|
490 | + Assert::greaterThanOrEqual(1) |
|
491 | + ); |
|
492 | 492 | |
493 | - try { |
|
494 | - $constraint->evaluate(1, 'custom message'); |
|
495 | - } catch (ExpectationFailedException $e) { |
|
496 | - $this->assertEquals( |
|
497 | - <<<EOF |
|
493 | + try { |
|
494 | + $constraint->evaluate(1, 'custom message'); |
|
495 | + } catch (ExpectationFailedException $e) { |
|
496 | + $this->assertEquals( |
|
497 | + <<<EOF |
|
498 | 498 | custom message |
499 | 499 | Failed asserting that not( 1 is equal to 1 or is greater than 1 ). |
500 | 500 | |
501 | 501 | EOF |
502 | - , |
|
503 | - TestFailure::exceptionToString($e) |
|
504 | - ); |
|
502 | + , |
|
503 | + TestFailure::exceptionToString($e) |
|
504 | + ); |
|
505 | 505 | |
506 | - return; |
|
507 | - } |
|
506 | + return; |
|
507 | + } |
|
508 | 508 | |
509 | - $this->fail(); |
|
510 | - } |
|
509 | + $this->fail(); |
|
510 | + } |
|
511 | 511 | |
512 | - public function testConstraintIsAnything() |
|
513 | - { |
|
514 | - $constraint = Assert::anything(); |
|
512 | + public function testConstraintIsAnything() |
|
513 | + { |
|
514 | + $constraint = Assert::anything(); |
|
515 | 515 | |
516 | - $this->assertTrue($constraint->evaluate(null, '', true)); |
|
517 | - $this->assertNull($constraint->evaluate(null)); |
|
518 | - $this->assertEquals('is anything', $constraint->toString()); |
|
519 | - $this->assertCount(0, $constraint); |
|
520 | - } |
|
516 | + $this->assertTrue($constraint->evaluate(null, '', true)); |
|
517 | + $this->assertNull($constraint->evaluate(null)); |
|
518 | + $this->assertEquals('is anything', $constraint->toString()); |
|
519 | + $this->assertCount(0, $constraint); |
|
520 | + } |
|
521 | 521 | |
522 | - public function testConstraintNotIsAnything() |
|
523 | - { |
|
524 | - $constraint = Assert::logicalNot( |
|
525 | - Assert::anything() |
|
526 | - ); |
|
522 | + public function testConstraintNotIsAnything() |
|
523 | + { |
|
524 | + $constraint = Assert::logicalNot( |
|
525 | + Assert::anything() |
|
526 | + ); |
|
527 | 527 | |
528 | - $this->assertFalse($constraint->evaluate(null, '', true)); |
|
529 | - $this->assertEquals('is not anything', $constraint->toString()); |
|
530 | - $this->assertCount(0, $constraint); |
|
528 | + $this->assertFalse($constraint->evaluate(null, '', true)); |
|
529 | + $this->assertEquals('is not anything', $constraint->toString()); |
|
530 | + $this->assertCount(0, $constraint); |
|
531 | 531 | |
532 | - try { |
|
533 | - $constraint->evaluate(null); |
|
534 | - } catch (ExpectationFailedException $e) { |
|
535 | - $this->assertEquals( |
|
536 | - <<<EOF |
|
532 | + try { |
|
533 | + $constraint->evaluate(null); |
|
534 | + } catch (ExpectationFailedException $e) { |
|
535 | + $this->assertEquals( |
|
536 | + <<<EOF |
|
537 | 537 | Failed asserting that null is not anything. |
538 | 538 | |
539 | 539 | EOF |
540 | - , |
|
541 | - TestFailure::exceptionToString($e) |
|
542 | - ); |
|
540 | + , |
|
541 | + TestFailure::exceptionToString($e) |
|
542 | + ); |
|
543 | 543 | |
544 | - return; |
|
545 | - } |
|
544 | + return; |
|
545 | + } |
|
546 | 546 | |
547 | - $this->fail(); |
|
548 | - } |
|
547 | + $this->fail(); |
|
548 | + } |
|
549 | 549 | |
550 | - public function testConstraintIsEqual() |
|
551 | - { |
|
552 | - $constraint = Assert::equalTo(1); |
|
550 | + public function testConstraintIsEqual() |
|
551 | + { |
|
552 | + $constraint = Assert::equalTo(1); |
|
553 | 553 | |
554 | - $this->assertTrue($constraint->evaluate(1, '', true)); |
|
555 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
556 | - $this->assertEquals('is equal to 1', $constraint->toString()); |
|
557 | - $this->assertCount(1, $constraint); |
|
554 | + $this->assertTrue($constraint->evaluate(1, '', true)); |
|
555 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
556 | + $this->assertEquals('is equal to 1', $constraint->toString()); |
|
557 | + $this->assertCount(1, $constraint); |
|
558 | 558 | |
559 | - try { |
|
560 | - $constraint->evaluate(0); |
|
561 | - } catch (ExpectationFailedException $e) { |
|
562 | - $this->assertEquals( |
|
563 | - <<<EOF |
|
559 | + try { |
|
560 | + $constraint->evaluate(0); |
|
561 | + } catch (ExpectationFailedException $e) { |
|
562 | + $this->assertEquals( |
|
563 | + <<<EOF |
|
564 | 564 | Failed asserting that 0 matches expected 1. |
565 | 565 | |
566 | 566 | EOF |
567 | - , |
|
568 | - TestFailure::exceptionToString($e) |
|
569 | - ); |
|
570 | - |
|
571 | - return; |
|
572 | - } |
|
573 | - |
|
574 | - $this->fail(); |
|
575 | - } |
|
576 | - |
|
577 | - public function isEqualProvider() |
|
578 | - { |
|
579 | - $a = new \stdClass; |
|
580 | - $a->foo = 'bar'; |
|
581 | - $b = new \stdClass; |
|
582 | - $ahash = \spl_object_hash($a); |
|
583 | - $bhash = \spl_object_hash($b); |
|
584 | - |
|
585 | - $c = new \stdClass; |
|
586 | - $c->foo = 'bar'; |
|
587 | - $c->int = 1; |
|
588 | - $c->array = [0, [1], [2], 3]; |
|
589 | - $c->related = new \stdClass; |
|
590 | - $c->related->foo = "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk"; |
|
591 | - $c->self = $c; |
|
592 | - $c->c = $c; |
|
593 | - $d = new \stdClass; |
|
594 | - $d->foo = 'bar'; |
|
595 | - $d->int = 2; |
|
596 | - $d->array = [0, [4], [2], 3]; |
|
597 | - $d->related = new \stdClass; |
|
598 | - $d->related->foo = "a\np\nc\nd\ne\nf\ng\nh\ni\nw\nk"; |
|
599 | - $d->self = $d; |
|
600 | - $d->c = $c; |
|
601 | - |
|
602 | - $storage1 = new \SplObjectStorage; |
|
603 | - $storage1->attach($a); |
|
604 | - $storage1->attach($b); |
|
605 | - $storage2 = new \SplObjectStorage; |
|
606 | - $storage2->attach($b); |
|
607 | - $storage1hash = \spl_object_hash($storage1); |
|
608 | - $storage2hash = \spl_object_hash($storage2); |
|
609 | - |
|
610 | - $dom1 = new \DOMDocument; |
|
611 | - $dom1->preserveWhiteSpace = false; |
|
612 | - $dom1->loadXML('<root></root>'); |
|
613 | - $dom2 = new \DOMDocument; |
|
614 | - $dom2->preserveWhiteSpace = false; |
|
615 | - $dom2->loadXML('<root><foo/></root>'); |
|
616 | - |
|
617 | - $data = [ |
|
618 | - [1, 0, <<<EOF |
|
567 | + , |
|
568 | + TestFailure::exceptionToString($e) |
|
569 | + ); |
|
570 | + |
|
571 | + return; |
|
572 | + } |
|
573 | + |
|
574 | + $this->fail(); |
|
575 | + } |
|
576 | + |
|
577 | + public function isEqualProvider() |
|
578 | + { |
|
579 | + $a = new \stdClass; |
|
580 | + $a->foo = 'bar'; |
|
581 | + $b = new \stdClass; |
|
582 | + $ahash = \spl_object_hash($a); |
|
583 | + $bhash = \spl_object_hash($b); |
|
584 | + |
|
585 | + $c = new \stdClass; |
|
586 | + $c->foo = 'bar'; |
|
587 | + $c->int = 1; |
|
588 | + $c->array = [0, [1], [2], 3]; |
|
589 | + $c->related = new \stdClass; |
|
590 | + $c->related->foo = "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk"; |
|
591 | + $c->self = $c; |
|
592 | + $c->c = $c; |
|
593 | + $d = new \stdClass; |
|
594 | + $d->foo = 'bar'; |
|
595 | + $d->int = 2; |
|
596 | + $d->array = [0, [4], [2], 3]; |
|
597 | + $d->related = new \stdClass; |
|
598 | + $d->related->foo = "a\np\nc\nd\ne\nf\ng\nh\ni\nw\nk"; |
|
599 | + $d->self = $d; |
|
600 | + $d->c = $c; |
|
601 | + |
|
602 | + $storage1 = new \SplObjectStorage; |
|
603 | + $storage1->attach($a); |
|
604 | + $storage1->attach($b); |
|
605 | + $storage2 = new \SplObjectStorage; |
|
606 | + $storage2->attach($b); |
|
607 | + $storage1hash = \spl_object_hash($storage1); |
|
608 | + $storage2hash = \spl_object_hash($storage2); |
|
609 | + |
|
610 | + $dom1 = new \DOMDocument; |
|
611 | + $dom1->preserveWhiteSpace = false; |
|
612 | + $dom1->loadXML('<root></root>'); |
|
613 | + $dom2 = new \DOMDocument; |
|
614 | + $dom2->preserveWhiteSpace = false; |
|
615 | + $dom2->loadXML('<root><foo/></root>'); |
|
616 | + |
|
617 | + $data = [ |
|
618 | + [1, 0, <<<EOF |
|
619 | 619 | Failed asserting that 0 matches expected 1. |
620 | 620 | |
621 | 621 | EOF |
622 | - ], |
|
623 | - [1.1, 0, <<<EOF |
|
622 | + ], |
|
623 | + [1.1, 0, <<<EOF |
|
624 | 624 | Failed asserting that 0 matches expected 1.1. |
625 | 625 | |
626 | 626 | EOF |
627 | - ], |
|
628 | - ['a', 'b', <<<EOF |
|
627 | + ], |
|
628 | + ['a', 'b', <<<EOF |
|
629 | 629 | Failed asserting that two strings are equal. |
630 | 630 | --- Expected |
631 | 631 | +++ Actual |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | +'b' |
635 | 635 | |
636 | 636 | EOF |
637 | - ], |
|
638 | - ["a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk", "a\np\nc\nd\ne\nf\ng\nh\ni\nw\nk", <<<EOF |
|
637 | + ], |
|
638 | + ["a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk", "a\np\nc\nd\ne\nf\ng\nh\ni\nw\nk", <<<EOF |
|
639 | 639 | Failed asserting that two strings are equal. |
640 | 640 | --- Expected |
641 | 641 | +++ Actual |
@@ -648,18 +648,18 @@ discard block |
||
648 | 648 | +w\\n |
649 | 649 | |
650 | 650 | EOF |
651 | - ], |
|
652 | - [1, [0], <<<EOF |
|
651 | + ], |
|
652 | + [1, [0], <<<EOF |
|
653 | 653 | Array (...) does not match expected type "integer". |
654 | 654 | |
655 | 655 | EOF |
656 | - ], |
|
657 | - [[0], 1, <<<EOF |
|
656 | + ], |
|
657 | + [[0], 1, <<<EOF |
|
658 | 658 | 1 does not match expected type "array". |
659 | 659 | |
660 | 660 | EOF |
661 | - ], |
|
662 | - [[0], [1], <<<EOF |
|
661 | + ], |
|
662 | + [[0], [1], <<<EOF |
|
663 | 663 | Failed asserting that two arrays are equal. |
664 | 664 | --- Expected |
665 | 665 | +++ Actual |
@@ -669,8 +669,8 @@ discard block |
||
669 | 669 | + 0 => 1 |
670 | 670 | |
671 | 671 | EOF |
672 | - ], |
|
673 | - [[true], ['true'], <<<EOF |
|
672 | + ], |
|
673 | + [[true], ['true'], <<<EOF |
|
674 | 674 | Failed asserting that two arrays are equal. |
675 | 675 | --- Expected |
676 | 676 | +++ Actual |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | + 0 => 'true' |
681 | 681 | |
682 | 682 | EOF |
683 | - ], |
|
684 | - [[0, [1], [2], 3], [0, [4], [2], 3], <<<EOF |
|
683 | + ], |
|
684 | + [[0, [1], [2], 3], [0, [4], [2], 3], <<<EOF |
|
685 | 685 | Failed asserting that two arrays are equal. |
686 | 686 | --- Expected |
687 | 687 | +++ Actual |
@@ -693,18 +693,18 @@ discard block |
||
693 | 693 | + 0 => 4 |
694 | 694 | |
695 | 695 | EOF |
696 | - ], |
|
697 | - [$a, [0], <<<EOF |
|
696 | + ], |
|
697 | + [$a, [0], <<<EOF |
|
698 | 698 | Array (...) does not match expected type "object". |
699 | 699 | |
700 | 700 | EOF |
701 | - ], |
|
702 | - [[0], $a, <<<EOF |
|
701 | + ], |
|
702 | + [[0], $a, <<<EOF |
|
703 | 703 | stdClass Object (...) does not match expected type "array". |
704 | 704 | |
705 | 705 | EOF |
706 | - ], |
|
707 | - [$a, $b, <<<EOF |
|
706 | + ], |
|
707 | + [$a, $b, <<<EOF |
|
708 | 708 | Failed asserting that two objects are equal. |
709 | 709 | --- Expected |
710 | 710 | +++ Actual |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | - 'foo' => 'bar' |
714 | 714 | |
715 | 715 | EOF |
716 | - ], |
|
717 | - [$c, $d, <<<EOF |
|
716 | + ], |
|
717 | + [$c, $d, <<<EOF |
|
718 | 718 | Failed asserting that two objects are equal. |
719 | 719 | --- Expected |
720 | 720 | +++ Actual |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | + w\\n |
737 | 737 | |
738 | 738 | EOF |
739 | - ], |
|
740 | - [$dom1, $dom2, <<<EOF |
|
739 | + ], |
|
740 | + [$dom1, $dom2, <<<EOF |
|
741 | 741 | Failed asserting that two DOM documents are equal. |
742 | 742 | --- Expected |
743 | 743 | +++ Actual |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | +</root> |
750 | 750 | |
751 | 751 | EOF |
752 | - ], |
|
753 | - [ |
|
754 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
755 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
756 | - <<<EOF |
|
752 | + ], |
|
753 | + [ |
|
754 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
755 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
756 | + <<<EOF |
|
757 | 757 | Failed asserting that two DateTime objects are equal. |
758 | 758 | --- Expected |
759 | 759 | +++ Actual |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | +2013-03-29T04:13:35.000000-0500 |
763 | 763 | |
764 | 764 | EOF |
765 | - ], |
|
766 | - ]; |
|
765 | + ], |
|
766 | + ]; |
|
767 | 767 | |
768 | - if (PHP_MAJOR_VERSION < 7) { |
|
769 | - $data[] = [$storage1, $storage2, <<<EOF |
|
768 | + if (PHP_MAJOR_VERSION < 7) { |
|
769 | + $data[] = [$storage1, $storage2, <<<EOF |
|
770 | 770 | Failed asserting that two objects are equal. |
771 | 771 | --- Expected |
772 | 772 | +++ Actual |
@@ -783,9 +783,9 @@ discard block |
||
783 | 783 | + '$bhash' => Array &0 ( |
784 | 784 | |
785 | 785 | EOF |
786 | - ]; |
|
787 | - } else { |
|
788 | - $data[] = [$storage1, $storage2, <<<EOF |
|
786 | + ]; |
|
787 | + } else { |
|
788 | + $data[] = [$storage1, $storage2, <<<EOF |
|
789 | 789 | Failed asserting that two objects are equal. |
790 | 790 | --- Expected |
791 | 791 | +++ Actual |
@@ -802,152 +802,152 @@ discard block |
||
802 | 802 | + '$bhash' => Array &0 ( |
803 | 803 | |
804 | 804 | EOF |
805 | - ]; |
|
806 | - } |
|
807 | - |
|
808 | - return $data; |
|
809 | - } |
|
810 | - |
|
811 | - /** |
|
812 | - * @dataProvider isEqualProvider |
|
813 | - */ |
|
814 | - public function testConstraintIsEqual2($expected, $actual, $message) |
|
815 | - { |
|
816 | - $constraint = Assert::equalTo($expected); |
|
817 | - |
|
818 | - try { |
|
819 | - $constraint->evaluate($actual, 'custom message'); |
|
820 | - } catch (ExpectationFailedException $e) { |
|
821 | - $this->assertEquals( |
|
822 | - "custom message\n$message", |
|
823 | - $this->trimnl(TestFailure::exceptionToString($e)) |
|
824 | - ); |
|
825 | - |
|
826 | - return; |
|
827 | - } |
|
828 | - |
|
829 | - $this->fail(); |
|
830 | - } |
|
831 | - |
|
832 | - public function testConstraintIsNotEqual() |
|
833 | - { |
|
834 | - $constraint = Assert::logicalNot( |
|
835 | - Assert::equalTo(1) |
|
836 | - ); |
|
837 | - |
|
838 | - $this->assertTrue($constraint->evaluate(0, '', true)); |
|
839 | - $this->assertFalse($constraint->evaluate(1, '', true)); |
|
840 | - $this->assertEquals('is not equal to 1', $constraint->toString()); |
|
841 | - $this->assertCount(1, $constraint); |
|
842 | - |
|
843 | - try { |
|
844 | - $constraint->evaluate(1); |
|
845 | - } catch (ExpectationFailedException $e) { |
|
846 | - $this->assertEquals( |
|
847 | - <<<EOF |
|
805 | + ]; |
|
806 | + } |
|
807 | + |
|
808 | + return $data; |
|
809 | + } |
|
810 | + |
|
811 | + /** |
|
812 | + * @dataProvider isEqualProvider |
|
813 | + */ |
|
814 | + public function testConstraintIsEqual2($expected, $actual, $message) |
|
815 | + { |
|
816 | + $constraint = Assert::equalTo($expected); |
|
817 | + |
|
818 | + try { |
|
819 | + $constraint->evaluate($actual, 'custom message'); |
|
820 | + } catch (ExpectationFailedException $e) { |
|
821 | + $this->assertEquals( |
|
822 | + "custom message\n$message", |
|
823 | + $this->trimnl(TestFailure::exceptionToString($e)) |
|
824 | + ); |
|
825 | + |
|
826 | + return; |
|
827 | + } |
|
828 | + |
|
829 | + $this->fail(); |
|
830 | + } |
|
831 | + |
|
832 | + public function testConstraintIsNotEqual() |
|
833 | + { |
|
834 | + $constraint = Assert::logicalNot( |
|
835 | + Assert::equalTo(1) |
|
836 | + ); |
|
837 | + |
|
838 | + $this->assertTrue($constraint->evaluate(0, '', true)); |
|
839 | + $this->assertFalse($constraint->evaluate(1, '', true)); |
|
840 | + $this->assertEquals('is not equal to 1', $constraint->toString()); |
|
841 | + $this->assertCount(1, $constraint); |
|
842 | + |
|
843 | + try { |
|
844 | + $constraint->evaluate(1); |
|
845 | + } catch (ExpectationFailedException $e) { |
|
846 | + $this->assertEquals( |
|
847 | + <<<EOF |
|
848 | 848 | Failed asserting that 1 is not equal to 1. |
849 | 849 | |
850 | 850 | EOF |
851 | - , |
|
852 | - TestFailure::exceptionToString($e) |
|
853 | - ); |
|
851 | + , |
|
852 | + TestFailure::exceptionToString($e) |
|
853 | + ); |
|
854 | 854 | |
855 | - return; |
|
856 | - } |
|
855 | + return; |
|
856 | + } |
|
857 | 857 | |
858 | - $this->fail(); |
|
859 | - } |
|
858 | + $this->fail(); |
|
859 | + } |
|
860 | 860 | |
861 | - public function testConstraintIsNotEqual2() |
|
862 | - { |
|
863 | - $constraint = Assert::logicalNot( |
|
864 | - Assert::equalTo(1) |
|
865 | - ); |
|
861 | + public function testConstraintIsNotEqual2() |
|
862 | + { |
|
863 | + $constraint = Assert::logicalNot( |
|
864 | + Assert::equalTo(1) |
|
865 | + ); |
|
866 | 866 | |
867 | - try { |
|
868 | - $constraint->evaluate(1, 'custom message'); |
|
869 | - } catch (ExpectationFailedException $e) { |
|
870 | - $this->assertEquals( |
|
871 | - <<<EOF |
|
867 | + try { |
|
868 | + $constraint->evaluate(1, 'custom message'); |
|
869 | + } catch (ExpectationFailedException $e) { |
|
870 | + $this->assertEquals( |
|
871 | + <<<EOF |
|
872 | 872 | custom message |
873 | 873 | Failed asserting that 1 is not equal to 1. |
874 | 874 | |
875 | 875 | EOF |
876 | - , |
|
877 | - TestFailure::exceptionToString($e) |
|
878 | - ); |
|
876 | + , |
|
877 | + TestFailure::exceptionToString($e) |
|
878 | + ); |
|
879 | 879 | |
880 | - return; |
|
881 | - } |
|
880 | + return; |
|
881 | + } |
|
882 | 882 | |
883 | - $this->fail(); |
|
884 | - } |
|
883 | + $this->fail(); |
|
884 | + } |
|
885 | 885 | |
886 | - public function testConstraintIsIdentical() |
|
887 | - { |
|
888 | - $a = new \stdClass; |
|
889 | - $b = new \stdClass; |
|
886 | + public function testConstraintIsIdentical() |
|
887 | + { |
|
888 | + $a = new \stdClass; |
|
889 | + $b = new \stdClass; |
|
890 | 890 | |
891 | - $constraint = Assert::identicalTo($a); |
|
891 | + $constraint = Assert::identicalTo($a); |
|
892 | 892 | |
893 | - $this->assertFalse($constraint->evaluate($b, '', true)); |
|
894 | - $this->assertTrue($constraint->evaluate($a, '', true)); |
|
895 | - $this->assertEquals('is identical to an object of class "stdClass"', $constraint->toString()); |
|
896 | - $this->assertCount(1, $constraint); |
|
893 | + $this->assertFalse($constraint->evaluate($b, '', true)); |
|
894 | + $this->assertTrue($constraint->evaluate($a, '', true)); |
|
895 | + $this->assertEquals('is identical to an object of class "stdClass"', $constraint->toString()); |
|
896 | + $this->assertCount(1, $constraint); |
|
897 | 897 | |
898 | - try { |
|
899 | - $constraint->evaluate($b); |
|
900 | - } catch (ExpectationFailedException $e) { |
|
901 | - $this->assertEquals( |
|
902 | - <<<EOF |
|
898 | + try { |
|
899 | + $constraint->evaluate($b); |
|
900 | + } catch (ExpectationFailedException $e) { |
|
901 | + $this->assertEquals( |
|
902 | + <<<EOF |
|
903 | 903 | Failed asserting that two variables reference the same object. |
904 | 904 | |
905 | 905 | EOF |
906 | - , |
|
907 | - TestFailure::exceptionToString($e) |
|
908 | - ); |
|
906 | + , |
|
907 | + TestFailure::exceptionToString($e) |
|
908 | + ); |
|
909 | 909 | |
910 | - return; |
|
911 | - } |
|
910 | + return; |
|
911 | + } |
|
912 | 912 | |
913 | - $this->fail(); |
|
914 | - } |
|
913 | + $this->fail(); |
|
914 | + } |
|
915 | 915 | |
916 | - public function testConstraintIsIdentical2() |
|
917 | - { |
|
918 | - $a = new \stdClass; |
|
919 | - $b = new \stdClass; |
|
916 | + public function testConstraintIsIdentical2() |
|
917 | + { |
|
918 | + $a = new \stdClass; |
|
919 | + $b = new \stdClass; |
|
920 | 920 | |
921 | - $constraint = Assert::identicalTo($a); |
|
921 | + $constraint = Assert::identicalTo($a); |
|
922 | 922 | |
923 | - try { |
|
924 | - $constraint->evaluate($b, 'custom message'); |
|
925 | - } catch (ExpectationFailedException $e) { |
|
926 | - $this->assertEquals( |
|
927 | - <<<EOF |
|
923 | + try { |
|
924 | + $constraint->evaluate($b, 'custom message'); |
|
925 | + } catch (ExpectationFailedException $e) { |
|
926 | + $this->assertEquals( |
|
927 | + <<<EOF |
|
928 | 928 | custom message |
929 | 929 | Failed asserting that two variables reference the same object. |
930 | 930 | |
931 | 931 | EOF |
932 | - , |
|
933 | - TestFailure::exceptionToString($e) |
|
934 | - ); |
|
932 | + , |
|
933 | + TestFailure::exceptionToString($e) |
|
934 | + ); |
|
935 | 935 | |
936 | - return; |
|
937 | - } |
|
936 | + return; |
|
937 | + } |
|
938 | 938 | |
939 | - $this->fail(); |
|
940 | - } |
|
939 | + $this->fail(); |
|
940 | + } |
|
941 | 941 | |
942 | - public function testConstraintIsIdentical3() |
|
943 | - { |
|
944 | - $constraint = Assert::identicalTo('a'); |
|
942 | + public function testConstraintIsIdentical3() |
|
943 | + { |
|
944 | + $constraint = Assert::identicalTo('a'); |
|
945 | 945 | |
946 | - try { |
|
947 | - $constraint->evaluate('b', 'custom message'); |
|
948 | - } catch (ExpectationFailedException $e) { |
|
949 | - $this->assertEquals( |
|
950 | - <<<EOF |
|
946 | + try { |
|
947 | + $constraint->evaluate('b', 'custom message'); |
|
948 | + } catch (ExpectationFailedException $e) { |
|
949 | + $this->assertEquals( |
|
950 | + <<<EOF |
|
951 | 951 | custom message |
952 | 952 | Failed asserting that two strings are identical. |
953 | 953 | --- Expected |
@@ -957,2055 +957,2055 @@ discard block |
||
957 | 957 | +'b' |
958 | 958 | |
959 | 959 | EOF |
960 | - , |
|
961 | - TestFailure::exceptionToString($e) |
|
962 | - ); |
|
960 | + , |
|
961 | + TestFailure::exceptionToString($e) |
|
962 | + ); |
|
963 | 963 | |
964 | - return; |
|
965 | - } |
|
964 | + return; |
|
965 | + } |
|
966 | 966 | |
967 | - $this->fail(); |
|
968 | - } |
|
967 | + $this->fail(); |
|
968 | + } |
|
969 | 969 | |
970 | - public function testConstraintIsNotIdentical() |
|
971 | - { |
|
972 | - $a = new \stdClass; |
|
973 | - $b = new \stdClass; |
|
970 | + public function testConstraintIsNotIdentical() |
|
971 | + { |
|
972 | + $a = new \stdClass; |
|
973 | + $b = new \stdClass; |
|
974 | 974 | |
975 | - $constraint = Assert::logicalNot( |
|
976 | - Assert::identicalTo($a) |
|
977 | - ); |
|
975 | + $constraint = Assert::logicalNot( |
|
976 | + Assert::identicalTo($a) |
|
977 | + ); |
|
978 | 978 | |
979 | - $this->assertTrue($constraint->evaluate($b, '', true)); |
|
980 | - $this->assertFalse($constraint->evaluate($a, '', true)); |
|
981 | - $this->assertEquals('is not identical to an object of class "stdClass"', $constraint->toString()); |
|
982 | - $this->assertCount(1, $constraint); |
|
979 | + $this->assertTrue($constraint->evaluate($b, '', true)); |
|
980 | + $this->assertFalse($constraint->evaluate($a, '', true)); |
|
981 | + $this->assertEquals('is not identical to an object of class "stdClass"', $constraint->toString()); |
|
982 | + $this->assertCount(1, $constraint); |
|
983 | 983 | |
984 | - try { |
|
985 | - $constraint->evaluate($a); |
|
986 | - } catch (ExpectationFailedException $e) { |
|
987 | - $this->assertEquals( |
|
988 | - <<<EOF |
|
984 | + try { |
|
985 | + $constraint->evaluate($a); |
|
986 | + } catch (ExpectationFailedException $e) { |
|
987 | + $this->assertEquals( |
|
988 | + <<<EOF |
|
989 | 989 | Failed asserting that two variables don't reference the same object. |
990 | 990 | |
991 | 991 | EOF |
992 | - , |
|
993 | - $this->trimnl(TestFailure::exceptionToString($e)) |
|
994 | - ); |
|
992 | + , |
|
993 | + $this->trimnl(TestFailure::exceptionToString($e)) |
|
994 | + ); |
|
995 | 995 | |
996 | - return; |
|
997 | - } |
|
996 | + return; |
|
997 | + } |
|
998 | 998 | |
999 | - $this->fail(); |
|
1000 | - } |
|
999 | + $this->fail(); |
|
1000 | + } |
|
1001 | 1001 | |
1002 | - public function testConstraintIsNotIdentical2() |
|
1003 | - { |
|
1004 | - $a = new \stdClass; |
|
1002 | + public function testConstraintIsNotIdentical2() |
|
1003 | + { |
|
1004 | + $a = new \stdClass; |
|
1005 | 1005 | |
1006 | - $constraint = Assert::logicalNot( |
|
1007 | - Assert::identicalTo($a) |
|
1008 | - ); |
|
1006 | + $constraint = Assert::logicalNot( |
|
1007 | + Assert::identicalTo($a) |
|
1008 | + ); |
|
1009 | 1009 | |
1010 | - try { |
|
1011 | - $constraint->evaluate($a, 'custom message'); |
|
1012 | - } catch (ExpectationFailedException $e) { |
|
1013 | - $this->assertEquals( |
|
1014 | - <<<EOF |
|
1010 | + try { |
|
1011 | + $constraint->evaluate($a, 'custom message'); |
|
1012 | + } catch (ExpectationFailedException $e) { |
|
1013 | + $this->assertEquals( |
|
1014 | + <<<EOF |
|
1015 | 1015 | custom message |
1016 | 1016 | Failed asserting that two variables don't reference the same object. |
1017 | 1017 | |
1018 | 1018 | EOF |
1019 | - , |
|
1020 | - TestFailure::exceptionToString($e) |
|
1021 | - ); |
|
1019 | + , |
|
1020 | + TestFailure::exceptionToString($e) |
|
1021 | + ); |
|
1022 | 1022 | |
1023 | - return; |
|
1024 | - } |
|
1023 | + return; |
|
1024 | + } |
|
1025 | 1025 | |
1026 | - $this->fail(); |
|
1027 | - } |
|
1026 | + $this->fail(); |
|
1027 | + } |
|
1028 | 1028 | |
1029 | - public function testConstraintIsNotIdentical3() |
|
1030 | - { |
|
1031 | - $constraint = Assert::logicalNot( |
|
1032 | - Assert::identicalTo('a') |
|
1033 | - ); |
|
1029 | + public function testConstraintIsNotIdentical3() |
|
1030 | + { |
|
1031 | + $constraint = Assert::logicalNot( |
|
1032 | + Assert::identicalTo('a') |
|
1033 | + ); |
|
1034 | 1034 | |
1035 | - try { |
|
1036 | - $constraint->evaluate('a', 'custom message'); |
|
1037 | - } catch (ExpectationFailedException $e) { |
|
1038 | - $this->assertEquals( |
|
1039 | - <<<EOF |
|
1035 | + try { |
|
1036 | + $constraint->evaluate('a', 'custom message'); |
|
1037 | + } catch (ExpectationFailedException $e) { |
|
1038 | + $this->assertEquals( |
|
1039 | + <<<EOF |
|
1040 | 1040 | custom message |
1041 | 1041 | Failed asserting that two strings are not identical. |
1042 | 1042 | |
1043 | 1043 | EOF |
1044 | - , |
|
1045 | - $this->trimnl(TestFailure::exceptionToString($e)) |
|
1046 | - ); |
|
1044 | + , |
|
1045 | + $this->trimnl(TestFailure::exceptionToString($e)) |
|
1046 | + ); |
|
1047 | 1047 | |
1048 | - return; |
|
1049 | - } |
|
1048 | + return; |
|
1049 | + } |
|
1050 | 1050 | |
1051 | - $this->fail(); |
|
1052 | - } |
|
1051 | + $this->fail(); |
|
1052 | + } |
|
1053 | 1053 | |
1054 | - public function testConstraintIsInstanceOf() |
|
1055 | - { |
|
1056 | - $constraint = Assert::isInstanceOf(\Exception::class); |
|
1054 | + public function testConstraintIsInstanceOf() |
|
1055 | + { |
|
1056 | + $constraint = Assert::isInstanceOf(\Exception::class); |
|
1057 | 1057 | |
1058 | - $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1059 | - $this->assertTrue($constraint->evaluate(new \Exception, '', true)); |
|
1060 | - $this->assertEquals('is instance of class "Exception"', $constraint->toString()); |
|
1061 | - $this->assertCount(1, $constraint); |
|
1058 | + $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1059 | + $this->assertTrue($constraint->evaluate(new \Exception, '', true)); |
|
1060 | + $this->assertEquals('is instance of class "Exception"', $constraint->toString()); |
|
1061 | + $this->assertCount(1, $constraint); |
|
1062 | 1062 | |
1063 | - $interfaceConstraint = Assert::isInstanceOf(\Countable::class); |
|
1064 | - $this->assertFalse($interfaceConstraint->evaluate(new \stdClass, '', true)); |
|
1065 | - $this->assertTrue($interfaceConstraint->evaluate(new \ArrayObject, '', true)); |
|
1066 | - $this->assertEquals('is instance of interface "Countable"', $interfaceConstraint->toString()); |
|
1063 | + $interfaceConstraint = Assert::isInstanceOf(\Countable::class); |
|
1064 | + $this->assertFalse($interfaceConstraint->evaluate(new \stdClass, '', true)); |
|
1065 | + $this->assertTrue($interfaceConstraint->evaluate(new \ArrayObject, '', true)); |
|
1066 | + $this->assertEquals('is instance of interface "Countable"', $interfaceConstraint->toString()); |
|
1067 | 1067 | |
1068 | - try { |
|
1069 | - $constraint->evaluate(new \stdClass); |
|
1070 | - } catch (ExpectationFailedException $e) { |
|
1071 | - $this->assertEquals( |
|
1072 | - <<<EOF |
|
1068 | + try { |
|
1069 | + $constraint->evaluate(new \stdClass); |
|
1070 | + } catch (ExpectationFailedException $e) { |
|
1071 | + $this->assertEquals( |
|
1072 | + <<<EOF |
|
1073 | 1073 | Failed asserting that stdClass Object () is an instance of class "Exception". |
1074 | 1074 | |
1075 | 1075 | EOF |
1076 | - , |
|
1077 | - TestFailure::exceptionToString($e) |
|
1078 | - ); |
|
1076 | + , |
|
1077 | + TestFailure::exceptionToString($e) |
|
1078 | + ); |
|
1079 | 1079 | |
1080 | - return; |
|
1081 | - } |
|
1080 | + return; |
|
1081 | + } |
|
1082 | 1082 | |
1083 | - $this->fail(); |
|
1084 | - } |
|
1083 | + $this->fail(); |
|
1084 | + } |
|
1085 | 1085 | |
1086 | - public function testConstraintIsInstanceOf2() |
|
1087 | - { |
|
1088 | - $constraint = Assert::isInstanceOf(\Exception::class); |
|
1086 | + public function testConstraintIsInstanceOf2() |
|
1087 | + { |
|
1088 | + $constraint = Assert::isInstanceOf(\Exception::class); |
|
1089 | 1089 | |
1090 | - try { |
|
1091 | - $constraint->evaluate(new \stdClass, 'custom message'); |
|
1092 | - } catch (ExpectationFailedException $e) { |
|
1093 | - $this->assertEquals( |
|
1094 | - <<<EOF |
|
1090 | + try { |
|
1091 | + $constraint->evaluate(new \stdClass, 'custom message'); |
|
1092 | + } catch (ExpectationFailedException $e) { |
|
1093 | + $this->assertEquals( |
|
1094 | + <<<EOF |
|
1095 | 1095 | custom message |
1096 | 1096 | Failed asserting that stdClass Object () is an instance of class "Exception". |
1097 | 1097 | |
1098 | 1098 | EOF |
1099 | - , |
|
1100 | - TestFailure::exceptionToString($e) |
|
1101 | - ); |
|
1099 | + , |
|
1100 | + TestFailure::exceptionToString($e) |
|
1101 | + ); |
|
1102 | 1102 | |
1103 | - return; |
|
1104 | - } |
|
1103 | + return; |
|
1104 | + } |
|
1105 | 1105 | |
1106 | - $this->fail(); |
|
1107 | - } |
|
1106 | + $this->fail(); |
|
1107 | + } |
|
1108 | 1108 | |
1109 | - public function testConstraintIsNotInstanceOf() |
|
1110 | - { |
|
1111 | - $constraint = Assert::logicalNot( |
|
1112 | - Assert::isInstanceOf(\stdClass::class) |
|
1113 | - ); |
|
1109 | + public function testConstraintIsNotInstanceOf() |
|
1110 | + { |
|
1111 | + $constraint = Assert::logicalNot( |
|
1112 | + Assert::isInstanceOf(\stdClass::class) |
|
1113 | + ); |
|
1114 | 1114 | |
1115 | - $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1116 | - $this->assertTrue($constraint->evaluate(new Exception, '', true)); |
|
1117 | - $this->assertEquals('is not instance of class "stdClass"', $constraint->toString()); |
|
1118 | - $this->assertCount(1, $constraint); |
|
1115 | + $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1116 | + $this->assertTrue($constraint->evaluate(new Exception, '', true)); |
|
1117 | + $this->assertEquals('is not instance of class "stdClass"', $constraint->toString()); |
|
1118 | + $this->assertCount(1, $constraint); |
|
1119 | 1119 | |
1120 | - try { |
|
1121 | - $constraint->evaluate(new \stdClass); |
|
1122 | - } catch (ExpectationFailedException $e) { |
|
1123 | - $this->assertEquals( |
|
1124 | - <<<EOF |
|
1120 | + try { |
|
1121 | + $constraint->evaluate(new \stdClass); |
|
1122 | + } catch (ExpectationFailedException $e) { |
|
1123 | + $this->assertEquals( |
|
1124 | + <<<EOF |
|
1125 | 1125 | Failed asserting that stdClass Object () is not an instance of class "stdClass". |
1126 | 1126 | |
1127 | 1127 | EOF |
1128 | - , |
|
1129 | - TestFailure::exceptionToString($e) |
|
1130 | - ); |
|
1128 | + , |
|
1129 | + TestFailure::exceptionToString($e) |
|
1130 | + ); |
|
1131 | 1131 | |
1132 | - return; |
|
1133 | - } |
|
1132 | + return; |
|
1133 | + } |
|
1134 | 1134 | |
1135 | - $this->fail(); |
|
1136 | - } |
|
1135 | + $this->fail(); |
|
1136 | + } |
|
1137 | 1137 | |
1138 | - public function testConstraintIsNotInstanceOf2() |
|
1139 | - { |
|
1140 | - $constraint = Assert::logicalNot( |
|
1141 | - Assert::isInstanceOf(\stdClass::class) |
|
1142 | - ); |
|
1138 | + public function testConstraintIsNotInstanceOf2() |
|
1139 | + { |
|
1140 | + $constraint = Assert::logicalNot( |
|
1141 | + Assert::isInstanceOf(\stdClass::class) |
|
1142 | + ); |
|
1143 | 1143 | |
1144 | - try { |
|
1145 | - $constraint->evaluate(new \stdClass, 'custom message'); |
|
1146 | - } catch (ExpectationFailedException $e) { |
|
1147 | - $this->assertEquals( |
|
1148 | - <<<EOF |
|
1144 | + try { |
|
1145 | + $constraint->evaluate(new \stdClass, 'custom message'); |
|
1146 | + } catch (ExpectationFailedException $e) { |
|
1147 | + $this->assertEquals( |
|
1148 | + <<<EOF |
|
1149 | 1149 | custom message |
1150 | 1150 | Failed asserting that stdClass Object () is not an instance of class "stdClass". |
1151 | 1151 | |
1152 | 1152 | EOF |
1153 | - , |
|
1154 | - TestFailure::exceptionToString($e) |
|
1155 | - ); |
|
1153 | + , |
|
1154 | + TestFailure::exceptionToString($e) |
|
1155 | + ); |
|
1156 | 1156 | |
1157 | - return; |
|
1158 | - } |
|
1157 | + return; |
|
1158 | + } |
|
1159 | 1159 | |
1160 | - $this->fail(); |
|
1161 | - } |
|
1160 | + $this->fail(); |
|
1161 | + } |
|
1162 | 1162 | |
1163 | - public function testConstraintIsType() |
|
1164 | - { |
|
1165 | - $constraint = Assert::isType('string'); |
|
1163 | + public function testConstraintIsType() |
|
1164 | + { |
|
1165 | + $constraint = Assert::isType('string'); |
|
1166 | 1166 | |
1167 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1168 | - $this->assertTrue($constraint->evaluate('', '', true)); |
|
1169 | - $this->assertEquals('is of type "string"', $constraint->toString()); |
|
1170 | - $this->assertCount(1, $constraint); |
|
1167 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1168 | + $this->assertTrue($constraint->evaluate('', '', true)); |
|
1169 | + $this->assertEquals('is of type "string"', $constraint->toString()); |
|
1170 | + $this->assertCount(1, $constraint); |
|
1171 | 1171 | |
1172 | - try { |
|
1173 | - $constraint->evaluate(new \stdClass); |
|
1174 | - } catch (ExpectationFailedException $e) { |
|
1175 | - $this->assertStringMatchesFormat( |
|
1176 | - <<<EOF |
|
1172 | + try { |
|
1173 | + $constraint->evaluate(new \stdClass); |
|
1174 | + } catch (ExpectationFailedException $e) { |
|
1175 | + $this->assertStringMatchesFormat( |
|
1176 | + <<<EOF |
|
1177 | 1177 | Failed asserting that stdClass Object &%x () is of type "string". |
1178 | 1178 | |
1179 | 1179 | EOF |
1180 | - , |
|
1181 | - $this->trimnl(TestFailure::exceptionToString($e)) |
|
1182 | - ); |
|
1180 | + , |
|
1181 | + $this->trimnl(TestFailure::exceptionToString($e)) |
|
1182 | + ); |
|
1183 | 1183 | |
1184 | - return; |
|
1185 | - } |
|
1184 | + return; |
|
1185 | + } |
|
1186 | 1186 | |
1187 | - $this->fail(); |
|
1188 | - } |
|
1187 | + $this->fail(); |
|
1188 | + } |
|
1189 | 1189 | |
1190 | - public function testConstraintIsType2() |
|
1191 | - { |
|
1192 | - $constraint = Assert::isType('string'); |
|
1190 | + public function testConstraintIsType2() |
|
1191 | + { |
|
1192 | + $constraint = Assert::isType('string'); |
|
1193 | 1193 | |
1194 | - try { |
|
1195 | - $constraint->evaluate(new \stdClass, 'custom message'); |
|
1196 | - } catch (ExpectationFailedException $e) { |
|
1197 | - $this->assertStringMatchesFormat( |
|
1198 | - <<<EOF |
|
1194 | + try { |
|
1195 | + $constraint->evaluate(new \stdClass, 'custom message'); |
|
1196 | + } catch (ExpectationFailedException $e) { |
|
1197 | + $this->assertStringMatchesFormat( |
|
1198 | + <<<EOF |
|
1199 | 1199 | custom message |
1200 | 1200 | Failed asserting that stdClass Object &%x () is of type "string". |
1201 | 1201 | |
1202 | 1202 | EOF |
1203 | - , |
|
1204 | - $this->trimnl(TestFailure::exceptionToString($e)) |
|
1205 | - ); |
|
1203 | + , |
|
1204 | + $this->trimnl(TestFailure::exceptionToString($e)) |
|
1205 | + ); |
|
1206 | 1206 | |
1207 | - return; |
|
1208 | - } |
|
1207 | + return; |
|
1208 | + } |
|
1209 | 1209 | |
1210 | - $this->fail(); |
|
1211 | - } |
|
1210 | + $this->fail(); |
|
1211 | + } |
|
1212 | 1212 | |
1213 | - public function resources() |
|
1214 | - { |
|
1215 | - $fh = \fopen(__FILE__, 'r'); |
|
1216 | - \fclose($fh); |
|
1213 | + public function resources() |
|
1214 | + { |
|
1215 | + $fh = \fopen(__FILE__, 'r'); |
|
1216 | + \fclose($fh); |
|
1217 | 1217 | |
1218 | - return [ |
|
1219 | - 'open resource' => [\fopen(__FILE__, 'r')], |
|
1220 | - 'closed resource' => [$fh], |
|
1221 | - ]; |
|
1222 | - } |
|
1218 | + return [ |
|
1219 | + 'open resource' => [\fopen(__FILE__, 'r')], |
|
1220 | + 'closed resource' => [$fh], |
|
1221 | + ]; |
|
1222 | + } |
|
1223 | 1223 | |
1224 | - /** |
|
1225 | - * @dataProvider resources |
|
1226 | - */ |
|
1227 | - public function testConstraintIsResourceTypeEvaluatesCorrectlyWithResources($resource) |
|
1228 | - { |
|
1229 | - $constraint = Assert::isType('resource'); |
|
1224 | + /** |
|
1225 | + * @dataProvider resources |
|
1226 | + */ |
|
1227 | + public function testConstraintIsResourceTypeEvaluatesCorrectlyWithResources($resource) |
|
1228 | + { |
|
1229 | + $constraint = Assert::isType('resource'); |
|
1230 | 1230 | |
1231 | - $this->assertTrue($constraint->evaluate($resource, '', true)); |
|
1231 | + $this->assertTrue($constraint->evaluate($resource, '', true)); |
|
1232 | 1232 | |
1233 | - @\fclose($resource); |
|
1234 | - } |
|
1233 | + @\fclose($resource); |
|
1234 | + } |
|
1235 | 1235 | |
1236 | - public function testConstraintIsNotType() |
|
1237 | - { |
|
1238 | - $constraint = Assert::logicalNot( |
|
1239 | - Assert::isType('string') |
|
1240 | - ); |
|
1236 | + public function testConstraintIsNotType() |
|
1237 | + { |
|
1238 | + $constraint = Assert::logicalNot( |
|
1239 | + Assert::isType('string') |
|
1240 | + ); |
|
1241 | 1241 | |
1242 | - $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1243 | - $this->assertFalse($constraint->evaluate('', '', true)); |
|
1244 | - $this->assertEquals('is not of type "string"', $constraint->toString()); |
|
1245 | - $this->assertCount(1, $constraint); |
|
1242 | + $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1243 | + $this->assertFalse($constraint->evaluate('', '', true)); |
|
1244 | + $this->assertEquals('is not of type "string"', $constraint->toString()); |
|
1245 | + $this->assertCount(1, $constraint); |
|
1246 | 1246 | |
1247 | - try { |
|
1248 | - $constraint->evaluate(''); |
|
1249 | - } catch (ExpectationFailedException $e) { |
|
1250 | - $this->assertEquals( |
|
1251 | - <<<EOF |
|
1247 | + try { |
|
1248 | + $constraint->evaluate(''); |
|
1249 | + } catch (ExpectationFailedException $e) { |
|
1250 | + $this->assertEquals( |
|
1251 | + <<<EOF |
|
1252 | 1252 | Failed asserting that '' is not of type "string". |
1253 | 1253 | |
1254 | 1254 | EOF |
1255 | - , |
|
1256 | - TestFailure::exceptionToString($e) |
|
1257 | - ); |
|
1255 | + , |
|
1256 | + TestFailure::exceptionToString($e) |
|
1257 | + ); |
|
1258 | 1258 | |
1259 | - return; |
|
1260 | - } |
|
1259 | + return; |
|
1260 | + } |
|
1261 | 1261 | |
1262 | - $this->fail(); |
|
1263 | - } |
|
1262 | + $this->fail(); |
|
1263 | + } |
|
1264 | 1264 | |
1265 | - public function testConstraintIsNotType2() |
|
1266 | - { |
|
1267 | - $constraint = Assert::logicalNot( |
|
1268 | - Assert::isType('string') |
|
1269 | - ); |
|
1265 | + public function testConstraintIsNotType2() |
|
1266 | + { |
|
1267 | + $constraint = Assert::logicalNot( |
|
1268 | + Assert::isType('string') |
|
1269 | + ); |
|
1270 | 1270 | |
1271 | - try { |
|
1272 | - $constraint->evaluate('', 'custom message'); |
|
1273 | - } catch (ExpectationFailedException $e) { |
|
1274 | - $this->assertEquals( |
|
1275 | - <<<EOF |
|
1271 | + try { |
|
1272 | + $constraint->evaluate('', 'custom message'); |
|
1273 | + } catch (ExpectationFailedException $e) { |
|
1274 | + $this->assertEquals( |
|
1275 | + <<<EOF |
|
1276 | 1276 | custom message |
1277 | 1277 | Failed asserting that '' is not of type "string". |
1278 | 1278 | |
1279 | 1279 | EOF |
1280 | - , |
|
1281 | - TestFailure::exceptionToString($e) |
|
1282 | - ); |
|
1280 | + , |
|
1281 | + TestFailure::exceptionToString($e) |
|
1282 | + ); |
|
1283 | 1283 | |
1284 | - return; |
|
1285 | - } |
|
1284 | + return; |
|
1285 | + } |
|
1286 | 1286 | |
1287 | - $this->fail(); |
|
1288 | - } |
|
1287 | + $this->fail(); |
|
1288 | + } |
|
1289 | 1289 | |
1290 | - public function testConstraintIsNull() |
|
1291 | - { |
|
1292 | - $constraint = Assert::isNull(); |
|
1290 | + public function testConstraintIsNull() |
|
1291 | + { |
|
1292 | + $constraint = Assert::isNull(); |
|
1293 | 1293 | |
1294 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1295 | - $this->assertTrue($constraint->evaluate(null, '', true)); |
|
1296 | - $this->assertEquals('is null', $constraint->toString()); |
|
1297 | - $this->assertCount(1, $constraint); |
|
1294 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1295 | + $this->assertTrue($constraint->evaluate(null, '', true)); |
|
1296 | + $this->assertEquals('is null', $constraint->toString()); |
|
1297 | + $this->assertCount(1, $constraint); |
|
1298 | 1298 | |
1299 | - try { |
|
1300 | - $constraint->evaluate(0); |
|
1301 | - } catch (ExpectationFailedException $e) { |
|
1302 | - $this->assertEquals( |
|
1303 | - <<<EOF |
|
1299 | + try { |
|
1300 | + $constraint->evaluate(0); |
|
1301 | + } catch (ExpectationFailedException $e) { |
|
1302 | + $this->assertEquals( |
|
1303 | + <<<EOF |
|
1304 | 1304 | Failed asserting that 0 is null. |
1305 | 1305 | |
1306 | 1306 | EOF |
1307 | - , |
|
1308 | - TestFailure::exceptionToString($e) |
|
1309 | - ); |
|
1307 | + , |
|
1308 | + TestFailure::exceptionToString($e) |
|
1309 | + ); |
|
1310 | 1310 | |
1311 | - return; |
|
1312 | - } |
|
1311 | + return; |
|
1312 | + } |
|
1313 | 1313 | |
1314 | - $this->fail(); |
|
1315 | - } |
|
1314 | + $this->fail(); |
|
1315 | + } |
|
1316 | 1316 | |
1317 | - public function testConstraintIsNull2() |
|
1318 | - { |
|
1319 | - $constraint = Assert::isNull(); |
|
1317 | + public function testConstraintIsNull2() |
|
1318 | + { |
|
1319 | + $constraint = Assert::isNull(); |
|
1320 | 1320 | |
1321 | - try { |
|
1322 | - $constraint->evaluate(0, 'custom message'); |
|
1323 | - } catch (ExpectationFailedException $e) { |
|
1324 | - $this->assertEquals( |
|
1325 | - <<<EOF |
|
1321 | + try { |
|
1322 | + $constraint->evaluate(0, 'custom message'); |
|
1323 | + } catch (ExpectationFailedException $e) { |
|
1324 | + $this->assertEquals( |
|
1325 | + <<<EOF |
|
1326 | 1326 | custom message |
1327 | 1327 | Failed asserting that 0 is null. |
1328 | 1328 | |
1329 | 1329 | EOF |
1330 | - , |
|
1331 | - TestFailure::exceptionToString($e) |
|
1332 | - ); |
|
1330 | + , |
|
1331 | + TestFailure::exceptionToString($e) |
|
1332 | + ); |
|
1333 | 1333 | |
1334 | - return; |
|
1335 | - } |
|
1334 | + return; |
|
1335 | + } |
|
1336 | 1336 | |
1337 | - $this->fail(); |
|
1338 | - } |
|
1337 | + $this->fail(); |
|
1338 | + } |
|
1339 | 1339 | |
1340 | - public function testConstraintIsNotNull() |
|
1341 | - { |
|
1342 | - $constraint = Assert::logicalNot( |
|
1343 | - Assert::isNull() |
|
1344 | - ); |
|
1340 | + public function testConstraintIsNotNull() |
|
1341 | + { |
|
1342 | + $constraint = Assert::logicalNot( |
|
1343 | + Assert::isNull() |
|
1344 | + ); |
|
1345 | 1345 | |
1346 | - $this->assertFalse($constraint->evaluate(null, '', true)); |
|
1347 | - $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1348 | - $this->assertEquals('is not null', $constraint->toString()); |
|
1349 | - $this->assertCount(1, $constraint); |
|
1346 | + $this->assertFalse($constraint->evaluate(null, '', true)); |
|
1347 | + $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1348 | + $this->assertEquals('is not null', $constraint->toString()); |
|
1349 | + $this->assertCount(1, $constraint); |
|
1350 | 1350 | |
1351 | - try { |
|
1352 | - $constraint->evaluate(null); |
|
1353 | - } catch (ExpectationFailedException $e) { |
|
1354 | - $this->assertEquals( |
|
1355 | - <<<EOF |
|
1351 | + try { |
|
1352 | + $constraint->evaluate(null); |
|
1353 | + } catch (ExpectationFailedException $e) { |
|
1354 | + $this->assertEquals( |
|
1355 | + <<<EOF |
|
1356 | 1356 | Failed asserting that null is not null. |
1357 | 1357 | |
1358 | 1358 | EOF |
1359 | - , |
|
1360 | - TestFailure::exceptionToString($e) |
|
1361 | - ); |
|
1359 | + , |
|
1360 | + TestFailure::exceptionToString($e) |
|
1361 | + ); |
|
1362 | 1362 | |
1363 | - return; |
|
1364 | - } |
|
1363 | + return; |
|
1364 | + } |
|
1365 | 1365 | |
1366 | - $this->fail(); |
|
1367 | - } |
|
1366 | + $this->fail(); |
|
1367 | + } |
|
1368 | 1368 | |
1369 | - public function testConstraintIsNotNull2() |
|
1370 | - { |
|
1371 | - $constraint = Assert::logicalNot( |
|
1372 | - Assert::isNull() |
|
1373 | - ); |
|
1369 | + public function testConstraintIsNotNull2() |
|
1370 | + { |
|
1371 | + $constraint = Assert::logicalNot( |
|
1372 | + Assert::isNull() |
|
1373 | + ); |
|
1374 | 1374 | |
1375 | - try { |
|
1376 | - $constraint->evaluate(null, 'custom message'); |
|
1377 | - } catch (ExpectationFailedException $e) { |
|
1378 | - $this->assertEquals( |
|
1379 | - <<<EOF |
|
1375 | + try { |
|
1376 | + $constraint->evaluate(null, 'custom message'); |
|
1377 | + } catch (ExpectationFailedException $e) { |
|
1378 | + $this->assertEquals( |
|
1379 | + <<<EOF |
|
1380 | 1380 | custom message |
1381 | 1381 | Failed asserting that null is not null. |
1382 | 1382 | |
1383 | 1383 | EOF |
1384 | - , |
|
1385 | - TestFailure::exceptionToString($e) |
|
1386 | - ); |
|
1384 | + , |
|
1385 | + TestFailure::exceptionToString($e) |
|
1386 | + ); |
|
1387 | 1387 | |
1388 | - return; |
|
1389 | - } |
|
1388 | + return; |
|
1389 | + } |
|
1390 | 1390 | |
1391 | - $this->fail(); |
|
1392 | - } |
|
1391 | + $this->fail(); |
|
1392 | + } |
|
1393 | 1393 | |
1394 | - public function testConstraintLessThan() |
|
1395 | - { |
|
1396 | - $constraint = Assert::lessThan(1); |
|
1394 | + public function testConstraintLessThan() |
|
1395 | + { |
|
1396 | + $constraint = Assert::lessThan(1); |
|
1397 | 1397 | |
1398 | - $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1399 | - $this->assertFalse($constraint->evaluate(1, '', true)); |
|
1400 | - $this->assertEquals('is less than 1', $constraint->toString()); |
|
1401 | - $this->assertCount(1, $constraint); |
|
1398 | + $this->assertTrue($constraint->evaluate(0, '', true)); |
|
1399 | + $this->assertFalse($constraint->evaluate(1, '', true)); |
|
1400 | + $this->assertEquals('is less than 1', $constraint->toString()); |
|
1401 | + $this->assertCount(1, $constraint); |
|
1402 | 1402 | |
1403 | - try { |
|
1404 | - $constraint->evaluate(1); |
|
1405 | - } catch (ExpectationFailedException $e) { |
|
1406 | - $this->assertEquals( |
|
1407 | - <<<EOF |
|
1403 | + try { |
|
1404 | + $constraint->evaluate(1); |
|
1405 | + } catch (ExpectationFailedException $e) { |
|
1406 | + $this->assertEquals( |
|
1407 | + <<<EOF |
|
1408 | 1408 | Failed asserting that 1 is less than 1. |
1409 | 1409 | |
1410 | 1410 | EOF |
1411 | - , |
|
1412 | - TestFailure::exceptionToString($e) |
|
1413 | - ); |
|
1411 | + , |
|
1412 | + TestFailure::exceptionToString($e) |
|
1413 | + ); |
|
1414 | 1414 | |
1415 | - return; |
|
1416 | - } |
|
1415 | + return; |
|
1416 | + } |
|
1417 | 1417 | |
1418 | - $this->fail(); |
|
1419 | - } |
|
1418 | + $this->fail(); |
|
1419 | + } |
|
1420 | 1420 | |
1421 | - public function testConstraintLessThan2() |
|
1422 | - { |
|
1423 | - $constraint = Assert::lessThan(1); |
|
1421 | + public function testConstraintLessThan2() |
|
1422 | + { |
|
1423 | + $constraint = Assert::lessThan(1); |
|
1424 | 1424 | |
1425 | - try { |
|
1426 | - $constraint->evaluate(1, 'custom message'); |
|
1427 | - } catch (ExpectationFailedException $e) { |
|
1428 | - $this->assertEquals( |
|
1429 | - <<<EOF |
|
1425 | + try { |
|
1426 | + $constraint->evaluate(1, 'custom message'); |
|
1427 | + } catch (ExpectationFailedException $e) { |
|
1428 | + $this->assertEquals( |
|
1429 | + <<<EOF |
|
1430 | 1430 | custom message |
1431 | 1431 | Failed asserting that 1 is less than 1. |
1432 | 1432 | |
1433 | 1433 | EOF |
1434 | - , |
|
1435 | - TestFailure::exceptionToString($e) |
|
1436 | - ); |
|
1434 | + , |
|
1435 | + TestFailure::exceptionToString($e) |
|
1436 | + ); |
|
1437 | 1437 | |
1438 | - return; |
|
1439 | - } |
|
1438 | + return; |
|
1439 | + } |
|
1440 | 1440 | |
1441 | - $this->fail(); |
|
1442 | - } |
|
1441 | + $this->fail(); |
|
1442 | + } |
|
1443 | 1443 | |
1444 | - public function testConstraintNotLessThan() |
|
1445 | - { |
|
1446 | - $constraint = Assert::logicalNot( |
|
1447 | - Assert::lessThan(1) |
|
1448 | - ); |
|
1444 | + public function testConstraintNotLessThan() |
|
1445 | + { |
|
1446 | + $constraint = Assert::logicalNot( |
|
1447 | + Assert::lessThan(1) |
|
1448 | + ); |
|
1449 | 1449 | |
1450 | - $this->assertTrue($constraint->evaluate(1, '', true)); |
|
1451 | - $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1452 | - $this->assertEquals('is not less than 1', $constraint->toString()); |
|
1453 | - $this->assertCount(1, $constraint); |
|
1450 | + $this->assertTrue($constraint->evaluate(1, '', true)); |
|
1451 | + $this->assertFalse($constraint->evaluate(0, '', true)); |
|
1452 | + $this->assertEquals('is not less than 1', $constraint->toString()); |
|
1453 | + $this->assertCount(1, $constraint); |
|
1454 | 1454 | |
1455 | - try { |
|
1456 | - $constraint->evaluate(0); |
|
1457 | - } catch (ExpectationFailedException $e) { |
|
1458 | - $this->assertEquals( |
|
1459 | - <<<EOF |
|
1455 | + try { |
|
1456 | + $constraint->evaluate(0); |
|
1457 | + } catch (ExpectationFailedException $e) { |
|
1458 | + $this->assertEquals( |
|
1459 | + <<<EOF |
|
1460 | 1460 | Failed asserting that 0 is not less than 1. |
1461 | 1461 | |
1462 | 1462 | EOF |
1463 | - , |
|
1464 | - TestFailure::exceptionToString($e) |
|
1465 | - ); |
|
1463 | + , |
|
1464 | + TestFailure::exceptionToString($e) |
|
1465 | + ); |
|
1466 | 1466 | |
1467 | - return; |
|
1468 | - } |
|
1467 | + return; |
|
1468 | + } |
|
1469 | 1469 | |
1470 | - $this->fail(); |
|
1471 | - } |
|
1470 | + $this->fail(); |
|
1471 | + } |
|
1472 | 1472 | |
1473 | - public function testConstraintNotLessThan2() |
|
1474 | - { |
|
1475 | - $constraint = Assert::logicalNot( |
|
1476 | - Assert::lessThan(1) |
|
1477 | - ); |
|
1473 | + public function testConstraintNotLessThan2() |
|
1474 | + { |
|
1475 | + $constraint = Assert::logicalNot( |
|
1476 | + Assert::lessThan(1) |
|
1477 | + ); |
|
1478 | 1478 | |
1479 | - try { |
|
1480 | - $constraint->evaluate(0, 'custom message'); |
|
1481 | - } catch (ExpectationFailedException $e) { |
|
1482 | - $this->assertEquals( |
|
1483 | - <<<EOF |
|
1479 | + try { |
|
1480 | + $constraint->evaluate(0, 'custom message'); |
|
1481 | + } catch (ExpectationFailedException $e) { |
|
1482 | + $this->assertEquals( |
|
1483 | + <<<EOF |
|
1484 | 1484 | custom message |
1485 | 1485 | Failed asserting that 0 is not less than 1. |
1486 | 1486 | |
1487 | 1487 | EOF |
1488 | - , |
|
1489 | - TestFailure::exceptionToString($e) |
|
1490 | - ); |
|
1488 | + , |
|
1489 | + TestFailure::exceptionToString($e) |
|
1490 | + ); |
|
1491 | 1491 | |
1492 | - return; |
|
1493 | - } |
|
1492 | + return; |
|
1493 | + } |
|
1494 | 1494 | |
1495 | - $this->fail(); |
|
1496 | - } |
|
1495 | + $this->fail(); |
|
1496 | + } |
|
1497 | 1497 | |
1498 | - public function testConstraintLessThanOrEqual() |
|
1499 | - { |
|
1500 | - $constraint = Assert::lessThanOrEqual(1); |
|
1498 | + public function testConstraintLessThanOrEqual() |
|
1499 | + { |
|
1500 | + $constraint = Assert::lessThanOrEqual(1); |
|
1501 | 1501 | |
1502 | - $this->assertTrue($constraint->evaluate(1, '', true)); |
|
1503 | - $this->assertFalse($constraint->evaluate(2, '', true)); |
|
1504 | - $this->assertEquals('is equal to 1 or is less than 1', $constraint->toString()); |
|
1505 | - $this->assertCount(2, $constraint); |
|
1502 | + $this->assertTrue($constraint->evaluate(1, '', true)); |
|
1503 | + $this->assertFalse($constraint->evaluate(2, '', true)); |
|
1504 | + $this->assertEquals('is equal to 1 or is less than 1', $constraint->toString()); |
|
1505 | + $this->assertCount(2, $constraint); |
|
1506 | 1506 | |
1507 | - try { |
|
1508 | - $constraint->evaluate(2); |
|
1509 | - } catch (ExpectationFailedException $e) { |
|
1510 | - $this->assertEquals( |
|
1511 | - <<<EOF |
|
1507 | + try { |
|
1508 | + $constraint->evaluate(2); |
|
1509 | + } catch (ExpectationFailedException $e) { |
|
1510 | + $this->assertEquals( |
|
1511 | + <<<EOF |
|
1512 | 1512 | Failed asserting that 2 is equal to 1 or is less than 1. |
1513 | 1513 | |
1514 | 1514 | EOF |
1515 | - , |
|
1516 | - TestFailure::exceptionToString($e) |
|
1517 | - ); |
|
1515 | + , |
|
1516 | + TestFailure::exceptionToString($e) |
|
1517 | + ); |
|
1518 | 1518 | |
1519 | - return; |
|
1520 | - } |
|
1519 | + return; |
|
1520 | + } |
|
1521 | 1521 | |
1522 | - $this->fail(); |
|
1523 | - } |
|
1522 | + $this->fail(); |
|
1523 | + } |
|
1524 | 1524 | |
1525 | - public function testConstraintCallback() |
|
1526 | - { |
|
1527 | - $closureReflect = function ($parameter) { |
|
1528 | - return $parameter; |
|
1529 | - }; |
|
1525 | + public function testConstraintCallback() |
|
1526 | + { |
|
1527 | + $closureReflect = function ($parameter) { |
|
1528 | + return $parameter; |
|
1529 | + }; |
|
1530 | 1530 | |
1531 | - $closureWithoutParameter = function () { |
|
1532 | - return true; |
|
1533 | - }; |
|
1531 | + $closureWithoutParameter = function () { |
|
1532 | + return true; |
|
1533 | + }; |
|
1534 | 1534 | |
1535 | - $constraint = Assert::callback($closureWithoutParameter); |
|
1536 | - $this->assertTrue($constraint->evaluate('', '', true)); |
|
1535 | + $constraint = Assert::callback($closureWithoutParameter); |
|
1536 | + $this->assertTrue($constraint->evaluate('', '', true)); |
|
1537 | 1537 | |
1538 | - $constraint = Assert::callback($closureReflect); |
|
1539 | - $this->assertTrue($constraint->evaluate(true, '', true)); |
|
1540 | - $this->assertFalse($constraint->evaluate(false, '', true)); |
|
1538 | + $constraint = Assert::callback($closureReflect); |
|
1539 | + $this->assertTrue($constraint->evaluate(true, '', true)); |
|
1540 | + $this->assertFalse($constraint->evaluate(false, '', true)); |
|
1541 | 1541 | |
1542 | - $callback = [$this, 'callbackReturningTrue']; |
|
1543 | - $constraint = Assert::callback($callback); |
|
1544 | - $this->assertTrue($constraint->evaluate(false, '', true)); |
|
1542 | + $callback = [$this, 'callbackReturningTrue']; |
|
1543 | + $constraint = Assert::callback($callback); |
|
1544 | + $this->assertTrue($constraint->evaluate(false, '', true)); |
|
1545 | 1545 | |
1546 | - $callback = [self::class, 'staticCallbackReturningTrue']; |
|
1547 | - $constraint = Assert::callback($callback); |
|
1548 | - $this->assertTrue($constraint->evaluate(null, '', true)); |
|
1546 | + $callback = [self::class, 'staticCallbackReturningTrue']; |
|
1547 | + $constraint = Assert::callback($callback); |
|
1548 | + $this->assertTrue($constraint->evaluate(null, '', true)); |
|
1549 | 1549 | |
1550 | - $this->assertEquals('is accepted by specified callback', $constraint->toString()); |
|
1551 | - } |
|
1550 | + $this->assertEquals('is accepted by specified callback', $constraint->toString()); |
|
1551 | + } |
|
1552 | 1552 | |
1553 | - public function testConstraintCallbackFailure() |
|
1554 | - { |
|
1555 | - $constraint = Assert::callback(function () { |
|
1556 | - return false; |
|
1557 | - }); |
|
1553 | + public function testConstraintCallbackFailure() |
|
1554 | + { |
|
1555 | + $constraint = Assert::callback(function () { |
|
1556 | + return false; |
|
1557 | + }); |
|
1558 | 1558 | |
1559 | - $this->expectException(ExpectationFailedException::class); |
|
1560 | - $this->expectExceptionMessage('Failed asserting that \'This fails\' is accepted by specified callback.'); |
|
1559 | + $this->expectException(ExpectationFailedException::class); |
|
1560 | + $this->expectExceptionMessage('Failed asserting that \'This fails\' is accepted by specified callback.'); |
|
1561 | 1561 | |
1562 | - $constraint->evaluate('This fails'); |
|
1563 | - } |
|
1562 | + $constraint->evaluate('This fails'); |
|
1563 | + } |
|
1564 | 1564 | |
1565 | - public function callbackReturningTrue() |
|
1566 | - { |
|
1567 | - return true; |
|
1568 | - } |
|
1565 | + public function callbackReturningTrue() |
|
1566 | + { |
|
1567 | + return true; |
|
1568 | + } |
|
1569 | 1569 | |
1570 | - public static function staticCallbackReturningTrue() |
|
1571 | - { |
|
1572 | - return true; |
|
1573 | - } |
|
1570 | + public static function staticCallbackReturningTrue() |
|
1571 | + { |
|
1572 | + return true; |
|
1573 | + } |
|
1574 | 1574 | |
1575 | - public function testConstraintLessThanOrEqual2() |
|
1576 | - { |
|
1577 | - $constraint = Assert::lessThanOrEqual(1); |
|
1575 | + public function testConstraintLessThanOrEqual2() |
|
1576 | + { |
|
1577 | + $constraint = Assert::lessThanOrEqual(1); |
|
1578 | 1578 | |
1579 | - try { |
|
1580 | - $constraint->evaluate(2, 'custom message'); |
|
1581 | - } catch (ExpectationFailedException $e) { |
|
1582 | - $this->assertEquals( |
|
1583 | - <<<EOF |
|
1579 | + try { |
|
1580 | + $constraint->evaluate(2, 'custom message'); |
|
1581 | + } catch (ExpectationFailedException $e) { |
|
1582 | + $this->assertEquals( |
|
1583 | + <<<EOF |
|
1584 | 1584 | custom message |
1585 | 1585 | Failed asserting that 2 is equal to 1 or is less than 1. |
1586 | 1586 | |
1587 | 1587 | EOF |
1588 | - , |
|
1589 | - TestFailure::exceptionToString($e) |
|
1590 | - ); |
|
1588 | + , |
|
1589 | + TestFailure::exceptionToString($e) |
|
1590 | + ); |
|
1591 | 1591 | |
1592 | - return; |
|
1593 | - } |
|
1592 | + return; |
|
1593 | + } |
|
1594 | 1594 | |
1595 | - $this->fail(); |
|
1596 | - } |
|
1595 | + $this->fail(); |
|
1596 | + } |
|
1597 | 1597 | |
1598 | - public function testConstraintNotLessThanOrEqual() |
|
1599 | - { |
|
1600 | - $constraint = Assert::logicalNot( |
|
1601 | - Assert::lessThanOrEqual(1) |
|
1602 | - ); |
|
1598 | + public function testConstraintNotLessThanOrEqual() |
|
1599 | + { |
|
1600 | + $constraint = Assert::logicalNot( |
|
1601 | + Assert::lessThanOrEqual(1) |
|
1602 | + ); |
|
1603 | 1603 | |
1604 | - $this->assertTrue($constraint->evaluate(2, '', true)); |
|
1605 | - $this->assertFalse($constraint->evaluate(1, '', true)); |
|
1606 | - $this->assertEquals('not( is equal to 1 or is less than 1 )', $constraint->toString()); |
|
1607 | - $this->assertCount(2, $constraint); |
|
1604 | + $this->assertTrue($constraint->evaluate(2, '', true)); |
|
1605 | + $this->assertFalse($constraint->evaluate(1, '', true)); |
|
1606 | + $this->assertEquals('not( is equal to 1 or is less than 1 )', $constraint->toString()); |
|
1607 | + $this->assertCount(2, $constraint); |
|
1608 | 1608 | |
1609 | - try { |
|
1610 | - $constraint->evaluate(1); |
|
1611 | - } catch (ExpectationFailedException $e) { |
|
1612 | - $this->assertEquals( |
|
1613 | - <<<EOF |
|
1609 | + try { |
|
1610 | + $constraint->evaluate(1); |
|
1611 | + } catch (ExpectationFailedException $e) { |
|
1612 | + $this->assertEquals( |
|
1613 | + <<<EOF |
|
1614 | 1614 | Failed asserting that not( 1 is equal to 1 or is less than 1 ). |
1615 | 1615 | |
1616 | 1616 | EOF |
1617 | - , |
|
1618 | - TestFailure::exceptionToString($e) |
|
1619 | - ); |
|
1617 | + , |
|
1618 | + TestFailure::exceptionToString($e) |
|
1619 | + ); |
|
1620 | 1620 | |
1621 | - return; |
|
1622 | - } |
|
1621 | + return; |
|
1622 | + } |
|
1623 | 1623 | |
1624 | - $this->fail(); |
|
1625 | - } |
|
1624 | + $this->fail(); |
|
1625 | + } |
|
1626 | 1626 | |
1627 | - public function testConstraintNotLessThanOrEqual2() |
|
1628 | - { |
|
1629 | - $constraint = Assert::logicalNot( |
|
1630 | - Assert::lessThanOrEqual(1) |
|
1631 | - ); |
|
1627 | + public function testConstraintNotLessThanOrEqual2() |
|
1628 | + { |
|
1629 | + $constraint = Assert::logicalNot( |
|
1630 | + Assert::lessThanOrEqual(1) |
|
1631 | + ); |
|
1632 | 1632 | |
1633 | - try { |
|
1634 | - $constraint->evaluate(1, 'custom message'); |
|
1635 | - } catch (ExpectationFailedException $e) { |
|
1636 | - $this->assertEquals( |
|
1637 | - <<<EOF |
|
1633 | + try { |
|
1634 | + $constraint->evaluate(1, 'custom message'); |
|
1635 | + } catch (ExpectationFailedException $e) { |
|
1636 | + $this->assertEquals( |
|
1637 | + <<<EOF |
|
1638 | 1638 | custom message |
1639 | 1639 | Failed asserting that not( 1 is equal to 1 or is less than 1 ). |
1640 | 1640 | |
1641 | 1641 | EOF |
1642 | - , |
|
1643 | - TestFailure::exceptionToString($e) |
|
1644 | - ); |
|
1642 | + , |
|
1643 | + TestFailure::exceptionToString($e) |
|
1644 | + ); |
|
1645 | 1645 | |
1646 | - return; |
|
1647 | - } |
|
1646 | + return; |
|
1647 | + } |
|
1648 | 1648 | |
1649 | - $this->fail(); |
|
1650 | - } |
|
1649 | + $this->fail(); |
|
1650 | + } |
|
1651 | 1651 | |
1652 | - public function testConstraintClassHasAttribute() |
|
1653 | - { |
|
1654 | - $constraint = Assert::classHasAttribute('privateAttribute'); |
|
1652 | + public function testConstraintClassHasAttribute() |
|
1653 | + { |
|
1654 | + $constraint = Assert::classHasAttribute('privateAttribute'); |
|
1655 | 1655 | |
1656 | - $this->assertTrue($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1657 | - $this->assertFalse($constraint->evaluate(\stdClass::class, '', true)); |
|
1658 | - $this->assertEquals('has attribute "privateAttribute"', $constraint->toString()); |
|
1659 | - $this->assertCount(1, $constraint); |
|
1656 | + $this->assertTrue($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1657 | + $this->assertFalse($constraint->evaluate(\stdClass::class, '', true)); |
|
1658 | + $this->assertEquals('has attribute "privateAttribute"', $constraint->toString()); |
|
1659 | + $this->assertCount(1, $constraint); |
|
1660 | 1660 | |
1661 | - try { |
|
1662 | - $constraint->evaluate(\stdClass::class); |
|
1663 | - } catch (ExpectationFailedException $e) { |
|
1664 | - $this->assertEquals( |
|
1665 | - <<<EOF |
|
1661 | + try { |
|
1662 | + $constraint->evaluate(\stdClass::class); |
|
1663 | + } catch (ExpectationFailedException $e) { |
|
1664 | + $this->assertEquals( |
|
1665 | + <<<EOF |
|
1666 | 1666 | Failed asserting that class "stdClass" has attribute "privateAttribute". |
1667 | 1667 | |
1668 | 1668 | EOF |
1669 | - , |
|
1670 | - TestFailure::exceptionToString($e) |
|
1671 | - ); |
|
1669 | + , |
|
1670 | + TestFailure::exceptionToString($e) |
|
1671 | + ); |
|
1672 | 1672 | |
1673 | - return; |
|
1674 | - } |
|
1673 | + return; |
|
1674 | + } |
|
1675 | 1675 | |
1676 | - $this->fail(); |
|
1677 | - } |
|
1676 | + $this->fail(); |
|
1677 | + } |
|
1678 | 1678 | |
1679 | - public function testConstraintClassHasAttribute2() |
|
1680 | - { |
|
1681 | - $constraint = Assert::classHasAttribute('privateAttribute'); |
|
1679 | + public function testConstraintClassHasAttribute2() |
|
1680 | + { |
|
1681 | + $constraint = Assert::classHasAttribute('privateAttribute'); |
|
1682 | 1682 | |
1683 | - try { |
|
1684 | - $constraint->evaluate(\stdClass::class, 'custom message'); |
|
1685 | - } catch (ExpectationFailedException $e) { |
|
1686 | - $this->assertEquals( |
|
1687 | - <<<EOF |
|
1683 | + try { |
|
1684 | + $constraint->evaluate(\stdClass::class, 'custom message'); |
|
1685 | + } catch (ExpectationFailedException $e) { |
|
1686 | + $this->assertEquals( |
|
1687 | + <<<EOF |
|
1688 | 1688 | custom message |
1689 | 1689 | Failed asserting that class "stdClass" has attribute "privateAttribute". |
1690 | 1690 | |
1691 | 1691 | EOF |
1692 | - , |
|
1693 | - TestFailure::exceptionToString($e) |
|
1694 | - ); |
|
1692 | + , |
|
1693 | + TestFailure::exceptionToString($e) |
|
1694 | + ); |
|
1695 | 1695 | |
1696 | - return; |
|
1697 | - } |
|
1696 | + return; |
|
1697 | + } |
|
1698 | 1698 | |
1699 | - $this->fail(); |
|
1700 | - } |
|
1699 | + $this->fail(); |
|
1700 | + } |
|
1701 | 1701 | |
1702 | - public function testConstraintClassNotHasAttribute() |
|
1703 | - { |
|
1704 | - $constraint = Assert::logicalNot( |
|
1705 | - Assert::classHasAttribute('privateAttribute') |
|
1706 | - ); |
|
1702 | + public function testConstraintClassNotHasAttribute() |
|
1703 | + { |
|
1704 | + $constraint = Assert::logicalNot( |
|
1705 | + Assert::classHasAttribute('privateAttribute') |
|
1706 | + ); |
|
1707 | 1707 | |
1708 | - $this->assertTrue($constraint->evaluate(\stdClass::class, '', true)); |
|
1709 | - $this->assertFalse($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1710 | - $this->assertEquals('does not have attribute "privateAttribute"', $constraint->toString()); |
|
1711 | - $this->assertCount(1, $constraint); |
|
1708 | + $this->assertTrue($constraint->evaluate(\stdClass::class, '', true)); |
|
1709 | + $this->assertFalse($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1710 | + $this->assertEquals('does not have attribute "privateAttribute"', $constraint->toString()); |
|
1711 | + $this->assertCount(1, $constraint); |
|
1712 | 1712 | |
1713 | - try { |
|
1714 | - $constraint->evaluate(\ClassWithNonPublicAttributes::class); |
|
1715 | - } catch (ExpectationFailedException $e) { |
|
1716 | - $this->assertEquals( |
|
1717 | - <<<EOF |
|
1713 | + try { |
|
1714 | + $constraint->evaluate(\ClassWithNonPublicAttributes::class); |
|
1715 | + } catch (ExpectationFailedException $e) { |
|
1716 | + $this->assertEquals( |
|
1717 | + <<<EOF |
|
1718 | 1718 | Failed asserting that class "ClassWithNonPublicAttributes" does not have attribute "privateAttribute". |
1719 | 1719 | |
1720 | 1720 | EOF |
1721 | - , |
|
1722 | - TestFailure::exceptionToString($e) |
|
1723 | - ); |
|
1721 | + , |
|
1722 | + TestFailure::exceptionToString($e) |
|
1723 | + ); |
|
1724 | 1724 | |
1725 | - return; |
|
1726 | - } |
|
1725 | + return; |
|
1726 | + } |
|
1727 | 1727 | |
1728 | - $this->fail(); |
|
1729 | - } |
|
1728 | + $this->fail(); |
|
1729 | + } |
|
1730 | 1730 | |
1731 | - public function testConstraintClassNotHasAttribute2() |
|
1732 | - { |
|
1733 | - $constraint = Assert::logicalNot( |
|
1734 | - Assert::classHasAttribute('privateAttribute') |
|
1735 | - ); |
|
1731 | + public function testConstraintClassNotHasAttribute2() |
|
1732 | + { |
|
1733 | + $constraint = Assert::logicalNot( |
|
1734 | + Assert::classHasAttribute('privateAttribute') |
|
1735 | + ); |
|
1736 | 1736 | |
1737 | - try { |
|
1738 | - $constraint->evaluate(\ClassWithNonPublicAttributes::class, 'custom message'); |
|
1739 | - } catch (ExpectationFailedException $e) { |
|
1740 | - $this->assertEquals( |
|
1741 | - <<<EOF |
|
1737 | + try { |
|
1738 | + $constraint->evaluate(\ClassWithNonPublicAttributes::class, 'custom message'); |
|
1739 | + } catch (ExpectationFailedException $e) { |
|
1740 | + $this->assertEquals( |
|
1741 | + <<<EOF |
|
1742 | 1742 | custom message |
1743 | 1743 | Failed asserting that class "ClassWithNonPublicAttributes" does not have attribute "privateAttribute". |
1744 | 1744 | |
1745 | 1745 | EOF |
1746 | - , |
|
1747 | - TestFailure::exceptionToString($e) |
|
1748 | - ); |
|
1746 | + , |
|
1747 | + TestFailure::exceptionToString($e) |
|
1748 | + ); |
|
1749 | 1749 | |
1750 | - return; |
|
1751 | - } |
|
1750 | + return; |
|
1751 | + } |
|
1752 | 1752 | |
1753 | - $this->fail(); |
|
1754 | - } |
|
1753 | + $this->fail(); |
|
1754 | + } |
|
1755 | 1755 | |
1756 | - public function testConstraintClassHasStaticAttribute() |
|
1757 | - { |
|
1758 | - $constraint = Assert::classHasStaticAttribute('privateStaticAttribute'); |
|
1756 | + public function testConstraintClassHasStaticAttribute() |
|
1757 | + { |
|
1758 | + $constraint = Assert::classHasStaticAttribute('privateStaticAttribute'); |
|
1759 | 1759 | |
1760 | - $this->assertTrue($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1761 | - $this->assertFalse($constraint->evaluate(\stdClass::class, '', true)); |
|
1762 | - $this->assertEquals('has static attribute "privateStaticAttribute"', $constraint->toString()); |
|
1763 | - $this->assertCount(1, $constraint); |
|
1760 | + $this->assertTrue($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1761 | + $this->assertFalse($constraint->evaluate(\stdClass::class, '', true)); |
|
1762 | + $this->assertEquals('has static attribute "privateStaticAttribute"', $constraint->toString()); |
|
1763 | + $this->assertCount(1, $constraint); |
|
1764 | 1764 | |
1765 | - try { |
|
1766 | - $constraint->evaluate(\stdClass::class); |
|
1767 | - } catch (ExpectationFailedException $e) { |
|
1768 | - $this->assertEquals( |
|
1769 | - <<<EOF |
|
1765 | + try { |
|
1766 | + $constraint->evaluate(\stdClass::class); |
|
1767 | + } catch (ExpectationFailedException $e) { |
|
1768 | + $this->assertEquals( |
|
1769 | + <<<EOF |
|
1770 | 1770 | Failed asserting that class "stdClass" has static attribute "privateStaticAttribute". |
1771 | 1771 | |
1772 | 1772 | EOF |
1773 | - , |
|
1774 | - TestFailure::exceptionToString($e) |
|
1775 | - ); |
|
1773 | + , |
|
1774 | + TestFailure::exceptionToString($e) |
|
1775 | + ); |
|
1776 | 1776 | |
1777 | - return; |
|
1778 | - } |
|
1777 | + return; |
|
1778 | + } |
|
1779 | 1779 | |
1780 | - $this->fail(); |
|
1781 | - } |
|
1780 | + $this->fail(); |
|
1781 | + } |
|
1782 | 1782 | |
1783 | - public function testConstraintClassHasStaticAttribute2() |
|
1784 | - { |
|
1785 | - $constraint = Assert::classHasStaticAttribute('foo'); |
|
1783 | + public function testConstraintClassHasStaticAttribute2() |
|
1784 | + { |
|
1785 | + $constraint = Assert::classHasStaticAttribute('foo'); |
|
1786 | 1786 | |
1787 | - try { |
|
1788 | - $constraint->evaluate(\stdClass::class, 'custom message'); |
|
1789 | - } catch (ExpectationFailedException $e) { |
|
1790 | - $this->assertEquals( |
|
1791 | - <<<EOF |
|
1787 | + try { |
|
1788 | + $constraint->evaluate(\stdClass::class, 'custom message'); |
|
1789 | + } catch (ExpectationFailedException $e) { |
|
1790 | + $this->assertEquals( |
|
1791 | + <<<EOF |
|
1792 | 1792 | custom message |
1793 | 1793 | Failed asserting that class "stdClass" has static attribute "foo". |
1794 | 1794 | |
1795 | 1795 | EOF |
1796 | - , |
|
1797 | - TestFailure::exceptionToString($e) |
|
1798 | - ); |
|
1796 | + , |
|
1797 | + TestFailure::exceptionToString($e) |
|
1798 | + ); |
|
1799 | 1799 | |
1800 | - return; |
|
1801 | - } |
|
1800 | + return; |
|
1801 | + } |
|
1802 | 1802 | |
1803 | - $this->fail(); |
|
1804 | - } |
|
1803 | + $this->fail(); |
|
1804 | + } |
|
1805 | 1805 | |
1806 | - public function testConstraintClassNotHasStaticAttribute() |
|
1807 | - { |
|
1808 | - $constraint = Assert::logicalNot( |
|
1809 | - Assert::classHasStaticAttribute('privateStaticAttribute') |
|
1810 | - ); |
|
1806 | + public function testConstraintClassNotHasStaticAttribute() |
|
1807 | + { |
|
1808 | + $constraint = Assert::logicalNot( |
|
1809 | + Assert::classHasStaticAttribute('privateStaticAttribute') |
|
1810 | + ); |
|
1811 | 1811 | |
1812 | - $this->assertTrue($constraint->evaluate(\stdClass::class, '', true)); |
|
1813 | - $this->assertFalse($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1814 | - $this->assertEquals('does not have static attribute "privateStaticAttribute"', $constraint->toString()); |
|
1815 | - $this->assertCount(1, $constraint); |
|
1812 | + $this->assertTrue($constraint->evaluate(\stdClass::class, '', true)); |
|
1813 | + $this->assertFalse($constraint->evaluate(\ClassWithNonPublicAttributes::class, '', true)); |
|
1814 | + $this->assertEquals('does not have static attribute "privateStaticAttribute"', $constraint->toString()); |
|
1815 | + $this->assertCount(1, $constraint); |
|
1816 | 1816 | |
1817 | - try { |
|
1818 | - $constraint->evaluate(\ClassWithNonPublicAttributes::class); |
|
1819 | - } catch (ExpectationFailedException $e) { |
|
1820 | - $this->assertEquals( |
|
1821 | - <<<EOF |
|
1817 | + try { |
|
1818 | + $constraint->evaluate(\ClassWithNonPublicAttributes::class); |
|
1819 | + } catch (ExpectationFailedException $e) { |
|
1820 | + $this->assertEquals( |
|
1821 | + <<<EOF |
|
1822 | 1822 | Failed asserting that class "ClassWithNonPublicAttributes" does not have static attribute "privateStaticAttribute". |
1823 | 1823 | |
1824 | 1824 | EOF |
1825 | - , |
|
1826 | - TestFailure::exceptionToString($e) |
|
1827 | - ); |
|
1825 | + , |
|
1826 | + TestFailure::exceptionToString($e) |
|
1827 | + ); |
|
1828 | 1828 | |
1829 | - return; |
|
1830 | - } |
|
1829 | + return; |
|
1830 | + } |
|
1831 | 1831 | |
1832 | - $this->fail(); |
|
1833 | - } |
|
1832 | + $this->fail(); |
|
1833 | + } |
|
1834 | 1834 | |
1835 | - public function testConstraintClassNotHasStaticAttribute2() |
|
1836 | - { |
|
1837 | - $constraint = Assert::logicalNot( |
|
1838 | - Assert::classHasStaticAttribute('privateStaticAttribute') |
|
1839 | - ); |
|
1835 | + public function testConstraintClassNotHasStaticAttribute2() |
|
1836 | + { |
|
1837 | + $constraint = Assert::logicalNot( |
|
1838 | + Assert::classHasStaticAttribute('privateStaticAttribute') |
|
1839 | + ); |
|
1840 | 1840 | |
1841 | - try { |
|
1842 | - $constraint->evaluate(\ClassWithNonPublicAttributes::class, 'custom message'); |
|
1843 | - } catch (ExpectationFailedException $e) { |
|
1844 | - $this->assertEquals( |
|
1845 | - <<<EOF |
|
1841 | + try { |
|
1842 | + $constraint->evaluate(\ClassWithNonPublicAttributes::class, 'custom message'); |
|
1843 | + } catch (ExpectationFailedException $e) { |
|
1844 | + $this->assertEquals( |
|
1845 | + <<<EOF |
|
1846 | 1846 | custom message |
1847 | 1847 | Failed asserting that class "ClassWithNonPublicAttributes" does not have static attribute "privateStaticAttribute". |
1848 | 1848 | |
1849 | 1849 | EOF |
1850 | - , |
|
1851 | - TestFailure::exceptionToString($e) |
|
1852 | - ); |
|
1850 | + , |
|
1851 | + TestFailure::exceptionToString($e) |
|
1852 | + ); |
|
1853 | 1853 | |
1854 | - return; |
|
1855 | - } |
|
1854 | + return; |
|
1855 | + } |
|
1856 | 1856 | |
1857 | - $this->fail(); |
|
1858 | - } |
|
1857 | + $this->fail(); |
|
1858 | + } |
|
1859 | 1859 | |
1860 | - public function testConstraintObjectHasAttribute() |
|
1861 | - { |
|
1862 | - $constraint = Assert::objectHasAttribute('privateAttribute'); |
|
1860 | + public function testConstraintObjectHasAttribute() |
|
1861 | + { |
|
1862 | + $constraint = Assert::objectHasAttribute('privateAttribute'); |
|
1863 | 1863 | |
1864 | - $this->assertTrue($constraint->evaluate(new \ClassWithNonPublicAttributes, '', true)); |
|
1865 | - $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1866 | - $this->assertEquals('has attribute "privateAttribute"', $constraint->toString()); |
|
1867 | - $this->assertCount(1, $constraint); |
|
1864 | + $this->assertTrue($constraint->evaluate(new \ClassWithNonPublicAttributes, '', true)); |
|
1865 | + $this->assertFalse($constraint->evaluate(new \stdClass, '', true)); |
|
1866 | + $this->assertEquals('has attribute "privateAttribute"', $constraint->toString()); |
|
1867 | + $this->assertCount(1, $constraint); |
|
1868 | 1868 | |
1869 | - try { |
|
1870 | - $constraint->evaluate(new \stdClass); |
|
1871 | - } catch (ExpectationFailedException $e) { |
|
1872 | - $this->assertEquals( |
|
1873 | - <<<EOF |
|
1869 | + try { |
|
1870 | + $constraint->evaluate(new \stdClass); |
|
1871 | + } catch (ExpectationFailedException $e) { |
|
1872 | + $this->assertEquals( |
|
1873 | + <<<EOF |
|
1874 | 1874 | Failed asserting that object of class "stdClass" has attribute "privateAttribute". |
1875 | 1875 | |
1876 | 1876 | EOF |
1877 | - , |
|
1878 | - TestFailure::exceptionToString($e) |
|
1879 | - ); |
|
1877 | + , |
|
1878 | + TestFailure::exceptionToString($e) |
|
1879 | + ); |
|
1880 | 1880 | |
1881 | - return; |
|
1882 | - } |
|
1881 | + return; |
|
1882 | + } |
|
1883 | 1883 | |
1884 | - $this->fail(); |
|
1885 | - } |
|
1884 | + $this->fail(); |
|
1885 | + } |
|
1886 | 1886 | |
1887 | - public function testConstraintObjectHasAttribute2() |
|
1888 | - { |
|
1889 | - $constraint = Assert::objectHasAttribute('privateAttribute'); |
|
1887 | + public function testConstraintObjectHasAttribute2() |
|
1888 | + { |
|
1889 | + $constraint = Assert::objectHasAttribute('privateAttribute'); |
|
1890 | 1890 | |
1891 | - try { |
|
1892 | - $constraint->evaluate(new \stdClass, 'custom message'); |
|
1893 | - } catch (ExpectationFailedException $e) { |
|
1894 | - $this->assertEquals( |
|
1895 | - <<<EOF |
|
1891 | + try { |
|
1892 | + $constraint->evaluate(new \stdClass, 'custom message'); |
|
1893 | + } catch (ExpectationFailedException $e) { |
|
1894 | + $this->assertEquals( |
|
1895 | + <<<EOF |
|
1896 | 1896 | custom message |
1897 | 1897 | Failed asserting that object of class "stdClass" has attribute "privateAttribute". |
1898 | 1898 | |
1899 | 1899 | EOF |
1900 | - , |
|
1901 | - TestFailure::exceptionToString($e) |
|
1902 | - ); |
|
1900 | + , |
|
1901 | + TestFailure::exceptionToString($e) |
|
1902 | + ); |
|
1903 | 1903 | |
1904 | - return; |
|
1905 | - } |
|
1904 | + return; |
|
1905 | + } |
|
1906 | 1906 | |
1907 | - $this->fail(); |
|
1908 | - } |
|
1907 | + $this->fail(); |
|
1908 | + } |
|
1909 | 1909 | |
1910 | - public function testConstraintObjectNotHasAttribute() |
|
1911 | - { |
|
1912 | - $constraint = Assert::logicalNot( |
|
1913 | - Assert::objectHasAttribute('privateAttribute') |
|
1914 | - ); |
|
1910 | + public function testConstraintObjectNotHasAttribute() |
|
1911 | + { |
|
1912 | + $constraint = Assert::logicalNot( |
|
1913 | + Assert::objectHasAttribute('privateAttribute') |
|
1914 | + ); |
|
1915 | 1915 | |
1916 | - $this->assertTrue($constraint->evaluate(new \stdClass, '', true)); |
|
1917 | - $this->assertFalse($constraint->evaluate(new \ClassWithNonPublicAttributes, '', true)); |
|
1918 | - $this->assertEquals('does not have attribute "privateAttribute"', $constraint->toString()); |
|
1919 | - $this->assertCount(1, $constraint); |
|
1916 | + $this->assertTrue($constraint->evaluate(new \stdClass, '', true)); |
|
1917 | + $this->assertFalse($constraint->evaluate(new \ClassWithNonPublicAttributes, '', true)); |
|
1918 | + $this->assertEquals('does not have attribute "privateAttribute"', $constraint->toString()); |
|
1919 | + $this->assertCount(1, $constraint); |
|
1920 | 1920 | |
1921 | - try { |
|
1922 | - $constraint->evaluate(new \ClassWithNonPublicAttributes); |
|
1923 | - } catch (ExpectationFailedException $e) { |
|
1924 | - $this->assertEquals( |
|
1925 | - <<<EOF |
|
1921 | + try { |
|
1922 | + $constraint->evaluate(new \ClassWithNonPublicAttributes); |
|
1923 | + } catch (ExpectationFailedException $e) { |
|
1924 | + $this->assertEquals( |
|
1925 | + <<<EOF |
|
1926 | 1926 | Failed asserting that object of class "ClassWithNonPublicAttributes" does not have attribute "privateAttribute". |
1927 | 1927 | |
1928 | 1928 | EOF |
1929 | - , |
|
1930 | - TestFailure::exceptionToString($e) |
|
1931 | - ); |
|
1929 | + , |
|
1930 | + TestFailure::exceptionToString($e) |
|
1931 | + ); |
|
1932 | 1932 | |
1933 | - return; |
|
1934 | - } |
|
1933 | + return; |
|
1934 | + } |
|
1935 | 1935 | |
1936 | - $this->fail(); |
|
1937 | - } |
|
1936 | + $this->fail(); |
|
1937 | + } |
|
1938 | 1938 | |
1939 | - public function testConstraintObjectNotHasAttribute2() |
|
1940 | - { |
|
1941 | - $constraint = Assert::logicalNot( |
|
1942 | - Assert::objectHasAttribute('privateAttribute') |
|
1943 | - ); |
|
1939 | + public function testConstraintObjectNotHasAttribute2() |
|
1940 | + { |
|
1941 | + $constraint = Assert::logicalNot( |
|
1942 | + Assert::objectHasAttribute('privateAttribute') |
|
1943 | + ); |
|
1944 | 1944 | |
1945 | - try { |
|
1946 | - $constraint->evaluate(new \ClassWithNonPublicAttributes, 'custom message'); |
|
1947 | - } catch (ExpectationFailedException $e) { |
|
1948 | - $this->assertEquals( |
|
1949 | - <<<EOF |
|
1945 | + try { |
|
1946 | + $constraint->evaluate(new \ClassWithNonPublicAttributes, 'custom message'); |
|
1947 | + } catch (ExpectationFailedException $e) { |
|
1948 | + $this->assertEquals( |
|
1949 | + <<<EOF |
|
1950 | 1950 | custom message |
1951 | 1951 | Failed asserting that object of class "ClassWithNonPublicAttributes" does not have attribute "privateAttribute". |
1952 | 1952 | |
1953 | 1953 | EOF |
1954 | - , |
|
1955 | - TestFailure::exceptionToString($e) |
|
1956 | - ); |
|
1954 | + , |
|
1955 | + TestFailure::exceptionToString($e) |
|
1956 | + ); |
|
1957 | 1957 | |
1958 | - return; |
|
1959 | - } |
|
1958 | + return; |
|
1959 | + } |
|
1960 | 1960 | |
1961 | - $this->fail(); |
|
1962 | - } |
|
1961 | + $this->fail(); |
|
1962 | + } |
|
1963 | 1963 | |
1964 | - public function testConstraintRegularExpression() |
|
1965 | - { |
|
1966 | - $constraint = Assert::matchesRegularExpression('/foo/'); |
|
1964 | + public function testConstraintRegularExpression() |
|
1965 | + { |
|
1966 | + $constraint = Assert::matchesRegularExpression('/foo/'); |
|
1967 | 1967 | |
1968 | - $this->assertFalse($constraint->evaluate('barbazbar', '', true)); |
|
1969 | - $this->assertTrue($constraint->evaluate('barfoobar', '', true)); |
|
1970 | - $this->assertEquals('matches PCRE pattern "/foo/"', $constraint->toString()); |
|
1971 | - $this->assertCount(1, $constraint); |
|
1968 | + $this->assertFalse($constraint->evaluate('barbazbar', '', true)); |
|
1969 | + $this->assertTrue($constraint->evaluate('barfoobar', '', true)); |
|
1970 | + $this->assertEquals('matches PCRE pattern "/foo/"', $constraint->toString()); |
|
1971 | + $this->assertCount(1, $constraint); |
|
1972 | 1972 | |
1973 | - try { |
|
1974 | - $constraint->evaluate('barbazbar'); |
|
1975 | - } catch (ExpectationFailedException $e) { |
|
1976 | - $this->assertEquals( |
|
1977 | - <<<EOF |
|
1973 | + try { |
|
1974 | + $constraint->evaluate('barbazbar'); |
|
1975 | + } catch (ExpectationFailedException $e) { |
|
1976 | + $this->assertEquals( |
|
1977 | + <<<EOF |
|
1978 | 1978 | Failed asserting that 'barbazbar' matches PCRE pattern "/foo/". |
1979 | 1979 | |
1980 | 1980 | EOF |
1981 | - , |
|
1982 | - TestFailure::exceptionToString($e) |
|
1983 | - ); |
|
1981 | + , |
|
1982 | + TestFailure::exceptionToString($e) |
|
1983 | + ); |
|
1984 | 1984 | |
1985 | - return; |
|
1986 | - } |
|
1985 | + return; |
|
1986 | + } |
|
1987 | 1987 | |
1988 | - $this->fail(); |
|
1989 | - } |
|
1988 | + $this->fail(); |
|
1989 | + } |
|
1990 | 1990 | |
1991 | - public function testConstraintRegularExpression2() |
|
1992 | - { |
|
1993 | - $constraint = Assert::matchesRegularExpression('/foo/'); |
|
1991 | + public function testConstraintRegularExpression2() |
|
1992 | + { |
|
1993 | + $constraint = Assert::matchesRegularExpression('/foo/'); |
|
1994 | 1994 | |
1995 | - try { |
|
1996 | - $constraint->evaluate('barbazbar', 'custom message'); |
|
1997 | - } catch (ExpectationFailedException $e) { |
|
1998 | - $this->assertEquals( |
|
1999 | - <<<EOF |
|
1995 | + try { |
|
1996 | + $constraint->evaluate('barbazbar', 'custom message'); |
|
1997 | + } catch (ExpectationFailedException $e) { |
|
1998 | + $this->assertEquals( |
|
1999 | + <<<EOF |
|
2000 | 2000 | custom message |
2001 | 2001 | Failed asserting that 'barbazbar' matches PCRE pattern "/foo/". |
2002 | 2002 | |
2003 | 2003 | EOF |
2004 | - , |
|
2005 | - TestFailure::exceptionToString($e) |
|
2006 | - ); |
|
2004 | + , |
|
2005 | + TestFailure::exceptionToString($e) |
|
2006 | + ); |
|
2007 | 2007 | |
2008 | - return; |
|
2009 | - } |
|
2008 | + return; |
|
2009 | + } |
|
2010 | 2010 | |
2011 | - $this->fail(); |
|
2012 | - } |
|
2011 | + $this->fail(); |
|
2012 | + } |
|
2013 | 2013 | |
2014 | - public function testConstraintPCRENotMatch() |
|
2015 | - { |
|
2016 | - $constraint = Assert::logicalNot( |
|
2017 | - Assert::matchesRegularExpression('/foo/') |
|
2018 | - ); |
|
2014 | + public function testConstraintPCRENotMatch() |
|
2015 | + { |
|
2016 | + $constraint = Assert::logicalNot( |
|
2017 | + Assert::matchesRegularExpression('/foo/') |
|
2018 | + ); |
|
2019 | 2019 | |
2020 | - $this->assertTrue($constraint->evaluate('barbazbar', '', true)); |
|
2021 | - $this->assertFalse($constraint->evaluate('barfoobar', '', true)); |
|
2022 | - $this->assertEquals('does not match PCRE pattern "/foo/"', $constraint->toString()); |
|
2023 | - $this->assertCount(1, $constraint); |
|
2020 | + $this->assertTrue($constraint->evaluate('barbazbar', '', true)); |
|
2021 | + $this->assertFalse($constraint->evaluate('barfoobar', '', true)); |
|
2022 | + $this->assertEquals('does not match PCRE pattern "/foo/"', $constraint->toString()); |
|
2023 | + $this->assertCount(1, $constraint); |
|
2024 | 2024 | |
2025 | - try { |
|
2026 | - $constraint->evaluate('barfoobar'); |
|
2027 | - } catch (ExpectationFailedException $e) { |
|
2028 | - $this->assertEquals( |
|
2029 | - <<<EOF |
|
2025 | + try { |
|
2026 | + $constraint->evaluate('barfoobar'); |
|
2027 | + } catch (ExpectationFailedException $e) { |
|
2028 | + $this->assertEquals( |
|
2029 | + <<<EOF |
|
2030 | 2030 | Failed asserting that 'barfoobar' does not match PCRE pattern "/foo/". |
2031 | 2031 | |
2032 | 2032 | EOF |
2033 | - , |
|
2034 | - TestFailure::exceptionToString($e) |
|
2035 | - ); |
|
2033 | + , |
|
2034 | + TestFailure::exceptionToString($e) |
|
2035 | + ); |
|
2036 | 2036 | |
2037 | - return; |
|
2038 | - } |
|
2037 | + return; |
|
2038 | + } |
|
2039 | 2039 | |
2040 | - $this->fail(); |
|
2041 | - } |
|
2040 | + $this->fail(); |
|
2041 | + } |
|
2042 | 2042 | |
2043 | - public function testConstraintPCRENotMatch2() |
|
2044 | - { |
|
2045 | - $constraint = Assert::logicalNot( |
|
2046 | - Assert::matchesRegularExpression('/foo/') |
|
2047 | - ); |
|
2043 | + public function testConstraintPCRENotMatch2() |
|
2044 | + { |
|
2045 | + $constraint = Assert::logicalNot( |
|
2046 | + Assert::matchesRegularExpression('/foo/') |
|
2047 | + ); |
|
2048 | 2048 | |
2049 | - try { |
|
2050 | - $constraint->evaluate('barfoobar', 'custom message'); |
|
2051 | - } catch (ExpectationFailedException $e) { |
|
2052 | - $this->assertEquals( |
|
2053 | - <<<EOF |
|
2049 | + try { |
|
2050 | + $constraint->evaluate('barfoobar', 'custom message'); |
|
2051 | + } catch (ExpectationFailedException $e) { |
|
2052 | + $this->assertEquals( |
|
2053 | + <<<EOF |
|
2054 | 2054 | custom message |
2055 | 2055 | Failed asserting that 'barfoobar' does not match PCRE pattern "/foo/". |
2056 | 2056 | |
2057 | 2057 | EOF |
2058 | - , |
|
2059 | - TestFailure::exceptionToString($e) |
|
2060 | - ); |
|
2061 | - |
|
2062 | - return; |
|
2063 | - } |
|
2064 | - |
|
2065 | - $this->fail(); |
|
2066 | - } |
|
2067 | - |
|
2068 | - public function testConstraintStringMatches() |
|
2069 | - { |
|
2070 | - $constraint = Assert::matches('*%c*'); |
|
2071 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2072 | - $this->assertTrue($constraint->evaluate('***', '', true)); |
|
2073 | - $this->assertEquals('matches PCRE pattern "/^\*.\*$/s"', $constraint->toString()); |
|
2074 | - $this->assertCount(1, $constraint); |
|
2075 | - } |
|
2076 | - |
|
2077 | - public function testConstraintStringMatches2() |
|
2078 | - { |
|
2079 | - $constraint = Assert::matches('*%s*'); |
|
2080 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2081 | - $this->assertTrue($constraint->evaluate('***', '', true)); |
|
2082 | - $this->assertEquals('matches PCRE pattern "/^\*[^\r\n]+\*$/s"', $constraint->toString()); |
|
2083 | - $this->assertCount(1, $constraint); |
|
2084 | - } |
|
2085 | - |
|
2086 | - public function testConstraintStringMatches3() |
|
2087 | - { |
|
2088 | - $constraint = Assert::matches('*%i*'); |
|
2089 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2090 | - $this->assertTrue($constraint->evaluate('*0*', '', true)); |
|
2091 | - $this->assertEquals('matches PCRE pattern "/^\*[+-]?\d+\*$/s"', $constraint->toString()); |
|
2092 | - $this->assertCount(1, $constraint); |
|
2093 | - } |
|
2094 | - |
|
2095 | - public function testConstraintStringMatches4() |
|
2096 | - { |
|
2097 | - $constraint = Assert::matches('*%d*'); |
|
2098 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2099 | - $this->assertTrue($constraint->evaluate('*0*', '', true)); |
|
2100 | - $this->assertEquals('matches PCRE pattern "/^\*\d+\*$/s"', $constraint->toString()); |
|
2101 | - $this->assertCount(1, $constraint); |
|
2102 | - } |
|
2103 | - |
|
2104 | - public function testConstraintStringMatches5() |
|
2105 | - { |
|
2106 | - $constraint = Assert::matches('*%x*'); |
|
2107 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2108 | - $this->assertTrue($constraint->evaluate('*0f0f0f*', '', true)); |
|
2109 | - $this->assertEquals('matches PCRE pattern "/^\*[0-9a-fA-F]+\*$/s"', $constraint->toString()); |
|
2110 | - $this->assertCount(1, $constraint); |
|
2111 | - } |
|
2112 | - |
|
2113 | - public function testConstraintStringMatches6() |
|
2114 | - { |
|
2115 | - $constraint = Assert::matches('*%f*'); |
|
2116 | - $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2117 | - $this->assertTrue($constraint->evaluate('*1.0*', '', true)); |
|
2118 | - $this->assertEquals('matches PCRE pattern "/^\*[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?\*$/s"', $constraint->toString()); |
|
2119 | - $this->assertCount(1, $constraint); |
|
2120 | - } |
|
2121 | - |
|
2122 | - public function testConstraintStringStartsWith() |
|
2123 | - { |
|
2124 | - $constraint = Assert::stringStartsWith('prefix'); |
|
2125 | - |
|
2126 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
2127 | - $this->assertTrue($constraint->evaluate('prefixfoo', '', true)); |
|
2128 | - $this->assertEquals('starts with "prefix"', $constraint->toString()); |
|
2129 | - $this->assertCount(1, $constraint); |
|
2130 | - |
|
2131 | - try { |
|
2132 | - $constraint->evaluate('foo'); |
|
2133 | - } catch (ExpectationFailedException $e) { |
|
2134 | - $this->assertEquals( |
|
2135 | - <<<EOF |
|
2058 | + , |
|
2059 | + TestFailure::exceptionToString($e) |
|
2060 | + ); |
|
2061 | + |
|
2062 | + return; |
|
2063 | + } |
|
2064 | + |
|
2065 | + $this->fail(); |
|
2066 | + } |
|
2067 | + |
|
2068 | + public function testConstraintStringMatches() |
|
2069 | + { |
|
2070 | + $constraint = Assert::matches('*%c*'); |
|
2071 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2072 | + $this->assertTrue($constraint->evaluate('***', '', true)); |
|
2073 | + $this->assertEquals('matches PCRE pattern "/^\*.\*$/s"', $constraint->toString()); |
|
2074 | + $this->assertCount(1, $constraint); |
|
2075 | + } |
|
2076 | + |
|
2077 | + public function testConstraintStringMatches2() |
|
2078 | + { |
|
2079 | + $constraint = Assert::matches('*%s*'); |
|
2080 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2081 | + $this->assertTrue($constraint->evaluate('***', '', true)); |
|
2082 | + $this->assertEquals('matches PCRE pattern "/^\*[^\r\n]+\*$/s"', $constraint->toString()); |
|
2083 | + $this->assertCount(1, $constraint); |
|
2084 | + } |
|
2085 | + |
|
2086 | + public function testConstraintStringMatches3() |
|
2087 | + { |
|
2088 | + $constraint = Assert::matches('*%i*'); |
|
2089 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2090 | + $this->assertTrue($constraint->evaluate('*0*', '', true)); |
|
2091 | + $this->assertEquals('matches PCRE pattern "/^\*[+-]?\d+\*$/s"', $constraint->toString()); |
|
2092 | + $this->assertCount(1, $constraint); |
|
2093 | + } |
|
2094 | + |
|
2095 | + public function testConstraintStringMatches4() |
|
2096 | + { |
|
2097 | + $constraint = Assert::matches('*%d*'); |
|
2098 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2099 | + $this->assertTrue($constraint->evaluate('*0*', '', true)); |
|
2100 | + $this->assertEquals('matches PCRE pattern "/^\*\d+\*$/s"', $constraint->toString()); |
|
2101 | + $this->assertCount(1, $constraint); |
|
2102 | + } |
|
2103 | + |
|
2104 | + public function testConstraintStringMatches5() |
|
2105 | + { |
|
2106 | + $constraint = Assert::matches('*%x*'); |
|
2107 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2108 | + $this->assertTrue($constraint->evaluate('*0f0f0f*', '', true)); |
|
2109 | + $this->assertEquals('matches PCRE pattern "/^\*[0-9a-fA-F]+\*$/s"', $constraint->toString()); |
|
2110 | + $this->assertCount(1, $constraint); |
|
2111 | + } |
|
2112 | + |
|
2113 | + public function testConstraintStringMatches6() |
|
2114 | + { |
|
2115 | + $constraint = Assert::matches('*%f*'); |
|
2116 | + $this->assertFalse($constraint->evaluate('**', '', true)); |
|
2117 | + $this->assertTrue($constraint->evaluate('*1.0*', '', true)); |
|
2118 | + $this->assertEquals('matches PCRE pattern "/^\*[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?\*$/s"', $constraint->toString()); |
|
2119 | + $this->assertCount(1, $constraint); |
|
2120 | + } |
|
2121 | + |
|
2122 | + public function testConstraintStringStartsWith() |
|
2123 | + { |
|
2124 | + $constraint = Assert::stringStartsWith('prefix'); |
|
2125 | + |
|
2126 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
2127 | + $this->assertTrue($constraint->evaluate('prefixfoo', '', true)); |
|
2128 | + $this->assertEquals('starts with "prefix"', $constraint->toString()); |
|
2129 | + $this->assertCount(1, $constraint); |
|
2130 | + |
|
2131 | + try { |
|
2132 | + $constraint->evaluate('foo'); |
|
2133 | + } catch (ExpectationFailedException $e) { |
|
2134 | + $this->assertEquals( |
|
2135 | + <<<EOF |
|
2136 | 2136 | Failed asserting that 'foo' starts with "prefix". |
2137 | 2137 | |
2138 | 2138 | EOF |
2139 | - , |
|
2140 | - TestFailure::exceptionToString($e) |
|
2141 | - ); |
|
2139 | + , |
|
2140 | + TestFailure::exceptionToString($e) |
|
2141 | + ); |
|
2142 | 2142 | |
2143 | - return; |
|
2144 | - } |
|
2143 | + return; |
|
2144 | + } |
|
2145 | 2145 | |
2146 | - $this->fail(); |
|
2147 | - } |
|
2146 | + $this->fail(); |
|
2147 | + } |
|
2148 | 2148 | |
2149 | - public function testConstraintStringStartsWith2() |
|
2150 | - { |
|
2151 | - $constraint = Assert::stringStartsWith('prefix'); |
|
2149 | + public function testConstraintStringStartsWith2() |
|
2150 | + { |
|
2151 | + $constraint = Assert::stringStartsWith('prefix'); |
|
2152 | 2152 | |
2153 | - try { |
|
2154 | - $constraint->evaluate('foo', 'custom message'); |
|
2155 | - } catch (ExpectationFailedException $e) { |
|
2156 | - $this->assertEquals( |
|
2157 | - <<<EOF |
|
2153 | + try { |
|
2154 | + $constraint->evaluate('foo', 'custom message'); |
|
2155 | + } catch (ExpectationFailedException $e) { |
|
2156 | + $this->assertEquals( |
|
2157 | + <<<EOF |
|
2158 | 2158 | custom message\nFailed asserting that 'foo' starts with "prefix". |
2159 | 2159 | |
2160 | 2160 | EOF |
2161 | - , |
|
2162 | - TestFailure::exceptionToString($e) |
|
2163 | - ); |
|
2161 | + , |
|
2162 | + TestFailure::exceptionToString($e) |
|
2163 | + ); |
|
2164 | 2164 | |
2165 | - return; |
|
2166 | - } |
|
2165 | + return; |
|
2166 | + } |
|
2167 | 2167 | |
2168 | - $this->fail(); |
|
2169 | - } |
|
2168 | + $this->fail(); |
|
2169 | + } |
|
2170 | 2170 | |
2171 | - public function testConstraintStringStartsNotWith() |
|
2172 | - { |
|
2173 | - $constraint = Assert::logicalNot( |
|
2174 | - Assert::stringStartsWith('prefix') |
|
2175 | - ); |
|
2171 | + public function testConstraintStringStartsNotWith() |
|
2172 | + { |
|
2173 | + $constraint = Assert::logicalNot( |
|
2174 | + Assert::stringStartsWith('prefix') |
|
2175 | + ); |
|
2176 | 2176 | |
2177 | - $this->assertTrue($constraint->evaluate('foo', '', true)); |
|
2178 | - $this->assertFalse($constraint->evaluate('prefixfoo', '', true)); |
|
2179 | - $this->assertEquals('starts not with "prefix"', $constraint->toString()); |
|
2180 | - $this->assertCount(1, $constraint); |
|
2177 | + $this->assertTrue($constraint->evaluate('foo', '', true)); |
|
2178 | + $this->assertFalse($constraint->evaluate('prefixfoo', '', true)); |
|
2179 | + $this->assertEquals('starts not with "prefix"', $constraint->toString()); |
|
2180 | + $this->assertCount(1, $constraint); |
|
2181 | 2181 | |
2182 | - try { |
|
2183 | - $constraint->evaluate('prefixfoo'); |
|
2184 | - } catch (ExpectationFailedException $e) { |
|
2185 | - $this->assertEquals( |
|
2186 | - <<<EOF |
|
2182 | + try { |
|
2183 | + $constraint->evaluate('prefixfoo'); |
|
2184 | + } catch (ExpectationFailedException $e) { |
|
2185 | + $this->assertEquals( |
|
2186 | + <<<EOF |
|
2187 | 2187 | Failed asserting that 'prefixfoo' starts not with "prefix". |
2188 | 2188 | |
2189 | 2189 | EOF |
2190 | - , |
|
2191 | - TestFailure::exceptionToString($e) |
|
2192 | - ); |
|
2190 | + , |
|
2191 | + TestFailure::exceptionToString($e) |
|
2192 | + ); |
|
2193 | 2193 | |
2194 | - return; |
|
2195 | - } |
|
2194 | + return; |
|
2195 | + } |
|
2196 | 2196 | |
2197 | - $this->fail(); |
|
2198 | - } |
|
2197 | + $this->fail(); |
|
2198 | + } |
|
2199 | 2199 | |
2200 | - public function testConstraintStringStartsNotWith2() |
|
2201 | - { |
|
2202 | - $constraint = Assert::logicalNot( |
|
2203 | - Assert::stringStartsWith('prefix') |
|
2204 | - ); |
|
2200 | + public function testConstraintStringStartsNotWith2() |
|
2201 | + { |
|
2202 | + $constraint = Assert::logicalNot( |
|
2203 | + Assert::stringStartsWith('prefix') |
|
2204 | + ); |
|
2205 | 2205 | |
2206 | - try { |
|
2207 | - $constraint->evaluate('prefixfoo', 'custom message'); |
|
2208 | - } catch (ExpectationFailedException $e) { |
|
2209 | - $this->assertEquals( |
|
2210 | - <<<EOF |
|
2206 | + try { |
|
2207 | + $constraint->evaluate('prefixfoo', 'custom message'); |
|
2208 | + } catch (ExpectationFailedException $e) { |
|
2209 | + $this->assertEquals( |
|
2210 | + <<<EOF |
|
2211 | 2211 | custom message |
2212 | 2212 | Failed asserting that 'prefixfoo' starts not with "prefix". |
2213 | 2213 | |
2214 | 2214 | EOF |
2215 | - , |
|
2216 | - TestFailure::exceptionToString($e) |
|
2217 | - ); |
|
2215 | + , |
|
2216 | + TestFailure::exceptionToString($e) |
|
2217 | + ); |
|
2218 | 2218 | |
2219 | - return; |
|
2220 | - } |
|
2219 | + return; |
|
2220 | + } |
|
2221 | 2221 | |
2222 | - $this->fail(); |
|
2223 | - } |
|
2222 | + $this->fail(); |
|
2223 | + } |
|
2224 | 2224 | |
2225 | - public function testConstraintStringContains() |
|
2226 | - { |
|
2227 | - $constraint = Assert::stringContains('foo'); |
|
2225 | + public function testConstraintStringContains() |
|
2226 | + { |
|
2227 | + $constraint = Assert::stringContains('foo'); |
|
2228 | 2228 | |
2229 | - $this->assertFalse($constraint->evaluate('barbazbar', '', true)); |
|
2230 | - $this->assertTrue($constraint->evaluate('barfoobar', '', true)); |
|
2231 | - $this->assertEquals('contains "foo"', $constraint->toString()); |
|
2232 | - $this->assertCount(1, $constraint); |
|
2229 | + $this->assertFalse($constraint->evaluate('barbazbar', '', true)); |
|
2230 | + $this->assertTrue($constraint->evaluate('barfoobar', '', true)); |
|
2231 | + $this->assertEquals('contains "foo"', $constraint->toString()); |
|
2232 | + $this->assertCount(1, $constraint); |
|
2233 | 2233 | |
2234 | - try { |
|
2235 | - $constraint->evaluate('barbazbar'); |
|
2236 | - } catch (ExpectationFailedException $e) { |
|
2237 | - $this->assertEquals( |
|
2238 | - <<<EOF |
|
2234 | + try { |
|
2235 | + $constraint->evaluate('barbazbar'); |
|
2236 | + } catch (ExpectationFailedException $e) { |
|
2237 | + $this->assertEquals( |
|
2238 | + <<<EOF |
|
2239 | 2239 | Failed asserting that 'barbazbar' contains "foo". |
2240 | 2240 | |
2241 | 2241 | EOF |
2242 | - , |
|
2243 | - TestFailure::exceptionToString($e) |
|
2244 | - ); |
|
2242 | + , |
|
2243 | + TestFailure::exceptionToString($e) |
|
2244 | + ); |
|
2245 | 2245 | |
2246 | - return; |
|
2247 | - } |
|
2246 | + return; |
|
2247 | + } |
|
2248 | 2248 | |
2249 | - $this->fail(); |
|
2250 | - } |
|
2249 | + $this->fail(); |
|
2250 | + } |
|
2251 | 2251 | |
2252 | - public function testConstraintStringContainsWhenIgnoreCase() |
|
2253 | - { |
|
2254 | - $constraint = Assert::stringContains('oryginał', true); |
|
2252 | + public function testConstraintStringContainsWhenIgnoreCase() |
|
2253 | + { |
|
2254 | + $constraint = Assert::stringContains('oryginał', true); |
|
2255 | 2255 | |
2256 | - $this->assertFalse($constraint->evaluate('oryginal', '', true)); |
|
2257 | - $this->assertTrue($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2258 | - $this->assertTrue($constraint->evaluate('oryginał', '', true)); |
|
2259 | - $this->assertEquals('contains "oryginał"', $constraint->toString()); |
|
2260 | - $this->assertEquals(1, \count($constraint)); |
|
2256 | + $this->assertFalse($constraint->evaluate('oryginal', '', true)); |
|
2257 | + $this->assertTrue($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2258 | + $this->assertTrue($constraint->evaluate('oryginał', '', true)); |
|
2259 | + $this->assertEquals('contains "oryginał"', $constraint->toString()); |
|
2260 | + $this->assertEquals(1, \count($constraint)); |
|
2261 | 2261 | |
2262 | - $this->expectException(ExpectationFailedException::class); |
|
2262 | + $this->expectException(ExpectationFailedException::class); |
|
2263 | 2263 | |
2264 | - $constraint->evaluate('oryginal'); |
|
2265 | - } |
|
2264 | + $constraint->evaluate('oryginal'); |
|
2265 | + } |
|
2266 | 2266 | |
2267 | - public function testConstraintStringContainsForUtf8StringWhenNotIgnoreCase() |
|
2268 | - { |
|
2269 | - $constraint = Assert::stringContains('oryginał', false); |
|
2267 | + public function testConstraintStringContainsForUtf8StringWhenNotIgnoreCase() |
|
2268 | + { |
|
2269 | + $constraint = Assert::stringContains('oryginał', false); |
|
2270 | 2270 | |
2271 | - $this->assertFalse($constraint->evaluate('oryginal', '', true)); |
|
2272 | - $this->assertFalse($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2273 | - $this->assertTrue($constraint->evaluate('oryginał', '', true)); |
|
2274 | - $this->assertEquals('contains "oryginał"', $constraint->toString()); |
|
2275 | - $this->assertEquals(1, \count($constraint)); |
|
2271 | + $this->assertFalse($constraint->evaluate('oryginal', '', true)); |
|
2272 | + $this->assertFalse($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2273 | + $this->assertTrue($constraint->evaluate('oryginał', '', true)); |
|
2274 | + $this->assertEquals('contains "oryginał"', $constraint->toString()); |
|
2275 | + $this->assertEquals(1, \count($constraint)); |
|
2276 | 2276 | |
2277 | - $this->expectException(ExpectationFailedException::class); |
|
2277 | + $this->expectException(ExpectationFailedException::class); |
|
2278 | 2278 | |
2279 | - $constraint->evaluate('oryginal'); |
|
2280 | - } |
|
2279 | + $constraint->evaluate('oryginal'); |
|
2280 | + } |
|
2281 | 2281 | |
2282 | - public function testConstraintStringContains2() |
|
2283 | - { |
|
2284 | - $constraint = Assert::stringContains('foo'); |
|
2282 | + public function testConstraintStringContains2() |
|
2283 | + { |
|
2284 | + $constraint = Assert::stringContains('foo'); |
|
2285 | 2285 | |
2286 | - try { |
|
2287 | - $constraint->evaluate('barbazbar', 'custom message'); |
|
2288 | - } catch (ExpectationFailedException $e) { |
|
2289 | - $this->assertEquals( |
|
2290 | - <<<EOF |
|
2286 | + try { |
|
2287 | + $constraint->evaluate('barbazbar', 'custom message'); |
|
2288 | + } catch (ExpectationFailedException $e) { |
|
2289 | + $this->assertEquals( |
|
2290 | + <<<EOF |
|
2291 | 2291 | custom message |
2292 | 2292 | Failed asserting that 'barbazbar' contains "foo". |
2293 | 2293 | |
2294 | 2294 | EOF |
2295 | - , |
|
2296 | - TestFailure::exceptionToString($e) |
|
2297 | - ); |
|
2295 | + , |
|
2296 | + TestFailure::exceptionToString($e) |
|
2297 | + ); |
|
2298 | 2298 | |
2299 | - return; |
|
2300 | - } |
|
2299 | + return; |
|
2300 | + } |
|
2301 | 2301 | |
2302 | - $this->fail(); |
|
2303 | - } |
|
2302 | + $this->fail(); |
|
2303 | + } |
|
2304 | 2304 | |
2305 | - public function testConstraintStringNotContains() |
|
2306 | - { |
|
2307 | - $constraint = Assert::logicalNot( |
|
2308 | - Assert::stringContains('foo') |
|
2309 | - ); |
|
2305 | + public function testConstraintStringNotContains() |
|
2306 | + { |
|
2307 | + $constraint = Assert::logicalNot( |
|
2308 | + Assert::stringContains('foo') |
|
2309 | + ); |
|
2310 | 2310 | |
2311 | - $this->assertTrue($constraint->evaluate('barbazbar', '', true)); |
|
2312 | - $this->assertFalse($constraint->evaluate('barfoobar', '', true)); |
|
2313 | - $this->assertEquals('does not contain "foo"', $constraint->toString()); |
|
2314 | - $this->assertCount(1, $constraint); |
|
2311 | + $this->assertTrue($constraint->evaluate('barbazbar', '', true)); |
|
2312 | + $this->assertFalse($constraint->evaluate('barfoobar', '', true)); |
|
2313 | + $this->assertEquals('does not contain "foo"', $constraint->toString()); |
|
2314 | + $this->assertCount(1, $constraint); |
|
2315 | 2315 | |
2316 | - try { |
|
2317 | - $constraint->evaluate('barfoobar'); |
|
2318 | - } catch (ExpectationFailedException $e) { |
|
2319 | - $this->assertEquals( |
|
2320 | - <<<EOF |
|
2316 | + try { |
|
2317 | + $constraint->evaluate('barfoobar'); |
|
2318 | + } catch (ExpectationFailedException $e) { |
|
2319 | + $this->assertEquals( |
|
2320 | + <<<EOF |
|
2321 | 2321 | Failed asserting that 'barfoobar' does not contain "foo". |
2322 | 2322 | |
2323 | 2323 | EOF |
2324 | - , |
|
2325 | - TestFailure::exceptionToString($e) |
|
2326 | - ); |
|
2324 | + , |
|
2325 | + TestFailure::exceptionToString($e) |
|
2326 | + ); |
|
2327 | 2327 | |
2328 | - return; |
|
2329 | - } |
|
2328 | + return; |
|
2329 | + } |
|
2330 | 2330 | |
2331 | - $this->fail(); |
|
2332 | - } |
|
2331 | + $this->fail(); |
|
2332 | + } |
|
2333 | 2333 | |
2334 | - public function testConstraintStringNotContainsWhenIgnoreCase() |
|
2335 | - { |
|
2336 | - $constraint = Assert::logicalNot( |
|
2337 | - Assert::stringContains('oryginał') |
|
2338 | - ); |
|
2334 | + public function testConstraintStringNotContainsWhenIgnoreCase() |
|
2335 | + { |
|
2336 | + $constraint = Assert::logicalNot( |
|
2337 | + Assert::stringContains('oryginał') |
|
2338 | + ); |
|
2339 | 2339 | |
2340 | - $this->assertTrue($constraint->evaluate('original', '', true)); |
|
2341 | - $this->assertFalse($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2342 | - $this->assertFalse($constraint->evaluate('oryginał', '', true)); |
|
2343 | - $this->assertEquals('does not contain "oryginał"', $constraint->toString()); |
|
2344 | - $this->assertEquals(1, \count($constraint)); |
|
2340 | + $this->assertTrue($constraint->evaluate('original', '', true)); |
|
2341 | + $this->assertFalse($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2342 | + $this->assertFalse($constraint->evaluate('oryginał', '', true)); |
|
2343 | + $this->assertEquals('does not contain "oryginał"', $constraint->toString()); |
|
2344 | + $this->assertEquals(1, \count($constraint)); |
|
2345 | 2345 | |
2346 | - $this->expectException(ExpectationFailedException::class); |
|
2346 | + $this->expectException(ExpectationFailedException::class); |
|
2347 | 2347 | |
2348 | - $constraint->evaluate('ORYGINAŁ'); |
|
2349 | - } |
|
2348 | + $constraint->evaluate('ORYGINAŁ'); |
|
2349 | + } |
|
2350 | 2350 | |
2351 | - public function testConstraintStringNotContainsForUtf8StringWhenNotIgnoreCase() |
|
2352 | - { |
|
2353 | - $constraint = Assert::logicalNot( |
|
2354 | - Assert::stringContains('oryginał', false) |
|
2355 | - ); |
|
2351 | + public function testConstraintStringNotContainsForUtf8StringWhenNotIgnoreCase() |
|
2352 | + { |
|
2353 | + $constraint = Assert::logicalNot( |
|
2354 | + Assert::stringContains('oryginał', false) |
|
2355 | + ); |
|
2356 | 2356 | |
2357 | - $this->assertTrue($constraint->evaluate('original', '', true)); |
|
2358 | - $this->assertTrue($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2359 | - $this->assertFalse($constraint->evaluate('oryginał', '', true)); |
|
2360 | - $this->assertEquals('does not contain "oryginał"', $constraint->toString()); |
|
2361 | - $this->assertEquals(1, \count($constraint)); |
|
2357 | + $this->assertTrue($constraint->evaluate('original', '', true)); |
|
2358 | + $this->assertTrue($constraint->evaluate('ORYGINAŁ', '', true)); |
|
2359 | + $this->assertFalse($constraint->evaluate('oryginał', '', true)); |
|
2360 | + $this->assertEquals('does not contain "oryginał"', $constraint->toString()); |
|
2361 | + $this->assertEquals(1, \count($constraint)); |
|
2362 | 2362 | |
2363 | - $this->expectException(ExpectationFailedException::class); |
|
2363 | + $this->expectException(ExpectationFailedException::class); |
|
2364 | 2364 | |
2365 | - $constraint->evaluate('oryginał'); |
|
2366 | - } |
|
2365 | + $constraint->evaluate('oryginał'); |
|
2366 | + } |
|
2367 | 2367 | |
2368 | - public function testConstraintStringNotContains2() |
|
2369 | - { |
|
2370 | - $constraint = Assert::logicalNot( |
|
2371 | - Assert::stringContains('foo') |
|
2372 | - ); |
|
2368 | + public function testConstraintStringNotContains2() |
|
2369 | + { |
|
2370 | + $constraint = Assert::logicalNot( |
|
2371 | + Assert::stringContains('foo') |
|
2372 | + ); |
|
2373 | 2373 | |
2374 | - try { |
|
2375 | - $constraint->evaluate('barfoobar', 'custom message'); |
|
2376 | - } catch (ExpectationFailedException $e) { |
|
2377 | - $this->assertEquals( |
|
2378 | - <<<EOF |
|
2374 | + try { |
|
2375 | + $constraint->evaluate('barfoobar', 'custom message'); |
|
2376 | + } catch (ExpectationFailedException $e) { |
|
2377 | + $this->assertEquals( |
|
2378 | + <<<EOF |
|
2379 | 2379 | custom message |
2380 | 2380 | Failed asserting that 'barfoobar' does not contain "foo". |
2381 | 2381 | |
2382 | 2382 | EOF |
2383 | - , |
|
2384 | - TestFailure::exceptionToString($e) |
|
2385 | - ); |
|
2383 | + , |
|
2384 | + TestFailure::exceptionToString($e) |
|
2385 | + ); |
|
2386 | 2386 | |
2387 | - return; |
|
2388 | - } |
|
2387 | + return; |
|
2388 | + } |
|
2389 | 2389 | |
2390 | - $this->fail(); |
|
2391 | - } |
|
2390 | + $this->fail(); |
|
2391 | + } |
|
2392 | 2392 | |
2393 | - public function testConstraintStringEndsWith() |
|
2394 | - { |
|
2395 | - $constraint = Assert::stringEndsWith('suffix'); |
|
2393 | + public function testConstraintStringEndsWith() |
|
2394 | + { |
|
2395 | + $constraint = Assert::stringEndsWith('suffix'); |
|
2396 | 2396 | |
2397 | - $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
2398 | - $this->assertTrue($constraint->evaluate('foosuffix', '', true)); |
|
2399 | - $this->assertEquals('ends with "suffix"', $constraint->toString()); |
|
2400 | - $this->assertCount(1, $constraint); |
|
2397 | + $this->assertFalse($constraint->evaluate('foo', '', true)); |
|
2398 | + $this->assertTrue($constraint->evaluate('foosuffix', '', true)); |
|
2399 | + $this->assertEquals('ends with "suffix"', $constraint->toString()); |
|
2400 | + $this->assertCount(1, $constraint); |
|
2401 | 2401 | |
2402 | - try { |
|
2403 | - $constraint->evaluate('foo'); |
|
2404 | - } catch (ExpectationFailedException $e) { |
|
2405 | - $this->assertEquals( |
|
2406 | - <<<EOF |
|
2402 | + try { |
|
2403 | + $constraint->evaluate('foo'); |
|
2404 | + } catch (ExpectationFailedException $e) { |
|
2405 | + $this->assertEquals( |
|
2406 | + <<<EOF |
|
2407 | 2407 | Failed asserting that 'foo' ends with "suffix". |
2408 | 2408 | |
2409 | 2409 | EOF |
2410 | - , |
|
2411 | - TestFailure::exceptionToString($e) |
|
2412 | - ); |
|
2410 | + , |
|
2411 | + TestFailure::exceptionToString($e) |
|
2412 | + ); |
|
2413 | 2413 | |
2414 | - return; |
|
2415 | - } |
|
2414 | + return; |
|
2415 | + } |
|
2416 | 2416 | |
2417 | - $this->fail(); |
|
2418 | - } |
|
2417 | + $this->fail(); |
|
2418 | + } |
|
2419 | 2419 | |
2420 | - public function testConstraintStringEndsWith2() |
|
2421 | - { |
|
2422 | - $constraint = Assert::stringEndsWith('suffix'); |
|
2420 | + public function testConstraintStringEndsWith2() |
|
2421 | + { |
|
2422 | + $constraint = Assert::stringEndsWith('suffix'); |
|
2423 | 2423 | |
2424 | - try { |
|
2425 | - $constraint->evaluate('foo', 'custom message'); |
|
2426 | - } catch (ExpectationFailedException $e) { |
|
2427 | - $this->assertEquals( |
|
2428 | - <<<EOF |
|
2424 | + try { |
|
2425 | + $constraint->evaluate('foo', 'custom message'); |
|
2426 | + } catch (ExpectationFailedException $e) { |
|
2427 | + $this->assertEquals( |
|
2428 | + <<<EOF |
|
2429 | 2429 | custom message |
2430 | 2430 | Failed asserting that 'foo' ends with "suffix". |
2431 | 2431 | |
2432 | 2432 | EOF |
2433 | - , |
|
2434 | - TestFailure::exceptionToString($e) |
|
2435 | - ); |
|
2433 | + , |
|
2434 | + TestFailure::exceptionToString($e) |
|
2435 | + ); |
|
2436 | 2436 | |
2437 | - return; |
|
2438 | - } |
|
2437 | + return; |
|
2438 | + } |
|
2439 | 2439 | |
2440 | - $this->fail(); |
|
2441 | - } |
|
2440 | + $this->fail(); |
|
2441 | + } |
|
2442 | 2442 | |
2443 | - public function testConstraintStringEndsNotWith() |
|
2444 | - { |
|
2445 | - $constraint = Assert::logicalNot( |
|
2446 | - Assert::stringEndsWith('suffix') |
|
2447 | - ); |
|
2443 | + public function testConstraintStringEndsNotWith() |
|
2444 | + { |
|
2445 | + $constraint = Assert::logicalNot( |
|
2446 | + Assert::stringEndsWith('suffix') |
|
2447 | + ); |
|
2448 | 2448 | |
2449 | - $this->assertTrue($constraint->evaluate('foo', '', true)); |
|
2450 | - $this->assertFalse($constraint->evaluate('foosuffix', '', true)); |
|
2451 | - $this->assertEquals('ends not with "suffix"', $constraint->toString()); |
|
2452 | - $this->assertCount(1, $constraint); |
|
2449 | + $this->assertTrue($constraint->evaluate('foo', '', true)); |
|
2450 | + $this->assertFalse($constraint->evaluate('foosuffix', '', true)); |
|
2451 | + $this->assertEquals('ends not with "suffix"', $constraint->toString()); |
|
2452 | + $this->assertCount(1, $constraint); |
|
2453 | 2453 | |
2454 | - try { |
|
2455 | - $constraint->evaluate('foosuffix'); |
|
2456 | - } catch (ExpectationFailedException $e) { |
|
2457 | - $this->assertEquals( |
|
2458 | - <<<EOF |
|
2454 | + try { |
|
2455 | + $constraint->evaluate('foosuffix'); |
|
2456 | + } catch (ExpectationFailedException $e) { |
|
2457 | + $this->assertEquals( |
|
2458 | + <<<EOF |
|
2459 | 2459 | Failed asserting that 'foosuffix' ends not with "suffix". |
2460 | 2460 | |
2461 | 2461 | EOF |
2462 | - , |
|
2463 | - TestFailure::exceptionToString($e) |
|
2464 | - ); |
|
2462 | + , |
|
2463 | + TestFailure::exceptionToString($e) |
|
2464 | + ); |
|
2465 | 2465 | |
2466 | - return; |
|
2467 | - } |
|
2466 | + return; |
|
2467 | + } |
|
2468 | 2468 | |
2469 | - $this->fail(); |
|
2470 | - } |
|
2469 | + $this->fail(); |
|
2470 | + } |
|
2471 | 2471 | |
2472 | - public function testConstraintStringEndsNotWith2() |
|
2473 | - { |
|
2474 | - $constraint = Assert::logicalNot( |
|
2475 | - Assert::stringEndsWith('suffix') |
|
2476 | - ); |
|
2472 | + public function testConstraintStringEndsNotWith2() |
|
2473 | + { |
|
2474 | + $constraint = Assert::logicalNot( |
|
2475 | + Assert::stringEndsWith('suffix') |
|
2476 | + ); |
|
2477 | 2477 | |
2478 | - try { |
|
2479 | - $constraint->evaluate('foosuffix', 'custom message'); |
|
2480 | - } catch (ExpectationFailedException $e) { |
|
2481 | - $this->assertEquals( |
|
2482 | - <<<EOF |
|
2478 | + try { |
|
2479 | + $constraint->evaluate('foosuffix', 'custom message'); |
|
2480 | + } catch (ExpectationFailedException $e) { |
|
2481 | + $this->assertEquals( |
|
2482 | + <<<EOF |
|
2483 | 2483 | custom message |
2484 | 2484 | Failed asserting that 'foosuffix' ends not with "suffix". |
2485 | 2485 | |
2486 | 2486 | EOF |
2487 | - , |
|
2488 | - TestFailure::exceptionToString($e) |
|
2489 | - ); |
|
2487 | + , |
|
2488 | + TestFailure::exceptionToString($e) |
|
2489 | + ); |
|
2490 | 2490 | |
2491 | - return; |
|
2492 | - } |
|
2491 | + return; |
|
2492 | + } |
|
2493 | 2493 | |
2494 | - $this->fail(); |
|
2495 | - } |
|
2494 | + $this->fail(); |
|
2495 | + } |
|
2496 | 2496 | |
2497 | - public function testConstraintArrayContainsCheckForObjectIdentity() |
|
2498 | - { |
|
2499 | - // Check for primitive type. |
|
2500 | - $constraint = new TraversableContains('foo', true, true); |
|
2497 | + public function testConstraintArrayContainsCheckForObjectIdentity() |
|
2498 | + { |
|
2499 | + // Check for primitive type. |
|
2500 | + $constraint = new TraversableContains('foo', true, true); |
|
2501 | 2501 | |
2502 | - $this->assertFalse($constraint->evaluate([0], '', true)); |
|
2503 | - $this->assertFalse($constraint->evaluate([true], '', true)); |
|
2502 | + $this->assertFalse($constraint->evaluate([0], '', true)); |
|
2503 | + $this->assertFalse($constraint->evaluate([true], '', true)); |
|
2504 | 2504 | |
2505 | - // Default case. |
|
2506 | - $constraint = new TraversableContains('foo'); |
|
2505 | + // Default case. |
|
2506 | + $constraint = new TraversableContains('foo'); |
|
2507 | 2507 | |
2508 | - $this->assertTrue($constraint->evaluate([0], '', true)); |
|
2509 | - $this->assertTrue($constraint->evaluate([true], '', true)); |
|
2510 | - } |
|
2508 | + $this->assertTrue($constraint->evaluate([0], '', true)); |
|
2509 | + $this->assertTrue($constraint->evaluate([true], '', true)); |
|
2510 | + } |
|
2511 | 2511 | |
2512 | - public function testConstraintArrayContains() |
|
2513 | - { |
|
2514 | - $constraint = new TraversableContains('foo'); |
|
2512 | + public function testConstraintArrayContains() |
|
2513 | + { |
|
2514 | + $constraint = new TraversableContains('foo'); |
|
2515 | 2515 | |
2516 | - $this->assertFalse($constraint->evaluate(['bar'], '', true)); |
|
2517 | - $this->assertTrue($constraint->evaluate(['foo'], '', true)); |
|
2518 | - $this->assertEquals("contains 'foo'", $constraint->toString()); |
|
2519 | - $this->assertCount(1, $constraint); |
|
2516 | + $this->assertFalse($constraint->evaluate(['bar'], '', true)); |
|
2517 | + $this->assertTrue($constraint->evaluate(['foo'], '', true)); |
|
2518 | + $this->assertEquals("contains 'foo'", $constraint->toString()); |
|
2519 | + $this->assertCount(1, $constraint); |
|
2520 | 2520 | |
2521 | - try { |
|
2522 | - $constraint->evaluate(['bar']); |
|
2523 | - } catch (ExpectationFailedException $e) { |
|
2524 | - $this->assertEquals( |
|
2525 | - <<<EOF |
|
2521 | + try { |
|
2522 | + $constraint->evaluate(['bar']); |
|
2523 | + } catch (ExpectationFailedException $e) { |
|
2524 | + $this->assertEquals( |
|
2525 | + <<<EOF |
|
2526 | 2526 | Failed asserting that an array contains 'foo'. |
2527 | 2527 | |
2528 | 2528 | EOF |
2529 | - , |
|
2530 | - TestFailure::exceptionToString($e) |
|
2531 | - ); |
|
2529 | + , |
|
2530 | + TestFailure::exceptionToString($e) |
|
2531 | + ); |
|
2532 | 2532 | |
2533 | - return; |
|
2534 | - } |
|
2533 | + return; |
|
2534 | + } |
|
2535 | 2535 | |
2536 | - $this->fail(); |
|
2537 | - } |
|
2536 | + $this->fail(); |
|
2537 | + } |
|
2538 | 2538 | |
2539 | - public function testConstraintArrayContains2() |
|
2540 | - { |
|
2541 | - $constraint = new TraversableContains('foo'); |
|
2539 | + public function testConstraintArrayContains2() |
|
2540 | + { |
|
2541 | + $constraint = new TraversableContains('foo'); |
|
2542 | 2542 | |
2543 | - try { |
|
2544 | - $constraint->evaluate(['bar'], 'custom message'); |
|
2545 | - } catch (ExpectationFailedException $e) { |
|
2546 | - $this->assertEquals( |
|
2547 | - <<<EOF |
|
2543 | + try { |
|
2544 | + $constraint->evaluate(['bar'], 'custom message'); |
|
2545 | + } catch (ExpectationFailedException $e) { |
|
2546 | + $this->assertEquals( |
|
2547 | + <<<EOF |
|
2548 | 2548 | custom message |
2549 | 2549 | Failed asserting that an array contains 'foo'. |
2550 | 2550 | |
2551 | 2551 | EOF |
2552 | - , |
|
2553 | - TestFailure::exceptionToString($e) |
|
2554 | - ); |
|
2552 | + , |
|
2553 | + TestFailure::exceptionToString($e) |
|
2554 | + ); |
|
2555 | 2555 | |
2556 | - return; |
|
2557 | - } |
|
2556 | + return; |
|
2557 | + } |
|
2558 | 2558 | |
2559 | - $this->fail(); |
|
2560 | - } |
|
2559 | + $this->fail(); |
|
2560 | + } |
|
2561 | 2561 | |
2562 | - public function testConstraintArrayNotContains() |
|
2563 | - { |
|
2564 | - $constraint = Assert::logicalNot( |
|
2565 | - new TraversableContains('foo') |
|
2566 | - ); |
|
2562 | + public function testConstraintArrayNotContains() |
|
2563 | + { |
|
2564 | + $constraint = Assert::logicalNot( |
|
2565 | + new TraversableContains('foo') |
|
2566 | + ); |
|
2567 | 2567 | |
2568 | - $this->assertTrue($constraint->evaluate(['bar'], '', true)); |
|
2569 | - $this->assertFalse($constraint->evaluate(['foo'], '', true)); |
|
2570 | - $this->assertEquals("does not contain 'foo'", $constraint->toString()); |
|
2571 | - $this->assertCount(1, $constraint); |
|
2568 | + $this->assertTrue($constraint->evaluate(['bar'], '', true)); |
|
2569 | + $this->assertFalse($constraint->evaluate(['foo'], '', true)); |
|
2570 | + $this->assertEquals("does not contain 'foo'", $constraint->toString()); |
|
2571 | + $this->assertCount(1, $constraint); |
|
2572 | 2572 | |
2573 | - try { |
|
2574 | - $constraint->evaluate(['foo']); |
|
2575 | - } catch (ExpectationFailedException $e) { |
|
2576 | - $this->assertEquals( |
|
2577 | - <<<EOF |
|
2573 | + try { |
|
2574 | + $constraint->evaluate(['foo']); |
|
2575 | + } catch (ExpectationFailedException $e) { |
|
2576 | + $this->assertEquals( |
|
2577 | + <<<EOF |
|
2578 | 2578 | Failed asserting that an array does not contain 'foo'. |
2579 | 2579 | |
2580 | 2580 | EOF |
2581 | - , |
|
2582 | - TestFailure::exceptionToString($e) |
|
2583 | - ); |
|
2581 | + , |
|
2582 | + TestFailure::exceptionToString($e) |
|
2583 | + ); |
|
2584 | 2584 | |
2585 | - return; |
|
2586 | - } |
|
2585 | + return; |
|
2586 | + } |
|
2587 | 2587 | |
2588 | - $this->fail(); |
|
2589 | - } |
|
2588 | + $this->fail(); |
|
2589 | + } |
|
2590 | 2590 | |
2591 | - public function testConstraintArrayNotContains2() |
|
2592 | - { |
|
2593 | - $constraint = Assert::logicalNot( |
|
2594 | - new TraversableContains('foo') |
|
2595 | - ); |
|
2591 | + public function testConstraintArrayNotContains2() |
|
2592 | + { |
|
2593 | + $constraint = Assert::logicalNot( |
|
2594 | + new TraversableContains('foo') |
|
2595 | + ); |
|
2596 | 2596 | |
2597 | - try { |
|
2598 | - $constraint->evaluate(['foo'], 'custom message'); |
|
2599 | - } catch (ExpectationFailedException $e) { |
|
2600 | - $this->assertEquals( |
|
2601 | - <<<EOF |
|
2597 | + try { |
|
2598 | + $constraint->evaluate(['foo'], 'custom message'); |
|
2599 | + } catch (ExpectationFailedException $e) { |
|
2600 | + $this->assertEquals( |
|
2601 | + <<<EOF |
|
2602 | 2602 | custom message |
2603 | 2603 | Failed asserting that an array does not contain 'foo'. |
2604 | 2604 | |
2605 | 2605 | EOF |
2606 | - , |
|
2607 | - TestFailure::exceptionToString($e) |
|
2608 | - ); |
|
2606 | + , |
|
2607 | + TestFailure::exceptionToString($e) |
|
2608 | + ); |
|
2609 | 2609 | |
2610 | - return; |
|
2611 | - } |
|
2610 | + return; |
|
2611 | + } |
|
2612 | 2612 | |
2613 | - $this->fail(); |
|
2614 | - } |
|
2613 | + $this->fail(); |
|
2614 | + } |
|
2615 | 2615 | |
2616 | - public function testConstraintSplObjectStorageContains() |
|
2617 | - { |
|
2618 | - $object = new \stdClass; |
|
2619 | - $constraint = new TraversableContains($object); |
|
2620 | - $this->assertStringMatchesFormat('contains stdClass Object &%s ()', $constraint->toString()); |
|
2616 | + public function testConstraintSplObjectStorageContains() |
|
2617 | + { |
|
2618 | + $object = new \stdClass; |
|
2619 | + $constraint = new TraversableContains($object); |
|
2620 | + $this->assertStringMatchesFormat('contains stdClass Object &%s ()', $constraint->toString()); |
|
2621 | 2621 | |
2622 | - $storage = new \SplObjectStorage; |
|
2623 | - $this->assertFalse($constraint->evaluate($storage, '', true)); |
|
2622 | + $storage = new \SplObjectStorage; |
|
2623 | + $this->assertFalse($constraint->evaluate($storage, '', true)); |
|
2624 | 2624 | |
2625 | - $storage->attach($object); |
|
2626 | - $this->assertTrue($constraint->evaluate($storage, '', true)); |
|
2625 | + $storage->attach($object); |
|
2626 | + $this->assertTrue($constraint->evaluate($storage, '', true)); |
|
2627 | 2627 | |
2628 | - try { |
|
2629 | - $constraint->evaluate(new \SplObjectStorage); |
|
2630 | - } catch (ExpectationFailedException $e) { |
|
2631 | - $this->assertStringMatchesFormat( |
|
2632 | - <<<EOF |
|
2628 | + try { |
|
2629 | + $constraint->evaluate(new \SplObjectStorage); |
|
2630 | + } catch (ExpectationFailedException $e) { |
|
2631 | + $this->assertStringMatchesFormat( |
|
2632 | + <<<EOF |
|
2633 | 2633 | Failed asserting that a traversable contains stdClass Object &%x (). |
2634 | 2634 | |
2635 | 2635 | EOF |
2636 | - , |
|
2637 | - TestFailure::exceptionToString($e) |
|
2638 | - ); |
|
2636 | + , |
|
2637 | + TestFailure::exceptionToString($e) |
|
2638 | + ); |
|
2639 | 2639 | |
2640 | - return; |
|
2641 | - } |
|
2640 | + return; |
|
2641 | + } |
|
2642 | 2642 | |
2643 | - $this->fail(); |
|
2644 | - } |
|
2643 | + $this->fail(); |
|
2644 | + } |
|
2645 | 2645 | |
2646 | - public function testConstraintSplObjectStorageContains2() |
|
2647 | - { |
|
2648 | - $object = new \stdClass; |
|
2649 | - $constraint = new TraversableContains($object); |
|
2646 | + public function testConstraintSplObjectStorageContains2() |
|
2647 | + { |
|
2648 | + $object = new \stdClass; |
|
2649 | + $constraint = new TraversableContains($object); |
|
2650 | 2650 | |
2651 | - try { |
|
2652 | - $constraint->evaluate(new \SplObjectStorage, 'custom message'); |
|
2653 | - } catch (ExpectationFailedException $e) { |
|
2654 | - $this->assertStringMatchesFormat( |
|
2655 | - <<<EOF |
|
2651 | + try { |
|
2652 | + $constraint->evaluate(new \SplObjectStorage, 'custom message'); |
|
2653 | + } catch (ExpectationFailedException $e) { |
|
2654 | + $this->assertStringMatchesFormat( |
|
2655 | + <<<EOF |
|
2656 | 2656 | custom message |
2657 | 2657 | Failed asserting that a traversable contains stdClass Object &%x (). |
2658 | 2658 | |
2659 | 2659 | EOF |
2660 | - , |
|
2661 | - TestFailure::exceptionToString($e) |
|
2662 | - ); |
|
2660 | + , |
|
2661 | + TestFailure::exceptionToString($e) |
|
2662 | + ); |
|
2663 | 2663 | |
2664 | - return; |
|
2665 | - } |
|
2664 | + return; |
|
2665 | + } |
|
2666 | 2666 | |
2667 | - $this->fail(); |
|
2668 | - } |
|
2667 | + $this->fail(); |
|
2668 | + } |
|
2669 | 2669 | |
2670 | - public function testAttributeEqualTo() |
|
2671 | - { |
|
2672 | - $object = new \ClassWithNonPublicAttributes; |
|
2673 | - $constraint = Assert::attributeEqualTo('foo', 1); |
|
2670 | + public function testAttributeEqualTo() |
|
2671 | + { |
|
2672 | + $object = new \ClassWithNonPublicAttributes; |
|
2673 | + $constraint = Assert::attributeEqualTo('foo', 1); |
|
2674 | 2674 | |
2675 | - $this->assertTrue($constraint->evaluate($object, '', true)); |
|
2676 | - $this->assertEquals('attribute "foo" is equal to 1', $constraint->toString()); |
|
2677 | - $this->assertCount(1, $constraint); |
|
2675 | + $this->assertTrue($constraint->evaluate($object, '', true)); |
|
2676 | + $this->assertEquals('attribute "foo" is equal to 1', $constraint->toString()); |
|
2677 | + $this->assertCount(1, $constraint); |
|
2678 | 2678 | |
2679 | - $constraint = Assert::attributeEqualTo('foo', 2); |
|
2679 | + $constraint = Assert::attributeEqualTo('foo', 2); |
|
2680 | 2680 | |
2681 | - $this->assertFalse($constraint->evaluate($object, '', true)); |
|
2681 | + $this->assertFalse($constraint->evaluate($object, '', true)); |
|
2682 | 2682 | |
2683 | - try { |
|
2684 | - $constraint->evaluate($object); |
|
2685 | - } catch (ExpectationFailedException $e) { |
|
2686 | - $this->assertEquals( |
|
2687 | - <<<EOF |
|
2683 | + try { |
|
2684 | + $constraint->evaluate($object); |
|
2685 | + } catch (ExpectationFailedException $e) { |
|
2686 | + $this->assertEquals( |
|
2687 | + <<<EOF |
|
2688 | 2688 | Failed asserting that attribute "foo" is equal to 2. |
2689 | 2689 | |
2690 | 2690 | EOF |
2691 | - , |
|
2692 | - TestFailure::exceptionToString($e) |
|
2693 | - ); |
|
2691 | + , |
|
2692 | + TestFailure::exceptionToString($e) |
|
2693 | + ); |
|
2694 | 2694 | |
2695 | - return; |
|
2696 | - } |
|
2695 | + return; |
|
2696 | + } |
|
2697 | 2697 | |
2698 | - $this->fail(); |
|
2699 | - } |
|
2698 | + $this->fail(); |
|
2699 | + } |
|
2700 | 2700 | |
2701 | - public function testAttributeEqualTo2() |
|
2702 | - { |
|
2703 | - $object = new \ClassWithNonPublicAttributes; |
|
2704 | - $constraint = Assert::attributeEqualTo('foo', 2); |
|
2701 | + public function testAttributeEqualTo2() |
|
2702 | + { |
|
2703 | + $object = new \ClassWithNonPublicAttributes; |
|
2704 | + $constraint = Assert::attributeEqualTo('foo', 2); |
|
2705 | 2705 | |
2706 | - try { |
|
2707 | - $constraint->evaluate($object, 'custom message'); |
|
2708 | - } catch (ExpectationFailedException $e) { |
|
2709 | - $this->assertEquals( |
|
2710 | - <<<EOF |
|
2706 | + try { |
|
2707 | + $constraint->evaluate($object, 'custom message'); |
|
2708 | + } catch (ExpectationFailedException $e) { |
|
2709 | + $this->assertEquals( |
|
2710 | + <<<EOF |
|
2711 | 2711 | custom message\nFailed asserting that attribute "foo" is equal to 2. |
2712 | 2712 | |
2713 | 2713 | EOF |
2714 | - , |
|
2715 | - TestFailure::exceptionToString($e) |
|
2716 | - ); |
|
2714 | + , |
|
2715 | + TestFailure::exceptionToString($e) |
|
2716 | + ); |
|
2717 | 2717 | |
2718 | - return; |
|
2719 | - } |
|
2718 | + return; |
|
2719 | + } |
|
2720 | 2720 | |
2721 | - $this->fail(); |
|
2722 | - } |
|
2721 | + $this->fail(); |
|
2722 | + } |
|
2723 | 2723 | |
2724 | - public function testAttributeNotEqualTo() |
|
2725 | - { |
|
2726 | - $object = new \ClassWithNonPublicAttributes; |
|
2727 | - $constraint = Assert::logicalNot( |
|
2728 | - Assert::attributeEqualTo('foo', 2) |
|
2729 | - ); |
|
2724 | + public function testAttributeNotEqualTo() |
|
2725 | + { |
|
2726 | + $object = new \ClassWithNonPublicAttributes; |
|
2727 | + $constraint = Assert::logicalNot( |
|
2728 | + Assert::attributeEqualTo('foo', 2) |
|
2729 | + ); |
|
2730 | 2730 | |
2731 | - $this->assertTrue($constraint->evaluate($object, '', true)); |
|
2732 | - $this->assertEquals('attribute "foo" is not equal to 2', $constraint->toString()); |
|
2733 | - $this->assertCount(1, $constraint); |
|
2731 | + $this->assertTrue($constraint->evaluate($object, '', true)); |
|
2732 | + $this->assertEquals('attribute "foo" is not equal to 2', $constraint->toString()); |
|
2733 | + $this->assertCount(1, $constraint); |
|
2734 | 2734 | |
2735 | - $constraint = Assert::logicalNot( |
|
2736 | - Assert::attributeEqualTo('foo', 1) |
|
2737 | - ); |
|
2735 | + $constraint = Assert::logicalNot( |
|
2736 | + Assert::attributeEqualTo('foo', 1) |
|
2737 | + ); |
|
2738 | 2738 | |
2739 | - $this->assertFalse($constraint->evaluate($object, '', true)); |
|
2739 | + $this->assertFalse($constraint->evaluate($object, '', true)); |
|
2740 | 2740 | |
2741 | - try { |
|
2742 | - $constraint->evaluate($object); |
|
2743 | - } catch (ExpectationFailedException $e) { |
|
2744 | - $this->assertEquals( |
|
2745 | - <<<EOF |
|
2741 | + try { |
|
2742 | + $constraint->evaluate($object); |
|
2743 | + } catch (ExpectationFailedException $e) { |
|
2744 | + $this->assertEquals( |
|
2745 | + <<<EOF |
|
2746 | 2746 | Failed asserting that attribute "foo" is not equal to 1. |
2747 | 2747 | |
2748 | 2748 | EOF |
2749 | - , |
|
2750 | - TestFailure::exceptionToString($e) |
|
2751 | - ); |
|
2749 | + , |
|
2750 | + TestFailure::exceptionToString($e) |
|
2751 | + ); |
|
2752 | 2752 | |
2753 | - return; |
|
2754 | - } |
|
2753 | + return; |
|
2754 | + } |
|
2755 | 2755 | |
2756 | - $this->fail(); |
|
2757 | - } |
|
2756 | + $this->fail(); |
|
2757 | + } |
|
2758 | 2758 | |
2759 | - public function testAttributeNotEqualTo2() |
|
2760 | - { |
|
2761 | - $object = new \ClassWithNonPublicAttributes; |
|
2762 | - $constraint = Assert::logicalNot( |
|
2763 | - Assert::attributeEqualTo('foo', 1) |
|
2764 | - ); |
|
2759 | + public function testAttributeNotEqualTo2() |
|
2760 | + { |
|
2761 | + $object = new \ClassWithNonPublicAttributes; |
|
2762 | + $constraint = Assert::logicalNot( |
|
2763 | + Assert::attributeEqualTo('foo', 1) |
|
2764 | + ); |
|
2765 | 2765 | |
2766 | - try { |
|
2767 | - $constraint->evaluate($object, 'custom message'); |
|
2768 | - } catch (ExpectationFailedException $e) { |
|
2769 | - $this->assertEquals( |
|
2770 | - <<<EOF |
|
2766 | + try { |
|
2767 | + $constraint->evaluate($object, 'custom message'); |
|
2768 | + } catch (ExpectationFailedException $e) { |
|
2769 | + $this->assertEquals( |
|
2770 | + <<<EOF |
|
2771 | 2771 | custom message\nFailed asserting that attribute "foo" is not equal to 1. |
2772 | 2772 | |
2773 | 2773 | EOF |
2774 | - , |
|
2775 | - TestFailure::exceptionToString($e) |
|
2776 | - ); |
|
2774 | + , |
|
2775 | + TestFailure::exceptionToString($e) |
|
2776 | + ); |
|
2777 | 2777 | |
2778 | - return; |
|
2779 | - } |
|
2778 | + return; |
|
2779 | + } |
|
2780 | 2780 | |
2781 | - $this->fail(); |
|
2782 | - } |
|
2781 | + $this->fail(); |
|
2782 | + } |
|
2783 | 2783 | |
2784 | - public function testConstraintIsEmpty() |
|
2785 | - { |
|
2786 | - $constraint = new IsEmpty; |
|
2784 | + public function testConstraintIsEmpty() |
|
2785 | + { |
|
2786 | + $constraint = new IsEmpty; |
|
2787 | 2787 | |
2788 | - $this->assertFalse($constraint->evaluate(['foo'], '', true)); |
|
2789 | - $this->assertTrue($constraint->evaluate([], '', true)); |
|
2790 | - $this->assertFalse($constraint->evaluate(new \ArrayObject(['foo']), '', true)); |
|
2791 | - $this->assertTrue($constraint->evaluate(new \ArrayObject([]), '', true)); |
|
2792 | - $this->assertEquals('is empty', $constraint->toString()); |
|
2793 | - $this->assertCount(1, $constraint); |
|
2788 | + $this->assertFalse($constraint->evaluate(['foo'], '', true)); |
|
2789 | + $this->assertTrue($constraint->evaluate([], '', true)); |
|
2790 | + $this->assertFalse($constraint->evaluate(new \ArrayObject(['foo']), '', true)); |
|
2791 | + $this->assertTrue($constraint->evaluate(new \ArrayObject([]), '', true)); |
|
2792 | + $this->assertEquals('is empty', $constraint->toString()); |
|
2793 | + $this->assertCount(1, $constraint); |
|
2794 | 2794 | |
2795 | - try { |
|
2796 | - $constraint->evaluate(['foo']); |
|
2797 | - } catch (ExpectationFailedException $e) { |
|
2798 | - $this->assertEquals( |
|
2799 | - <<<EOF |
|
2795 | + try { |
|
2796 | + $constraint->evaluate(['foo']); |
|
2797 | + } catch (ExpectationFailedException $e) { |
|
2798 | + $this->assertEquals( |
|
2799 | + <<<EOF |
|
2800 | 2800 | Failed asserting that an array is empty. |
2801 | 2801 | |
2802 | 2802 | EOF |
2803 | - , |
|
2804 | - TestFailure::exceptionToString($e) |
|
2805 | - ); |
|
2803 | + , |
|
2804 | + TestFailure::exceptionToString($e) |
|
2805 | + ); |
|
2806 | 2806 | |
2807 | - return; |
|
2808 | - } |
|
2807 | + return; |
|
2808 | + } |
|
2809 | 2809 | |
2810 | - $this->fail(); |
|
2811 | - } |
|
2810 | + $this->fail(); |
|
2811 | + } |
|
2812 | 2812 | |
2813 | - public function testConstraintIsEmpty2() |
|
2814 | - { |
|
2815 | - $constraint = new IsEmpty; |
|
2813 | + public function testConstraintIsEmpty2() |
|
2814 | + { |
|
2815 | + $constraint = new IsEmpty; |
|
2816 | 2816 | |
2817 | - try { |
|
2818 | - $constraint->evaluate(['foo'], 'custom message'); |
|
2819 | - } catch (ExpectationFailedException $e) { |
|
2820 | - $this->assertEquals( |
|
2821 | - <<<EOF |
|
2817 | + try { |
|
2818 | + $constraint->evaluate(['foo'], 'custom message'); |
|
2819 | + } catch (ExpectationFailedException $e) { |
|
2820 | + $this->assertEquals( |
|
2821 | + <<<EOF |
|
2822 | 2822 | custom message\nFailed asserting that an array is empty. |
2823 | 2823 | |
2824 | 2824 | EOF |
2825 | - , |
|
2826 | - TestFailure::exceptionToString($e) |
|
2827 | - ); |
|
2825 | + , |
|
2826 | + TestFailure::exceptionToString($e) |
|
2827 | + ); |
|
2828 | 2828 | |
2829 | - return; |
|
2830 | - } |
|
2829 | + return; |
|
2830 | + } |
|
2831 | 2831 | |
2832 | - $this->fail(); |
|
2833 | - } |
|
2832 | + $this->fail(); |
|
2833 | + } |
|
2834 | 2834 | |
2835 | - public function testConstraintCountWithAnArray() |
|
2836 | - { |
|
2837 | - $constraint = new Count(5); |
|
2835 | + public function testConstraintCountWithAnArray() |
|
2836 | + { |
|
2837 | + $constraint = new Count(5); |
|
2838 | 2838 | |
2839 | - $this->assertTrue($constraint->evaluate([1, 2, 3, 4, 5], '', true)); |
|
2840 | - $this->assertFalse($constraint->evaluate([1, 2, 3, 4], '', true)); |
|
2841 | - } |
|
2839 | + $this->assertTrue($constraint->evaluate([1, 2, 3, 4, 5], '', true)); |
|
2840 | + $this->assertFalse($constraint->evaluate([1, 2, 3, 4], '', true)); |
|
2841 | + } |
|
2842 | 2842 | |
2843 | - public function testConstraintCountWithAnIteratorWhichDoesNotImplementCountable() |
|
2844 | - { |
|
2845 | - $constraint = new Count(5); |
|
2843 | + public function testConstraintCountWithAnIteratorWhichDoesNotImplementCountable() |
|
2844 | + { |
|
2845 | + $constraint = new Count(5); |
|
2846 | 2846 | |
2847 | - $this->assertTrue($constraint->evaluate(new \TestIterator([1, 2, 3, 4, 5]), '', true)); |
|
2848 | - $this->assertFalse($constraint->evaluate(new \TestIterator([1, 2, 3, 4]), '', true)); |
|
2849 | - } |
|
2847 | + $this->assertTrue($constraint->evaluate(new \TestIterator([1, 2, 3, 4, 5]), '', true)); |
|
2848 | + $this->assertFalse($constraint->evaluate(new \TestIterator([1, 2, 3, 4]), '', true)); |
|
2849 | + } |
|
2850 | 2850 | |
2851 | - public function testConstraintCountWithAnObjectImplementingCountable() |
|
2852 | - { |
|
2853 | - $constraint = new Count(5); |
|
2851 | + public function testConstraintCountWithAnObjectImplementingCountable() |
|
2852 | + { |
|
2853 | + $constraint = new Count(5); |
|
2854 | 2854 | |
2855 | - $this->assertTrue($constraint->evaluate(new \ArrayObject([1, 2, 3, 4, 5]), '', true)); |
|
2856 | - $this->assertFalse($constraint->evaluate(new \ArrayObject([1, 2, 3, 4]), '', true)); |
|
2857 | - } |
|
2855 | + $this->assertTrue($constraint->evaluate(new \ArrayObject([1, 2, 3, 4, 5]), '', true)); |
|
2856 | + $this->assertFalse($constraint->evaluate(new \ArrayObject([1, 2, 3, 4]), '', true)); |
|
2857 | + } |
|
2858 | 2858 | |
2859 | - public function testConstraintCountFailing() |
|
2860 | - { |
|
2861 | - $constraint = new Count(5); |
|
2859 | + public function testConstraintCountFailing() |
|
2860 | + { |
|
2861 | + $constraint = new Count(5); |
|
2862 | 2862 | |
2863 | - try { |
|
2864 | - $constraint->evaluate([1, 2]); |
|
2865 | - } catch (ExpectationFailedException $e) { |
|
2866 | - $this->assertEquals( |
|
2867 | - <<<EOF |
|
2863 | + try { |
|
2864 | + $constraint->evaluate([1, 2]); |
|
2865 | + } catch (ExpectationFailedException $e) { |
|
2866 | + $this->assertEquals( |
|
2867 | + <<<EOF |
|
2868 | 2868 | Failed asserting that actual size 2 matches expected size 5. |
2869 | 2869 | |
2870 | 2870 | EOF |
2871 | - , |
|
2872 | - TestFailure::exceptionToString($e) |
|
2873 | - ); |
|
2871 | + , |
|
2872 | + TestFailure::exceptionToString($e) |
|
2873 | + ); |
|
2874 | 2874 | |
2875 | - return; |
|
2876 | - } |
|
2875 | + return; |
|
2876 | + } |
|
2877 | 2877 | |
2878 | - $this->fail(); |
|
2879 | - } |
|
2878 | + $this->fail(); |
|
2879 | + } |
|
2880 | 2880 | |
2881 | - public function testConstraintNotCountFailing() |
|
2882 | - { |
|
2883 | - $constraint = Assert::logicalNot( |
|
2884 | - new Count(2) |
|
2885 | - ); |
|
2881 | + public function testConstraintNotCountFailing() |
|
2882 | + { |
|
2883 | + $constraint = Assert::logicalNot( |
|
2884 | + new Count(2) |
|
2885 | + ); |
|
2886 | 2886 | |
2887 | - try { |
|
2888 | - $constraint->evaluate([1, 2]); |
|
2889 | - } catch (ExpectationFailedException $e) { |
|
2890 | - $this->assertEquals( |
|
2891 | - <<<EOF |
|
2887 | + try { |
|
2888 | + $constraint->evaluate([1, 2]); |
|
2889 | + } catch (ExpectationFailedException $e) { |
|
2890 | + $this->assertEquals( |
|
2891 | + <<<EOF |
|
2892 | 2892 | Failed asserting that actual size 2 does not match expected size 2. |
2893 | 2893 | |
2894 | 2894 | EOF |
2895 | - , |
|
2896 | - TestFailure::exceptionToString($e) |
|
2897 | - ); |
|
2895 | + , |
|
2896 | + TestFailure::exceptionToString($e) |
|
2897 | + ); |
|
2898 | 2898 | |
2899 | - return; |
|
2900 | - } |
|
2899 | + return; |
|
2900 | + } |
|
2901 | 2901 | |
2902 | - $this->fail(); |
|
2903 | - } |
|
2902 | + $this->fail(); |
|
2903 | + } |
|
2904 | 2904 | |
2905 | - public function testConstraintSameSizeWithAnArray() |
|
2906 | - { |
|
2907 | - $constraint = new SameSize([1, 2, 3, 4, 5]); |
|
2905 | + public function testConstraintSameSizeWithAnArray() |
|
2906 | + { |
|
2907 | + $constraint = new SameSize([1, 2, 3, 4, 5]); |
|
2908 | 2908 | |
2909 | - $this->assertTrue($constraint->evaluate([6, 7, 8, 9, 10], '', true)); |
|
2910 | - $this->assertFalse($constraint->evaluate([1, 2, 3, 4], '', true)); |
|
2911 | - } |
|
2909 | + $this->assertTrue($constraint->evaluate([6, 7, 8, 9, 10], '', true)); |
|
2910 | + $this->assertFalse($constraint->evaluate([1, 2, 3, 4], '', true)); |
|
2911 | + } |
|
2912 | 2912 | |
2913 | - public function testConstraintSameSizeWithAnIteratorWhichDoesNotImplementCountable() |
|
2914 | - { |
|
2915 | - $constraint = new SameSize(new \TestIterator([1, 2, 3, 4, 5])); |
|
2913 | + public function testConstraintSameSizeWithAnIteratorWhichDoesNotImplementCountable() |
|
2914 | + { |
|
2915 | + $constraint = new SameSize(new \TestIterator([1, 2, 3, 4, 5])); |
|
2916 | 2916 | |
2917 | - $this->assertTrue($constraint->evaluate(new \TestIterator([6, 7, 8, 9, 10]), '', true)); |
|
2918 | - $this->assertFalse($constraint->evaluate(new \TestIterator([1, 2, 3, 4]), '', true)); |
|
2919 | - } |
|
2917 | + $this->assertTrue($constraint->evaluate(new \TestIterator([6, 7, 8, 9, 10]), '', true)); |
|
2918 | + $this->assertFalse($constraint->evaluate(new \TestIterator([1, 2, 3, 4]), '', true)); |
|
2919 | + } |
|
2920 | 2920 | |
2921 | - public function testConstraintSameSizeWithAnObjectImplementingCountable() |
|
2922 | - { |
|
2923 | - $constraint = new SameSize(new \ArrayObject([1, 2, 3, 4, 5])); |
|
2921 | + public function testConstraintSameSizeWithAnObjectImplementingCountable() |
|
2922 | + { |
|
2923 | + $constraint = new SameSize(new \ArrayObject([1, 2, 3, 4, 5])); |
|
2924 | 2924 | |
2925 | - $this->assertTrue($constraint->evaluate(new \ArrayObject([6, 7, 8, 9, 10]), '', true)); |
|
2926 | - $this->assertFalse($constraint->evaluate(new \ArrayObject([1, 2, 3, 4]), '', true)); |
|
2927 | - } |
|
2925 | + $this->assertTrue($constraint->evaluate(new \ArrayObject([6, 7, 8, 9, 10]), '', true)); |
|
2926 | + $this->assertFalse($constraint->evaluate(new \ArrayObject([1, 2, 3, 4]), '', true)); |
|
2927 | + } |
|
2928 | 2928 | |
2929 | - public function testConstraintSameSizeFailing() |
|
2930 | - { |
|
2931 | - $constraint = new SameSize([1, 2, 3, 4, 5]); |
|
2929 | + public function testConstraintSameSizeFailing() |
|
2930 | + { |
|
2931 | + $constraint = new SameSize([1, 2, 3, 4, 5]); |
|
2932 | 2932 | |
2933 | - try { |
|
2934 | - $constraint->evaluate([1, 2]); |
|
2935 | - } catch (ExpectationFailedException $e) { |
|
2936 | - $this->assertEquals( |
|
2937 | - <<<EOF |
|
2933 | + try { |
|
2934 | + $constraint->evaluate([1, 2]); |
|
2935 | + } catch (ExpectationFailedException $e) { |
|
2936 | + $this->assertEquals( |
|
2937 | + <<<EOF |
|
2938 | 2938 | Failed asserting that actual size 2 matches expected size 5. |
2939 | 2939 | |
2940 | 2940 | EOF |
2941 | - , |
|
2942 | - TestFailure::exceptionToString($e) |
|
2943 | - ); |
|
2941 | + , |
|
2942 | + TestFailure::exceptionToString($e) |
|
2943 | + ); |
|
2944 | 2944 | |
2945 | - return; |
|
2946 | - } |
|
2945 | + return; |
|
2946 | + } |
|
2947 | 2947 | |
2948 | - $this->fail(); |
|
2949 | - } |
|
2948 | + $this->fail(); |
|
2949 | + } |
|
2950 | 2950 | |
2951 | - public function testConstraintNotSameSizeFailing() |
|
2952 | - { |
|
2953 | - $constraint = Assert::logicalNot( |
|
2954 | - new SameSize([1, 2]) |
|
2955 | - ); |
|
2951 | + public function testConstraintNotSameSizeFailing() |
|
2952 | + { |
|
2953 | + $constraint = Assert::logicalNot( |
|
2954 | + new SameSize([1, 2]) |
|
2955 | + ); |
|
2956 | 2956 | |
2957 | - try { |
|
2958 | - $constraint->evaluate([3, 4]); |
|
2959 | - } catch (ExpectationFailedException $e) { |
|
2960 | - $this->assertEquals( |
|
2961 | - <<<EOF |
|
2957 | + try { |
|
2958 | + $constraint->evaluate([3, 4]); |
|
2959 | + } catch (ExpectationFailedException $e) { |
|
2960 | + $this->assertEquals( |
|
2961 | + <<<EOF |
|
2962 | 2962 | Failed asserting that actual size 2 does not match expected size 2. |
2963 | 2963 | |
2964 | 2964 | EOF |
2965 | - , |
|
2966 | - TestFailure::exceptionToString($e) |
|
2967 | - ); |
|
2965 | + , |
|
2966 | + TestFailure::exceptionToString($e) |
|
2967 | + ); |
|
2968 | 2968 | |
2969 | - return; |
|
2970 | - } |
|
2969 | + return; |
|
2970 | + } |
|
2971 | 2971 | |
2972 | - $this->fail(); |
|
2973 | - } |
|
2972 | + $this->fail(); |
|
2973 | + } |
|
2974 | 2974 | |
2975 | - public function testConstraintException() |
|
2976 | - { |
|
2977 | - $constraint = new Constraint\Exception('FoobarException'); |
|
2978 | - $exception = new \DummyException('Test'); |
|
2979 | - $stackTrace = Filter::getFilteredStacktrace($exception); |
|
2975 | + public function testConstraintException() |
|
2976 | + { |
|
2977 | + $constraint = new Constraint\Exception('FoobarException'); |
|
2978 | + $exception = new \DummyException('Test'); |
|
2979 | + $stackTrace = Filter::getFilteredStacktrace($exception); |
|
2980 | 2980 | |
2981 | - try { |
|
2982 | - $constraint->evaluate($exception); |
|
2983 | - } catch (ExpectationFailedException $e) { |
|
2984 | - $this->assertEquals( |
|
2985 | - <<<EOF |
|
2981 | + try { |
|
2982 | + $constraint->evaluate($exception); |
|
2983 | + } catch (ExpectationFailedException $e) { |
|
2984 | + $this->assertEquals( |
|
2985 | + <<<EOF |
|
2986 | 2986 | Failed asserting that exception of type "DummyException" matches expected exception "FoobarException". Message was: "Test" at |
2987 | 2987 | $stackTrace. |
2988 | 2988 | |
2989 | 2989 | EOF |
2990 | - , |
|
2991 | - TestFailure::exceptionToString($e) |
|
2992 | - ); |
|
2990 | + , |
|
2991 | + TestFailure::exceptionToString($e) |
|
2992 | + ); |
|
2993 | 2993 | |
2994 | - return; |
|
2995 | - } |
|
2994 | + return; |
|
2995 | + } |
|
2996 | 2996 | |
2997 | - $this->fail(); |
|
2998 | - } |
|
2997 | + $this->fail(); |
|
2998 | + } |
|
2999 | 2999 | |
3000 | - /** |
|
3001 | - * Removes spaces in front of newlines |
|
3002 | - * |
|
3003 | - * @param string $string |
|
3004 | - * |
|
3005 | - * @return string |
|
3006 | - */ |
|
3007 | - private function trimnl($string) |
|
3008 | - { |
|
3009 | - return \preg_replace('/[ ]*\n/', "\n", $string); |
|
3010 | - } |
|
3000 | + /** |
|
3001 | + * Removes spaces in front of newlines |
|
3002 | + * |
|
3003 | + * @param string $string |
|
3004 | + * |
|
3005 | + * @return string |
|
3006 | + */ |
|
3007 | + private function trimnl($string) |
|
3008 | + { |
|
3009 | + return \preg_replace('/[ ]*\n/', "\n", $string); |
|
3010 | + } |
|
3011 | 3011 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | public function testConstraintFileNotExists() |
250 | 250 | { |
251 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
251 | + $file = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR.'ClassWithNonPublicAttributes.php'; |
|
252 | 252 | |
253 | 253 | $constraint = Assert::logicalNot( |
254 | 254 | Assert::fileExists() |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | public function testConstraintFileNotExists2() |
280 | 280 | { |
281 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassWithNonPublicAttributes.php'; |
|
281 | + $file = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR.'ClassWithNonPublicAttributes.php'; |
|
282 | 282 | |
283 | 283 | $constraint = Assert::logicalNot( |
284 | 284 | Assert::fileExists() |
@@ -1524,11 +1524,11 @@ discard block |
||
1524 | 1524 | |
1525 | 1525 | public function testConstraintCallback() |
1526 | 1526 | { |
1527 | - $closureReflect = function ($parameter) { |
|
1527 | + $closureReflect = function($parameter) { |
|
1528 | 1528 | return $parameter; |
1529 | 1529 | }; |
1530 | 1530 | |
1531 | - $closureWithoutParameter = function () { |
|
1531 | + $closureWithoutParameter = function() { |
|
1532 | 1532 | return true; |
1533 | 1533 | }; |
1534 | 1534 | |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | |
1553 | 1553 | public function testConstraintCallbackFailure() |
1554 | 1554 | { |
1555 | - $constraint = Assert::callback(function () { |
|
1555 | + $constraint = Assert::callback(function() { |
|
1556 | 1556 | return false; |
1557 | 1557 | }); |
1558 | 1558 |
@@ -12,225 +12,225 @@ |
||
12 | 12 | |
13 | 13 | class SuiteTest extends TestCase |
14 | 14 | { |
15 | - /** |
|
16 | - * @var TestResult |
|
17 | - */ |
|
18 | - private $result; |
|
19 | - |
|
20 | - protected function setUp() |
|
21 | - { |
|
22 | - $this->result = new TestResult; |
|
23 | - } |
|
24 | - |
|
25 | - public static function suite() |
|
26 | - { |
|
27 | - $suite = new TestSuite; |
|
28 | - |
|
29 | - $suite->addTest(new self('testAddTestSuite')); |
|
30 | - $suite->addTest(new self('testInheritedTests')); |
|
31 | - $suite->addTest(new self('testNoTestCases')); |
|
32 | - $suite->addTest(new self('testNoTestCaseClass')); |
|
33 | - $suite->addTest(new self('testNotExistingTestCase')); |
|
34 | - $suite->addTest(new self('testNotPublicTestCase')); |
|
35 | - $suite->addTest(new self('testNotVoidTestCase')); |
|
36 | - $suite->addTest(new self('testOneTestCase')); |
|
37 | - $suite->addTest(new self('testShadowedTests')); |
|
38 | - $suite->addTest(new self('testBeforeClassAndAfterClassAnnotations')); |
|
39 | - $suite->addTest(new self('testBeforeClassWithDataProviders')); |
|
40 | - $suite->addTest(new self('testBeforeAnnotation')); |
|
41 | - $suite->addTest(new self('testTestWithAnnotation')); |
|
42 | - $suite->addTest(new self('testSkippedTestDataProvider')); |
|
43 | - $suite->addTest(new self('testTestDataProviderDependency')); |
|
44 | - $suite->addTest(new self('testIncompleteTestDataProvider')); |
|
45 | - $suite->addTest(new self('testRequirementsBeforeClassHook')); |
|
46 | - $suite->addTest(new self('testDoNotSkipInheritedClass')); |
|
47 | - |
|
48 | - return $suite; |
|
49 | - } |
|
50 | - |
|
51 | - public function testAddTestSuite() |
|
52 | - { |
|
53 | - $suite = new TestSuite(\OneTestCase::class); |
|
54 | - |
|
55 | - $suite->run($this->result); |
|
15 | + /** |
|
16 | + * @var TestResult |
|
17 | + */ |
|
18 | + private $result; |
|
19 | + |
|
20 | + protected function setUp() |
|
21 | + { |
|
22 | + $this->result = new TestResult; |
|
23 | + } |
|
24 | + |
|
25 | + public static function suite() |
|
26 | + { |
|
27 | + $suite = new TestSuite; |
|
28 | + |
|
29 | + $suite->addTest(new self('testAddTestSuite')); |
|
30 | + $suite->addTest(new self('testInheritedTests')); |
|
31 | + $suite->addTest(new self('testNoTestCases')); |
|
32 | + $suite->addTest(new self('testNoTestCaseClass')); |
|
33 | + $suite->addTest(new self('testNotExistingTestCase')); |
|
34 | + $suite->addTest(new self('testNotPublicTestCase')); |
|
35 | + $suite->addTest(new self('testNotVoidTestCase')); |
|
36 | + $suite->addTest(new self('testOneTestCase')); |
|
37 | + $suite->addTest(new self('testShadowedTests')); |
|
38 | + $suite->addTest(new self('testBeforeClassAndAfterClassAnnotations')); |
|
39 | + $suite->addTest(new self('testBeforeClassWithDataProviders')); |
|
40 | + $suite->addTest(new self('testBeforeAnnotation')); |
|
41 | + $suite->addTest(new self('testTestWithAnnotation')); |
|
42 | + $suite->addTest(new self('testSkippedTestDataProvider')); |
|
43 | + $suite->addTest(new self('testTestDataProviderDependency')); |
|
44 | + $suite->addTest(new self('testIncompleteTestDataProvider')); |
|
45 | + $suite->addTest(new self('testRequirementsBeforeClassHook')); |
|
46 | + $suite->addTest(new self('testDoNotSkipInheritedClass')); |
|
47 | + |
|
48 | + return $suite; |
|
49 | + } |
|
50 | + |
|
51 | + public function testAddTestSuite() |
|
52 | + { |
|
53 | + $suite = new TestSuite(\OneTestCase::class); |
|
54 | + |
|
55 | + $suite->run($this->result); |
|
56 | 56 | |
57 | - $this->assertCount(1, $this->result); |
|
58 | - } |
|
59 | - |
|
60 | - public function testInheritedTests() |
|
61 | - { |
|
62 | - $suite = new TestSuite(\InheritedTestCase::class); |
|
57 | + $this->assertCount(1, $this->result); |
|
58 | + } |
|
59 | + |
|
60 | + public function testInheritedTests() |
|
61 | + { |
|
62 | + $suite = new TestSuite(\InheritedTestCase::class); |
|
63 | 63 | |
64 | - $suite->run($this->result); |
|
64 | + $suite->run($this->result); |
|
65 | 65 | |
66 | - $this->assertTrue($this->result->wasSuccessful()); |
|
67 | - $this->assertCount(2, $this->result); |
|
68 | - } |
|
66 | + $this->assertTrue($this->result->wasSuccessful()); |
|
67 | + $this->assertCount(2, $this->result); |
|
68 | + } |
|
69 | 69 | |
70 | - public function testNoTestCases() |
|
71 | - { |
|
72 | - $suite = new TestSuite(\NoTestCases::class); |
|
70 | + public function testNoTestCases() |
|
71 | + { |
|
72 | + $suite = new TestSuite(\NoTestCases::class); |
|
73 | 73 | |
74 | - $suite->run($this->result); |
|
74 | + $suite->run($this->result); |
|
75 | 75 | |
76 | - $this->assertNotTrue($this->result->wasSuccessful()); |
|
77 | - $this->assertEquals(0, $this->result->failureCount()); |
|
78 | - $this->assertEquals(1, $this->result->warningCount()); |
|
79 | - $this->assertCount(1, $this->result); |
|
80 | - } |
|
76 | + $this->assertNotTrue($this->result->wasSuccessful()); |
|
77 | + $this->assertEquals(0, $this->result->failureCount()); |
|
78 | + $this->assertEquals(1, $this->result->warningCount()); |
|
79 | + $this->assertCount(1, $this->result); |
|
80 | + } |
|
81 | 81 | |
82 | - public function testNoTestCaseClass() |
|
83 | - { |
|
84 | - $this->expectException(Exception::class); |
|
82 | + public function testNoTestCaseClass() |
|
83 | + { |
|
84 | + $this->expectException(Exception::class); |
|
85 | 85 | |
86 | - new TestSuite(\NoTestCaseClass::class); |
|
87 | - } |
|
86 | + new TestSuite(\NoTestCaseClass::class); |
|
87 | + } |
|
88 | 88 | |
89 | - public function testNotExistingTestCase() |
|
90 | - { |
|
91 | - $suite = new self('notExistingMethod'); |
|
89 | + public function testNotExistingTestCase() |
|
90 | + { |
|
91 | + $suite = new self('notExistingMethod'); |
|
92 | 92 | |
93 | - $suite->run($this->result); |
|
93 | + $suite->run($this->result); |
|
94 | 94 | |
95 | - $this->assertEquals(0, $this->result->errorCount()); |
|
96 | - $this->assertEquals(1, $this->result->failureCount()); |
|
97 | - $this->assertCount(1, $this->result); |
|
98 | - } |
|
95 | + $this->assertEquals(0, $this->result->errorCount()); |
|
96 | + $this->assertEquals(1, $this->result->failureCount()); |
|
97 | + $this->assertCount(1, $this->result); |
|
98 | + } |
|
99 | 99 | |
100 | - public function testNotPublicTestCase() |
|
101 | - { |
|
102 | - $suite = new TestSuite(\NotPublicTestCase::class); |
|
100 | + public function testNotPublicTestCase() |
|
101 | + { |
|
102 | + $suite = new TestSuite(\NotPublicTestCase::class); |
|
103 | 103 | |
104 | - $this->assertCount(2, $suite); |
|
105 | - } |
|
104 | + $this->assertCount(2, $suite); |
|
105 | + } |
|
106 | 106 | |
107 | - public function testNotVoidTestCase() |
|
108 | - { |
|
109 | - $suite = new TestSuite(\NotVoidTestCase::class); |
|
107 | + public function testNotVoidTestCase() |
|
108 | + { |
|
109 | + $suite = new TestSuite(\NotVoidTestCase::class); |
|
110 | 110 | |
111 | - $this->assertCount(1, $suite); |
|
112 | - } |
|
111 | + $this->assertCount(1, $suite); |
|
112 | + } |
|
113 | 113 | |
114 | - public function testOneTestCase() |
|
115 | - { |
|
116 | - $suite = new TestSuite(\OneTestCase::class); |
|
114 | + public function testOneTestCase() |
|
115 | + { |
|
116 | + $suite = new TestSuite(\OneTestCase::class); |
|
117 | 117 | |
118 | - $suite->run($this->result); |
|
118 | + $suite->run($this->result); |
|
119 | 119 | |
120 | - $this->assertEquals(0, $this->result->errorCount()); |
|
121 | - $this->assertEquals(0, $this->result->failureCount()); |
|
122 | - $this->assertCount(1, $this->result); |
|
123 | - $this->assertTrue($this->result->wasSuccessful()); |
|
124 | - } |
|
120 | + $this->assertEquals(0, $this->result->errorCount()); |
|
121 | + $this->assertEquals(0, $this->result->failureCount()); |
|
122 | + $this->assertCount(1, $this->result); |
|
123 | + $this->assertTrue($this->result->wasSuccessful()); |
|
124 | + } |
|
125 | 125 | |
126 | - public function testShadowedTests() |
|
127 | - { |
|
128 | - $suite = new TestSuite(\OverrideTestCase::class); |
|
126 | + public function testShadowedTests() |
|
127 | + { |
|
128 | + $suite = new TestSuite(\OverrideTestCase::class); |
|
129 | 129 | |
130 | - $suite->run($this->result); |
|
130 | + $suite->run($this->result); |
|
131 | 131 | |
132 | - $this->assertCount(1, $this->result); |
|
133 | - } |
|
132 | + $this->assertCount(1, $this->result); |
|
133 | + } |
|
134 | 134 | |
135 | - public function testBeforeClassAndAfterClassAnnotations() |
|
136 | - { |
|
137 | - $suite = new TestSuite(\BeforeClassAndAfterClassTest::class); |
|
135 | + public function testBeforeClassAndAfterClassAnnotations() |
|
136 | + { |
|
137 | + $suite = new TestSuite(\BeforeClassAndAfterClassTest::class); |
|
138 | 138 | |
139 | - \BeforeClassAndAfterClassTest::resetProperties(); |
|
140 | - $suite->run($this->result); |
|
139 | + \BeforeClassAndAfterClassTest::resetProperties(); |
|
140 | + $suite->run($this->result); |
|
141 | 141 | |
142 | - $this->assertEquals(1, \BeforeClassAndAfterClassTest::$beforeClassWasRun, '@beforeClass method was not run once for the whole suite.'); |
|
143 | - $this->assertEquals(1, \BeforeClassAndAfterClassTest::$afterClassWasRun, '@afterClass method was not run once for the whole suite.'); |
|
144 | - } |
|
142 | + $this->assertEquals(1, \BeforeClassAndAfterClassTest::$beforeClassWasRun, '@beforeClass method was not run once for the whole suite.'); |
|
143 | + $this->assertEquals(1, \BeforeClassAndAfterClassTest::$afterClassWasRun, '@afterClass method was not run once for the whole suite.'); |
|
144 | + } |
|
145 | 145 | |
146 | - public function testBeforeClassWithDataProviders() |
|
147 | - { |
|
148 | - $suite = new TestSuite(\BeforeClassWithOnlyDataProviderTest::class); |
|
146 | + public function testBeforeClassWithDataProviders() |
|
147 | + { |
|
148 | + $suite = new TestSuite(\BeforeClassWithOnlyDataProviderTest::class); |
|
149 | 149 | |
150 | - \BeforeClassWithOnlyDataProviderTest::resetProperties(); |
|
151 | - $suite->run($this->result); |
|
150 | + \BeforeClassWithOnlyDataProviderTest::resetProperties(); |
|
151 | + $suite->run($this->result); |
|
152 | 152 | |
153 | - $this->assertTrue(\BeforeClassWithOnlyDataProviderTest::$setUpBeforeClassWasCalled, 'setUpBeforeClass method was not run.'); |
|
154 | - $this->assertTrue(\BeforeClassWithOnlyDataProviderTest::$beforeClassWasCalled, '@beforeClass method was not run.'); |
|
155 | - } |
|
153 | + $this->assertTrue(\BeforeClassWithOnlyDataProviderTest::$setUpBeforeClassWasCalled, 'setUpBeforeClass method was not run.'); |
|
154 | + $this->assertTrue(\BeforeClassWithOnlyDataProviderTest::$beforeClassWasCalled, '@beforeClass method was not run.'); |
|
155 | + } |
|
156 | 156 | |
157 | - public function testBeforeAnnotation() |
|
158 | - { |
|
159 | - $test = new TestSuite(\BeforeAndAfterTest::class); |
|
157 | + public function testBeforeAnnotation() |
|
158 | + { |
|
159 | + $test = new TestSuite(\BeforeAndAfterTest::class); |
|
160 | 160 | |
161 | - \BeforeAndAfterTest::resetProperties(); |
|
162 | - $test->run(); |
|
161 | + \BeforeAndAfterTest::resetProperties(); |
|
162 | + $test->run(); |
|
163 | 163 | |
164 | - $this->assertEquals(2, \BeforeAndAfterTest::$beforeWasRun); |
|
165 | - $this->assertEquals(2, \BeforeAndAfterTest::$afterWasRun); |
|
166 | - } |
|
164 | + $this->assertEquals(2, \BeforeAndAfterTest::$beforeWasRun); |
|
165 | + $this->assertEquals(2, \BeforeAndAfterTest::$afterWasRun); |
|
166 | + } |
|
167 | 167 | |
168 | - public function testTestWithAnnotation() |
|
169 | - { |
|
170 | - $test = new TestSuite(\TestWithTest::class); |
|
168 | + public function testTestWithAnnotation() |
|
169 | + { |
|
170 | + $test = new TestSuite(\TestWithTest::class); |
|
171 | 171 | |
172 | - \BeforeAndAfterTest::resetProperties(); |
|
173 | - $result = $test->run(); |
|
172 | + \BeforeAndAfterTest::resetProperties(); |
|
173 | + $result = $test->run(); |
|
174 | 174 | |
175 | - $this->assertCount(4, $result->passed()); |
|
176 | - } |
|
175 | + $this->assertCount(4, $result->passed()); |
|
176 | + } |
|
177 | 177 | |
178 | - public function testSkippedTestDataProvider() |
|
179 | - { |
|
180 | - $suite = new TestSuite(\DataProviderSkippedTest::class); |
|
178 | + public function testSkippedTestDataProvider() |
|
179 | + { |
|
180 | + $suite = new TestSuite(\DataProviderSkippedTest::class); |
|
181 | 181 | |
182 | - $suite->run($this->result); |
|
182 | + $suite->run($this->result); |
|
183 | 183 | |
184 | - $this->assertEquals(3, $this->result->count()); |
|
185 | - $this->assertEquals(1, $this->result->skippedCount()); |
|
186 | - } |
|
184 | + $this->assertEquals(3, $this->result->count()); |
|
185 | + $this->assertEquals(1, $this->result->skippedCount()); |
|
186 | + } |
|
187 | 187 | |
188 | - public function testTestDataProviderDependency() |
|
189 | - { |
|
190 | - $suite = new TestSuite(\DataProviderDependencyTest::class); |
|
188 | + public function testTestDataProviderDependency() |
|
189 | + { |
|
190 | + $suite = new TestSuite(\DataProviderDependencyTest::class); |
|
191 | 191 | |
192 | - $suite->run($this->result); |
|
192 | + $suite->run($this->result); |
|
193 | 193 | |
194 | - $skipped = $this->result->skipped(); |
|
195 | - $lastSkippedResult = \array_pop($skipped); |
|
196 | - $message = $lastSkippedResult->thrownException()->getMessage(); |
|
194 | + $skipped = $this->result->skipped(); |
|
195 | + $lastSkippedResult = \array_pop($skipped); |
|
196 | + $message = $lastSkippedResult->thrownException()->getMessage(); |
|
197 | 197 | |
198 | - $this->assertContains('Test for DataProviderDependencyTest::testDependency skipped by data provider', $message); |
|
199 | - } |
|
198 | + $this->assertContains('Test for DataProviderDependencyTest::testDependency skipped by data provider', $message); |
|
199 | + } |
|
200 | 200 | |
201 | - public function testIncompleteTestDataProvider() |
|
202 | - { |
|
203 | - $suite = new TestSuite(\DataProviderIncompleteTest::class); |
|
201 | + public function testIncompleteTestDataProvider() |
|
202 | + { |
|
203 | + $suite = new TestSuite(\DataProviderIncompleteTest::class); |
|
204 | 204 | |
205 | - $suite->run($this->result); |
|
205 | + $suite->run($this->result); |
|
206 | 206 | |
207 | - $this->assertEquals(3, $this->result->count()); |
|
208 | - $this->assertEquals(1, $this->result->notImplementedCount()); |
|
209 | - } |
|
207 | + $this->assertEquals(3, $this->result->count()); |
|
208 | + $this->assertEquals(1, $this->result->notImplementedCount()); |
|
209 | + } |
|
210 | 210 | |
211 | - public function testRequirementsBeforeClassHook() |
|
212 | - { |
|
213 | - $suite = new TestSuite(\RequirementsClassBeforeClassHookTest::class); |
|
211 | + public function testRequirementsBeforeClassHook() |
|
212 | + { |
|
213 | + $suite = new TestSuite(\RequirementsClassBeforeClassHookTest::class); |
|
214 | 214 | |
215 | - $suite->run($this->result); |
|
215 | + $suite->run($this->result); |
|
216 | 216 | |
217 | - $this->assertEquals(0, $this->result->errorCount()); |
|
218 | - $this->assertEquals(1, $this->result->skippedCount()); |
|
219 | - } |
|
217 | + $this->assertEquals(0, $this->result->errorCount()); |
|
218 | + $this->assertEquals(1, $this->result->skippedCount()); |
|
219 | + } |
|
220 | 220 | |
221 | - public function testDoNotSkipInheritedClass() |
|
222 | - { |
|
223 | - $suite = new TestSuite( |
|
224 | - 'DontSkipInheritedClass' |
|
225 | - ); |
|
221 | + public function testDoNotSkipInheritedClass() |
|
222 | + { |
|
223 | + $suite = new TestSuite( |
|
224 | + 'DontSkipInheritedClass' |
|
225 | + ); |
|
226 | 226 | |
227 | - $dir = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Inheritance' . DIRECTORY_SEPARATOR; |
|
227 | + $dir = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Inheritance' . DIRECTORY_SEPARATOR; |
|
228 | 228 | |
229 | - $suite->addTestFile($dir . 'InheritanceA.php'); |
|
230 | - $suite->addTestFile($dir . 'InheritanceB.php'); |
|
229 | + $suite->addTestFile($dir . 'InheritanceA.php'); |
|
230 | + $suite->addTestFile($dir . 'InheritanceB.php'); |
|
231 | 231 | |
232 | - $result = $suite->run(); |
|
232 | + $result = $suite->run(); |
|
233 | 233 | |
234 | - $this->assertCount(2, $result); |
|
235 | - } |
|
234 | + $this->assertCount(2, $result); |
|
235 | + } |
|
236 | 236 | } |
@@ -224,10 +224,10 @@ |
||
224 | 224 | 'DontSkipInheritedClass' |
225 | 225 | ); |
226 | 226 | |
227 | - $dir = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Inheritance' . DIRECTORY_SEPARATOR; |
|
227 | + $dir = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR.'Inheritance'.DIRECTORY_SEPARATOR; |
|
228 | 228 | |
229 | - $suite->addTestFile($dir . 'InheritanceA.php'); |
|
230 | - $suite->addTestFile($dir . 'InheritanceB.php'); |
|
229 | + $suite->addTestFile($dir.'InheritanceA.php'); |
|
230 | + $suite->addTestFile($dir.'InheritanceB.php'); |
|
231 | 231 | |
232 | 232 | $result = $suite->run(); |
233 | 233 |
@@ -14,705 +14,705 @@ |
||
14 | 14 | |
15 | 15 | class TestCaseTest extends TestCase |
16 | 16 | { |
17 | - protected $backupGlobalsBlacklist = ['i', 'singleton']; |
|
18 | - |
|
19 | - protected static $testStatic = 0; |
|
20 | - |
|
21 | - public static function setUpBeforeClass() |
|
22 | - { |
|
23 | - $GLOBALS['a'] = 'a'; |
|
24 | - $_ENV['b'] = 'b'; |
|
25 | - $_POST['c'] = 'c'; |
|
26 | - $_GET['d'] = 'd'; |
|
27 | - $_COOKIE['e'] = 'e'; |
|
28 | - $_SERVER['f'] = 'f'; |
|
29 | - $_FILES['g'] = 'g'; |
|
30 | - $_REQUEST['h'] = 'h'; |
|
31 | - $GLOBALS['i'] = 'i'; |
|
32 | - } |
|
33 | - |
|
34 | - public static function tearDownAfterClass() |
|
35 | - { |
|
36 | - unset( |
|
37 | - $GLOBALS['a'], |
|
38 | - $_ENV['b'], |
|
39 | - $_POST['c'], |
|
40 | - $_GET['d'], |
|
41 | - $_COOKIE['e'], |
|
42 | - $_SERVER['f'], |
|
43 | - $_FILES['g'], |
|
44 | - $_REQUEST['h'], |
|
45 | - $GLOBALS['i'] |
|
46 | - ); |
|
47 | - } |
|
48 | - |
|
49 | - public function testCaseToString() |
|
50 | - { |
|
51 | - $this->assertEquals( |
|
52 | - 'PHPUnit\Framework\TestCaseTest::testCaseToString', |
|
53 | - $this->toString() |
|
54 | - ); |
|
55 | - } |
|
56 | - |
|
57 | - public function testSuccess() |
|
58 | - { |
|
59 | - $test = new \Success; |
|
60 | - $result = $test->run(); |
|
61 | - |
|
62 | - $this->assertEquals(BaseTestRunner::STATUS_PASSED, $test->getStatus()); |
|
63 | - $this->assertEquals(0, $result->errorCount()); |
|
64 | - $this->assertEquals(0, $result->failureCount()); |
|
65 | - $this->assertEquals(0, $result->skippedCount()); |
|
66 | - $this->assertCount(1, $result); |
|
67 | - } |
|
68 | - |
|
69 | - public function testFailure() |
|
70 | - { |
|
71 | - $test = new \Failure; |
|
72 | - $result = $test->run(); |
|
73 | - |
|
74 | - $this->assertEquals(BaseTestRunner::STATUS_FAILURE, $test->getStatus()); |
|
75 | - $this->assertEquals(0, $result->errorCount()); |
|
76 | - $this->assertEquals(1, $result->failureCount()); |
|
77 | - $this->assertEquals(0, $result->skippedCount()); |
|
78 | - $this->assertCount(1, $result); |
|
79 | - } |
|
80 | - |
|
81 | - public function testError() |
|
82 | - { |
|
83 | - $test = new \TestError; |
|
84 | - $result = $test->run(); |
|
85 | - |
|
86 | - $this->assertEquals(BaseTestRunner::STATUS_ERROR, $test->getStatus()); |
|
87 | - $this->assertEquals(1, $result->errorCount()); |
|
88 | - $this->assertEquals(0, $result->failureCount()); |
|
89 | - $this->assertEquals(0, $result->skippedCount()); |
|
90 | - $this->assertCount(1, $result); |
|
91 | - } |
|
92 | - |
|
93 | - public function testSkipped() |
|
94 | - { |
|
95 | - $test = new \TestSkipped; |
|
96 | - $result = $test->run(); |
|
97 | - |
|
98 | - $this->assertEquals(BaseTestRunner::STATUS_SKIPPED, $test->getStatus()); |
|
99 | - $this->assertEquals('Skipped test', $test->getStatusMessage()); |
|
100 | - $this->assertEquals(0, $result->errorCount()); |
|
101 | - $this->assertEquals(0, $result->failureCount()); |
|
102 | - $this->assertEquals(1, $result->skippedCount()); |
|
103 | - $this->assertCount(1, $result); |
|
104 | - } |
|
105 | - |
|
106 | - public function testIncomplete() |
|
107 | - { |
|
108 | - $test = new \TestIncomplete; |
|
109 | - $result = $test->run(); |
|
110 | - |
|
111 | - $this->assertEquals(BaseTestRunner::STATUS_INCOMPLETE, $test->getStatus()); |
|
112 | - $this->assertEquals('Incomplete test', $test->getStatusMessage()); |
|
113 | - $this->assertEquals(0, $result->errorCount()); |
|
114 | - $this->assertEquals(0, $result->failureCount()); |
|
115 | - $this->assertEquals(0, $result->skippedCount()); |
|
116 | - $this->assertCount(1, $result); |
|
117 | - } |
|
118 | - |
|
119 | - public function testExceptionInSetUp() |
|
120 | - { |
|
121 | - $test = new \ExceptionInSetUpTest('testSomething'); |
|
122 | - $test->run(); |
|
123 | - |
|
124 | - $this->assertTrue($test->setUp); |
|
125 | - $this->assertFalse($test->assertPreConditions); |
|
126 | - $this->assertFalse($test->testSomething); |
|
127 | - $this->assertFalse($test->assertPostConditions); |
|
128 | - $this->assertTrue($test->tearDown); |
|
129 | - } |
|
130 | - |
|
131 | - public function testExceptionInAssertPreConditions() |
|
132 | - { |
|
133 | - $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
134 | - $test->run(); |
|
135 | - |
|
136 | - $this->assertTrue($test->setUp); |
|
137 | - $this->assertTrue($test->assertPreConditions); |
|
138 | - $this->assertFalse($test->testSomething); |
|
139 | - $this->assertFalse($test->assertPostConditions); |
|
140 | - $this->assertTrue($test->tearDown); |
|
141 | - } |
|
142 | - |
|
143 | - public function testExceptionInTest() |
|
144 | - { |
|
145 | - $test = new \ExceptionInTest('testSomething'); |
|
146 | - $test->run(); |
|
147 | - |
|
148 | - $this->assertTrue($test->setUp); |
|
149 | - $this->assertTrue($test->assertPreConditions); |
|
150 | - $this->assertTrue($test->testSomething); |
|
151 | - $this->assertFalse($test->assertPostConditions); |
|
152 | - $this->assertTrue($test->tearDown); |
|
153 | - } |
|
154 | - |
|
155 | - public function testExceptionInAssertPostConditions() |
|
156 | - { |
|
157 | - $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
158 | - $test->run(); |
|
159 | - |
|
160 | - $this->assertTrue($test->setUp); |
|
161 | - $this->assertTrue($test->assertPreConditions); |
|
162 | - $this->assertTrue($test->testSomething); |
|
163 | - $this->assertTrue($test->assertPostConditions); |
|
164 | - $this->assertTrue($test->tearDown); |
|
165 | - } |
|
166 | - |
|
167 | - public function testExceptionInTearDown() |
|
168 | - { |
|
169 | - $test = new \ExceptionInTearDownTest('testSomething'); |
|
170 | - $test->run(); |
|
171 | - |
|
172 | - $this->assertTrue($test->setUp); |
|
173 | - $this->assertTrue($test->assertPreConditions); |
|
174 | - $this->assertTrue($test->testSomething); |
|
175 | - $this->assertTrue($test->assertPostConditions); |
|
176 | - $this->assertTrue($test->tearDown); |
|
177 | - } |
|
178 | - |
|
179 | - public function testNoArgTestCasePasses() |
|
180 | - { |
|
181 | - $result = new TestResult; |
|
182 | - $t = new TestSuite(\NoArgTestCaseTest::class); |
|
183 | - |
|
184 | - $t->run($result); |
|
185 | - |
|
186 | - $this->assertCount(1, $result); |
|
187 | - $this->assertEquals(0, $result->failureCount()); |
|
188 | - $this->assertEquals(0, $result->errorCount()); |
|
189 | - } |
|
190 | - |
|
191 | - public function testWasRun() |
|
192 | - { |
|
193 | - $test = new \WasRun; |
|
194 | - $test->run(); |
|
195 | - |
|
196 | - $this->assertTrue($test->wasRun); |
|
197 | - } |
|
198 | - |
|
199 | - public function testException() |
|
200 | - { |
|
201 | - $test = new \ThrowExceptionTestCase('test'); |
|
202 | - $test->expectException(\RuntimeException::class); |
|
203 | - |
|
204 | - $result = $test->run(); |
|
205 | - |
|
206 | - $this->assertCount(1, $result); |
|
207 | - $this->assertTrue($result->wasSuccessful()); |
|
208 | - } |
|
209 | - |
|
210 | - public function testExceptionWithEmptyMessage() |
|
211 | - { |
|
212 | - $test = new \ThrowExceptionTestCase('test'); |
|
213 | - $test->expectException(\RuntimeException::class); |
|
214 | - |
|
215 | - $result = $test->run(); |
|
216 | - |
|
217 | - $this->assertCount(1, $result); |
|
218 | - $this->assertTrue($result->wasSuccessful()); |
|
219 | - } |
|
220 | - |
|
221 | - public function testExceptionWithNullMessage() |
|
222 | - { |
|
223 | - $test = new \ThrowExceptionTestCase('test'); |
|
224 | - $test->expectException(\RuntimeException::class); |
|
225 | - |
|
226 | - $result = $test->run(); |
|
227 | - |
|
228 | - $this->assertCount(1, $result); |
|
229 | - $this->assertTrue($result->wasSuccessful()); |
|
230 | - } |
|
231 | - |
|
232 | - public function testExceptionWithMessage() |
|
233 | - { |
|
234 | - $test = new \ThrowExceptionTestCase('test'); |
|
235 | - $test->expectException(\RuntimeException::class); |
|
236 | - $test->expectExceptionMessage('A runtime error occurred'); |
|
237 | - |
|
238 | - $result = $test->run(); |
|
239 | - |
|
240 | - $this->assertCount(1, $result); |
|
241 | - $this->assertTrue($result->wasSuccessful()); |
|
242 | - } |
|
243 | - |
|
244 | - public function testExceptionWithWrongMessage() |
|
245 | - { |
|
246 | - $test = new \ThrowExceptionTestCase('test'); |
|
247 | - $test->expectException(\RuntimeException::class); |
|
248 | - $test->expectExceptionMessage('A logic error occurred'); |
|
249 | - |
|
250 | - $result = $test->run(); |
|
251 | - |
|
252 | - $this->assertEquals(1, $result->failureCount()); |
|
253 | - $this->assertCount(1, $result); |
|
254 | - $this->assertEquals( |
|
255 | - "Failed asserting that exception message 'A runtime error occurred' contains 'A logic error occurred'.", |
|
256 | - $test->getStatusMessage() |
|
257 | - ); |
|
258 | - } |
|
259 | - |
|
260 | - public function testExceptionWithRegexpMessage() |
|
261 | - { |
|
262 | - $test = new \ThrowExceptionTestCase('test'); |
|
263 | - $test->expectException(\RuntimeException::class); |
|
264 | - $test->expectExceptionMessageRegExp('/runtime .*? occurred/'); |
|
265 | - |
|
266 | - $result = $test->run(); |
|
267 | - |
|
268 | - $this->assertCount(1, $result); |
|
269 | - $this->assertTrue($result->wasSuccessful()); |
|
270 | - } |
|
271 | - |
|
272 | - public function testExceptionWithWrongRegexpMessage() |
|
273 | - { |
|
274 | - $test = new \ThrowExceptionTestCase('test'); |
|
275 | - $test->expectException(\RuntimeException::class); |
|
276 | - $test->expectExceptionMessageRegExp('/logic .*? occurred/'); |
|
277 | - |
|
278 | - $result = $test->run(); |
|
279 | - |
|
280 | - $this->assertEquals(1, $result->failureCount()); |
|
281 | - $this->assertCount(1, $result); |
|
282 | - $this->assertEquals( |
|
283 | - "Failed asserting that exception message 'A runtime error occurred' matches '/logic .*? occurred/'.", |
|
284 | - $test->getStatusMessage() |
|
285 | - ); |
|
286 | - } |
|
287 | - |
|
288 | - public function testExceptionWithInvalidRegexpMessage() |
|
289 | - { |
|
290 | - $test = new \ThrowExceptionTestCase('test'); |
|
291 | - $test->expectException(\RuntimeException::class); |
|
292 | - $test->expectExceptionMessageRegExp('#runtime .*? occurred/'); |
|
293 | - |
|
294 | - $test->run(); |
|
295 | - |
|
296 | - $this->assertEquals( |
|
297 | - "Invalid expected exception message regex given: '#runtime .*? occurred/'", |
|
298 | - $test->getStatusMessage() |
|
299 | - ); |
|
300 | - } |
|
301 | - |
|
302 | - public function testNoException() |
|
303 | - { |
|
304 | - $test = new \ThrowNoExceptionTestCase('test'); |
|
305 | - $test->expectException(\RuntimeException::class); |
|
306 | - |
|
307 | - $result = $test->run(); |
|
308 | - |
|
309 | - $this->assertEquals(1, $result->failureCount()); |
|
310 | - $this->assertCount(1, $result); |
|
311 | - } |
|
312 | - |
|
313 | - public function testWrongException() |
|
314 | - { |
|
315 | - $test = new \ThrowExceptionTestCase('test'); |
|
316 | - $test->expectException(\InvalidArgumentException::class); |
|
317 | - |
|
318 | - $result = $test->run(); |
|
319 | - |
|
320 | - $this->assertEquals(1, $result->failureCount()); |
|
321 | - $this->assertCount(1, $result); |
|
322 | - } |
|
323 | - |
|
324 | - /** |
|
325 | - * @backupGlobals enabled |
|
326 | - */ |
|
327 | - public function testGlobalsBackupPre() |
|
328 | - { |
|
329 | - global $a; |
|
330 | - global $i; |
|
331 | - |
|
332 | - $this->assertEquals('a', $a); |
|
333 | - $this->assertEquals('a', $GLOBALS['a']); |
|
334 | - $this->assertEquals('b', $_ENV['b']); |
|
335 | - $this->assertEquals('c', $_POST['c']); |
|
336 | - $this->assertEquals('d', $_GET['d']); |
|
337 | - $this->assertEquals('e', $_COOKIE['e']); |
|
338 | - $this->assertEquals('f', $_SERVER['f']); |
|
339 | - $this->assertEquals('g', $_FILES['g']); |
|
340 | - $this->assertEquals('h', $_REQUEST['h']); |
|
341 | - $this->assertEquals('i', $i); |
|
342 | - $this->assertEquals('i', $GLOBALS['i']); |
|
343 | - |
|
344 | - $GLOBALS['a'] = 'aa'; |
|
345 | - $GLOBALS['foo'] = 'bar'; |
|
346 | - $_ENV['b'] = 'bb'; |
|
347 | - $_POST['c'] = 'cc'; |
|
348 | - $_GET['d'] = 'dd'; |
|
349 | - $_COOKIE['e'] = 'ee'; |
|
350 | - $_SERVER['f'] = 'ff'; |
|
351 | - $_FILES['g'] = 'gg'; |
|
352 | - $_REQUEST['h'] = 'hh'; |
|
353 | - $GLOBALS['i'] = 'ii'; |
|
354 | - |
|
355 | - $this->assertEquals('aa', $a); |
|
356 | - $this->assertEquals('aa', $GLOBALS['a']); |
|
357 | - $this->assertEquals('bar', $GLOBALS['foo']); |
|
358 | - $this->assertEquals('bb', $_ENV['b']); |
|
359 | - $this->assertEquals('cc', $_POST['c']); |
|
360 | - $this->assertEquals('dd', $_GET['d']); |
|
361 | - $this->assertEquals('ee', $_COOKIE['e']); |
|
362 | - $this->assertEquals('ff', $_SERVER['f']); |
|
363 | - $this->assertEquals('gg', $_FILES['g']); |
|
364 | - $this->assertEquals('hh', $_REQUEST['h']); |
|
365 | - $this->assertEquals('ii', $i); |
|
366 | - $this->assertEquals('ii', $GLOBALS['i']); |
|
367 | - } |
|
368 | - |
|
369 | - public function testGlobalsBackupPost() |
|
370 | - { |
|
371 | - global $a; |
|
372 | - global $i; |
|
373 | - |
|
374 | - $this->assertEquals('a', $a); |
|
375 | - $this->assertEquals('a', $GLOBALS['a']); |
|
376 | - $this->assertEquals('b', $_ENV['b']); |
|
377 | - $this->assertEquals('c', $_POST['c']); |
|
378 | - $this->assertEquals('d', $_GET['d']); |
|
379 | - $this->assertEquals('e', $_COOKIE['e']); |
|
380 | - $this->assertEquals('f', $_SERVER['f']); |
|
381 | - $this->assertEquals('g', $_FILES['g']); |
|
382 | - $this->assertEquals('h', $_REQUEST['h']); |
|
383 | - $this->assertEquals('ii', $i); |
|
384 | - $this->assertEquals('ii', $GLOBALS['i']); |
|
385 | - |
|
386 | - $this->assertArrayNotHasKey('foo', $GLOBALS); |
|
387 | - } |
|
388 | - |
|
389 | - /** |
|
390 | - * @backupGlobals enabled |
|
391 | - * @backupStaticAttributes enabled |
|
392 | - * |
|
393 | - * @doesNotPerformAssertions |
|
394 | - */ |
|
395 | - public function testStaticAttributesBackupPre() |
|
396 | - { |
|
397 | - $GLOBALS['singleton'] = \Singleton::getInstance(); |
|
398 | - self::$testStatic = 123; |
|
399 | - } |
|
400 | - |
|
401 | - /** |
|
402 | - * @depends testStaticAttributesBackupPre |
|
403 | - */ |
|
404 | - public function testStaticAttributesBackupPost() |
|
405 | - { |
|
406 | - $this->assertNotSame($GLOBALS['singleton'], \Singleton::getInstance()); |
|
407 | - $this->assertSame(0, self::$testStatic); |
|
408 | - } |
|
409 | - |
|
410 | - public function testIsInIsolationReturnsFalse() |
|
411 | - { |
|
412 | - $test = new \IsolationTest('testIsInIsolationReturnsFalse'); |
|
413 | - $result = $test->run(); |
|
414 | - |
|
415 | - $this->assertCount(1, $result); |
|
416 | - $this->assertTrue($result->wasSuccessful()); |
|
417 | - } |
|
418 | - |
|
419 | - public function testIsInIsolationReturnsTrue() |
|
420 | - { |
|
421 | - $test = new \IsolationTest('testIsInIsolationReturnsTrue'); |
|
422 | - $test->setRunTestInSeparateProcess(true); |
|
423 | - $result = $test->run(); |
|
424 | - |
|
425 | - $this->assertCount(1, $result); |
|
426 | - $this->assertTrue($result->wasSuccessful()); |
|
427 | - } |
|
428 | - |
|
429 | - public function testExpectOutputStringFooActualFoo() |
|
430 | - { |
|
431 | - $test = new \OutputTestCase('testExpectOutputStringFooActualFoo'); |
|
432 | - $result = $test->run(); |
|
433 | - |
|
434 | - $this->assertCount(1, $result); |
|
435 | - $this->assertTrue($result->wasSuccessful()); |
|
436 | - } |
|
437 | - |
|
438 | - public function testExpectOutputStringFooActualBar() |
|
439 | - { |
|
440 | - $test = new \OutputTestCase('testExpectOutputStringFooActualBar'); |
|
441 | - $result = $test->run(); |
|
442 | - |
|
443 | - $this->assertCount(1, $result); |
|
444 | - $this->assertFalse($result->wasSuccessful()); |
|
445 | - } |
|
446 | - |
|
447 | - public function testExpectOutputRegexFooActualFoo() |
|
448 | - { |
|
449 | - $test = new \OutputTestCase('testExpectOutputRegexFooActualFoo'); |
|
450 | - $result = $test->run(); |
|
451 | - |
|
452 | - $this->assertCount(1, $result); |
|
453 | - $this->assertTrue($result->wasSuccessful()); |
|
454 | - } |
|
455 | - |
|
456 | - public function testExpectOutputRegexFooActualBar() |
|
457 | - { |
|
458 | - $test = new \OutputTestCase('testExpectOutputRegexFooActualBar'); |
|
459 | - $result = $test->run(); |
|
460 | - |
|
461 | - $this->assertCount(1, $result); |
|
462 | - $this->assertFalse($result->wasSuccessful()); |
|
463 | - } |
|
464 | - |
|
465 | - public function testSkipsIfRequiresHigherVersionOfPHPUnit() |
|
466 | - { |
|
467 | - $test = new \RequirementsTest('testAlwaysSkip'); |
|
468 | - $result = $test->run(); |
|
469 | - |
|
470 | - $this->assertEquals(1, $result->skippedCount()); |
|
471 | - $this->assertEquals( |
|
472 | - 'PHPUnit >= 1111111 is required.', |
|
473 | - $test->getStatusMessage() |
|
474 | - ); |
|
475 | - } |
|
476 | - |
|
477 | - public function testSkipsIfRequiresHigherVersionOfPHP() |
|
478 | - { |
|
479 | - $test = new \RequirementsTest('testAlwaysSkip2'); |
|
480 | - $result = $test->run(); |
|
481 | - |
|
482 | - $this->assertEquals(1, $result->skippedCount()); |
|
483 | - $this->assertEquals( |
|
484 | - 'PHP >= 9999999 is required.', |
|
485 | - $test->getStatusMessage() |
|
486 | - ); |
|
487 | - } |
|
488 | - |
|
489 | - public function testSkipsIfRequiresNonExistingOs() |
|
490 | - { |
|
491 | - $test = new \RequirementsTest('testAlwaysSkip3'); |
|
492 | - $result = $test->run(); |
|
493 | - |
|
494 | - $this->assertEquals(1, $result->skippedCount()); |
|
495 | - $this->assertEquals( |
|
496 | - 'Operating system matching /DOESNOTEXIST/i is required.', |
|
497 | - $test->getStatusMessage() |
|
498 | - ); |
|
499 | - } |
|
500 | - |
|
501 | - public function testSkipsIfRequiresNonExistingOsFamily() |
|
502 | - { |
|
503 | - $test = new \RequirementsTest('testAlwaysSkip4'); |
|
504 | - $result = $test->run(); |
|
505 | - |
|
506 | - $this->assertEquals(1, $result->skippedCount()); |
|
507 | - $this->assertEquals( |
|
508 | - 'Operating system DOESNOTEXIST is required.', |
|
509 | - $test->getStatusMessage() |
|
510 | - ); |
|
511 | - } |
|
512 | - |
|
513 | - public function testSkipsIfRequiresNonExistingFunction() |
|
514 | - { |
|
515 | - $test = new \RequirementsTest('testNine'); |
|
516 | - $result = $test->run(); |
|
517 | - |
|
518 | - $this->assertEquals(1, $result->skippedCount()); |
|
519 | - $this->assertEquals( |
|
520 | - 'Function testFunc is required.', |
|
521 | - $test->getStatusMessage() |
|
522 | - ); |
|
523 | - } |
|
524 | - |
|
525 | - public function testSkipsIfRequiresNonExistingExtension() |
|
526 | - { |
|
527 | - $test = new \RequirementsTest('testTen'); |
|
528 | - $test->run(); |
|
529 | - |
|
530 | - $this->assertEquals( |
|
531 | - 'Extension testExt is required.', |
|
532 | - $test->getStatusMessage() |
|
533 | - ); |
|
534 | - } |
|
535 | - |
|
536 | - public function testSkipsIfRequiresExtensionWithAMinimumVersion() |
|
537 | - { |
|
538 | - $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
539 | - $test->run(); |
|
540 | - |
|
541 | - $this->assertEquals( |
|
542 | - 'Extension testExt >= 1.8.0 is required.', |
|
543 | - $test->getStatusMessage() |
|
544 | - ); |
|
545 | - } |
|
546 | - |
|
547 | - public function testSkipsProvidesMessagesForAllSkippingReasons() |
|
548 | - { |
|
549 | - $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
550 | - $test->run(); |
|
551 | - |
|
552 | - $this->assertEquals( |
|
553 | - 'PHP >= 99-dev is required.' . PHP_EOL . |
|
554 | - 'PHPUnit >= 9-dev is required.' . PHP_EOL . |
|
555 | - 'Operating system matching /DOESNOTEXIST/i is required.' . PHP_EOL . |
|
556 | - 'Function testFuncOne is required.' . PHP_EOL . |
|
557 | - 'Function testFuncTwo is required.' . PHP_EOL . |
|
558 | - 'Extension testExtOne is required.' . PHP_EOL . |
|
559 | - 'Extension testExtTwo is required.' . PHP_EOL . |
|
560 | - 'Extension testExtThree >= 2.0 is required.', |
|
561 | - $test->getStatusMessage() |
|
562 | - ); |
|
563 | - } |
|
564 | - |
|
565 | - public function testRequiringAnExistingMethodDoesNotSkip() |
|
566 | - { |
|
567 | - $test = new \RequirementsTest('testExistingMethod'); |
|
568 | - $result = $test->run(); |
|
569 | - $this->assertEquals(0, $result->skippedCount()); |
|
570 | - } |
|
571 | - |
|
572 | - public function testRequiringAnExistingFunctionDoesNotSkip() |
|
573 | - { |
|
574 | - $test = new \RequirementsTest('testExistingFunction'); |
|
575 | - $result = $test->run(); |
|
576 | - $this->assertEquals(0, $result->skippedCount()); |
|
577 | - } |
|
578 | - |
|
579 | - public function testRequiringAnExistingExtensionDoesNotSkip() |
|
580 | - { |
|
581 | - $test = new \RequirementsTest('testExistingExtension'); |
|
582 | - $result = $test->run(); |
|
583 | - $this->assertEquals(0, $result->skippedCount()); |
|
584 | - } |
|
585 | - |
|
586 | - public function testRequiringAnExistingOsDoesNotSkip() |
|
587 | - { |
|
588 | - $test = new \RequirementsTest('testExistingOs'); |
|
589 | - $result = $test->run(); |
|
590 | - $this->assertEquals(0, $result->skippedCount()); |
|
591 | - } |
|
592 | - |
|
593 | - public function testCurrentWorkingDirectoryIsRestored() |
|
594 | - { |
|
595 | - $expectedCwd = \getcwd(); |
|
596 | - |
|
597 | - $test = new \ChangeCurrentWorkingDirectoryTest('testSomethingThatChangesTheCwd'); |
|
598 | - $test->run(); |
|
599 | - |
|
600 | - $this->assertSame($expectedCwd, \getcwd()); |
|
601 | - } |
|
602 | - |
|
603 | - /** |
|
604 | - * @requires PHP 7 |
|
605 | - * @expectedException \TypeError |
|
606 | - */ |
|
607 | - public function testTypeErrorCanBeExpected() |
|
608 | - { |
|
609 | - $o = new \ClassWithScalarTypeDeclarations; |
|
610 | - $o->foo(null, null); |
|
611 | - } |
|
612 | - |
|
613 | - public function testCreateMockFromClassName() |
|
614 | - { |
|
615 | - $mock = $this->createMock(\Mockable::class); |
|
616 | - |
|
617 | - $this->assertInstanceOf(\Mockable::class, $mock); |
|
618 | - $this->assertInstanceOf(\PHPUnit_Framework_MockObject_MockObject::class, $mock); |
|
619 | - } |
|
620 | - |
|
621 | - public function testCreateMockMocksAllMethods() |
|
622 | - { |
|
623 | - /** @var \Mockable $mock */ |
|
624 | - $mock = $this->createMock(\Mockable::class); |
|
625 | - |
|
626 | - $this->assertNull($mock->foo()); |
|
627 | - $this->assertNull($mock->bar()); |
|
628 | - } |
|
629 | - |
|
630 | - public function testCreatePartialMockDoesNotMockAllMethods() |
|
631 | - { |
|
632 | - /** @var \Mockable $mock */ |
|
633 | - $mock = $this->createPartialMock(\Mockable::class, ['foo']); |
|
634 | - |
|
635 | - $this->assertNull($mock->foo()); |
|
636 | - $this->assertTrue($mock->bar()); |
|
637 | - } |
|
638 | - |
|
639 | - public function testCreatePartialMockCanMockNoMethods() |
|
640 | - { |
|
641 | - /** @var \Mockable $mock */ |
|
642 | - $mock = $this->createPartialMock(\Mockable::class, []); |
|
643 | - |
|
644 | - $this->assertTrue($mock->foo()); |
|
645 | - $this->assertTrue($mock->bar()); |
|
646 | - } |
|
647 | - |
|
648 | - public function testCreateMockSkipsConstructor() |
|
649 | - { |
|
650 | - /** @var \Mockable $mock */ |
|
651 | - $mock = $this->createMock(\Mockable::class); |
|
652 | - |
|
653 | - $this->assertFalse($mock->constructorCalled); |
|
654 | - } |
|
655 | - |
|
656 | - public function testCreateMockDisablesOriginalClone() |
|
657 | - { |
|
658 | - /** @var \Mockable $mock */ |
|
659 | - $mock = $this->createMock(\Mockable::class); |
|
660 | - |
|
661 | - $cloned = clone $mock; |
|
662 | - $this->assertFalse($cloned->cloned); |
|
663 | - } |
|
664 | - |
|
665 | - public function testConfiguredMockCanBeCreated() |
|
666 | - { |
|
667 | - /** @var \Mockable $mock */ |
|
668 | - $mock = $this->createConfiguredMock( |
|
669 | - \Mockable::class, |
|
670 | - [ |
|
671 | - 'foo' => false |
|
672 | - ] |
|
673 | - ); |
|
674 | - |
|
675 | - $this->assertFalse($mock->foo()); |
|
676 | - $this->assertNull($mock->bar()); |
|
677 | - } |
|
678 | - |
|
679 | - public function testProvidingOfAutoreferencedArray() |
|
680 | - { |
|
681 | - $test = new \TestAutoreferenced('testJsonEncodeException', $this->getAutoreferencedArray()); |
|
682 | - $test->runBare(); |
|
683 | - |
|
684 | - $this->assertInternalType('array', $test->myTestData); |
|
685 | - $this->assertArrayHasKey('data', $test->myTestData); |
|
686 | - $this->assertEquals($test->myTestData['data'][0], $test->myTestData['data']); |
|
687 | - } |
|
688 | - |
|
689 | - /** |
|
690 | - * @return array<string, array> |
|
691 | - */ |
|
692 | - private function getAutoreferencedArray() |
|
693 | - { |
|
694 | - $recursionData = []; |
|
695 | - $recursionData[] = &$recursionData; |
|
696 | - |
|
697 | - return [ |
|
698 | - 'RECURSION' => [ |
|
699 | - 'data' => $recursionData |
|
700 | - ] |
|
701 | - ]; |
|
702 | - } |
|
703 | - |
|
704 | - public function testProvidingArrayThatMixesObjectsAndScalars() |
|
705 | - { |
|
706 | - $data = [ |
|
707 | - [123], |
|
708 | - ['foo'], |
|
709 | - [$this->createMock(\Mockable::class)], |
|
710 | - ]; |
|
711 | - |
|
712 | - $test = new \TestAutoreferenced('testJsonEncodeException', [$data]); |
|
713 | - $test->runBare(); |
|
714 | - |
|
715 | - $this->assertInternalType('array', $test->myTestData); |
|
716 | - $this->assertSame($data, $test->myTestData); |
|
717 | - } |
|
17 | + protected $backupGlobalsBlacklist = ['i', 'singleton']; |
|
18 | + |
|
19 | + protected static $testStatic = 0; |
|
20 | + |
|
21 | + public static function setUpBeforeClass() |
|
22 | + { |
|
23 | + $GLOBALS['a'] = 'a'; |
|
24 | + $_ENV['b'] = 'b'; |
|
25 | + $_POST['c'] = 'c'; |
|
26 | + $_GET['d'] = 'd'; |
|
27 | + $_COOKIE['e'] = 'e'; |
|
28 | + $_SERVER['f'] = 'f'; |
|
29 | + $_FILES['g'] = 'g'; |
|
30 | + $_REQUEST['h'] = 'h'; |
|
31 | + $GLOBALS['i'] = 'i'; |
|
32 | + } |
|
33 | + |
|
34 | + public static function tearDownAfterClass() |
|
35 | + { |
|
36 | + unset( |
|
37 | + $GLOBALS['a'], |
|
38 | + $_ENV['b'], |
|
39 | + $_POST['c'], |
|
40 | + $_GET['d'], |
|
41 | + $_COOKIE['e'], |
|
42 | + $_SERVER['f'], |
|
43 | + $_FILES['g'], |
|
44 | + $_REQUEST['h'], |
|
45 | + $GLOBALS['i'] |
|
46 | + ); |
|
47 | + } |
|
48 | + |
|
49 | + public function testCaseToString() |
|
50 | + { |
|
51 | + $this->assertEquals( |
|
52 | + 'PHPUnit\Framework\TestCaseTest::testCaseToString', |
|
53 | + $this->toString() |
|
54 | + ); |
|
55 | + } |
|
56 | + |
|
57 | + public function testSuccess() |
|
58 | + { |
|
59 | + $test = new \Success; |
|
60 | + $result = $test->run(); |
|
61 | + |
|
62 | + $this->assertEquals(BaseTestRunner::STATUS_PASSED, $test->getStatus()); |
|
63 | + $this->assertEquals(0, $result->errorCount()); |
|
64 | + $this->assertEquals(0, $result->failureCount()); |
|
65 | + $this->assertEquals(0, $result->skippedCount()); |
|
66 | + $this->assertCount(1, $result); |
|
67 | + } |
|
68 | + |
|
69 | + public function testFailure() |
|
70 | + { |
|
71 | + $test = new \Failure; |
|
72 | + $result = $test->run(); |
|
73 | + |
|
74 | + $this->assertEquals(BaseTestRunner::STATUS_FAILURE, $test->getStatus()); |
|
75 | + $this->assertEquals(0, $result->errorCount()); |
|
76 | + $this->assertEquals(1, $result->failureCount()); |
|
77 | + $this->assertEquals(0, $result->skippedCount()); |
|
78 | + $this->assertCount(1, $result); |
|
79 | + } |
|
80 | + |
|
81 | + public function testError() |
|
82 | + { |
|
83 | + $test = new \TestError; |
|
84 | + $result = $test->run(); |
|
85 | + |
|
86 | + $this->assertEquals(BaseTestRunner::STATUS_ERROR, $test->getStatus()); |
|
87 | + $this->assertEquals(1, $result->errorCount()); |
|
88 | + $this->assertEquals(0, $result->failureCount()); |
|
89 | + $this->assertEquals(0, $result->skippedCount()); |
|
90 | + $this->assertCount(1, $result); |
|
91 | + } |
|
92 | + |
|
93 | + public function testSkipped() |
|
94 | + { |
|
95 | + $test = new \TestSkipped; |
|
96 | + $result = $test->run(); |
|
97 | + |
|
98 | + $this->assertEquals(BaseTestRunner::STATUS_SKIPPED, $test->getStatus()); |
|
99 | + $this->assertEquals('Skipped test', $test->getStatusMessage()); |
|
100 | + $this->assertEquals(0, $result->errorCount()); |
|
101 | + $this->assertEquals(0, $result->failureCount()); |
|
102 | + $this->assertEquals(1, $result->skippedCount()); |
|
103 | + $this->assertCount(1, $result); |
|
104 | + } |
|
105 | + |
|
106 | + public function testIncomplete() |
|
107 | + { |
|
108 | + $test = new \TestIncomplete; |
|
109 | + $result = $test->run(); |
|
110 | + |
|
111 | + $this->assertEquals(BaseTestRunner::STATUS_INCOMPLETE, $test->getStatus()); |
|
112 | + $this->assertEquals('Incomplete test', $test->getStatusMessage()); |
|
113 | + $this->assertEquals(0, $result->errorCount()); |
|
114 | + $this->assertEquals(0, $result->failureCount()); |
|
115 | + $this->assertEquals(0, $result->skippedCount()); |
|
116 | + $this->assertCount(1, $result); |
|
117 | + } |
|
118 | + |
|
119 | + public function testExceptionInSetUp() |
|
120 | + { |
|
121 | + $test = new \ExceptionInSetUpTest('testSomething'); |
|
122 | + $test->run(); |
|
123 | + |
|
124 | + $this->assertTrue($test->setUp); |
|
125 | + $this->assertFalse($test->assertPreConditions); |
|
126 | + $this->assertFalse($test->testSomething); |
|
127 | + $this->assertFalse($test->assertPostConditions); |
|
128 | + $this->assertTrue($test->tearDown); |
|
129 | + } |
|
130 | + |
|
131 | + public function testExceptionInAssertPreConditions() |
|
132 | + { |
|
133 | + $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
134 | + $test->run(); |
|
135 | + |
|
136 | + $this->assertTrue($test->setUp); |
|
137 | + $this->assertTrue($test->assertPreConditions); |
|
138 | + $this->assertFalse($test->testSomething); |
|
139 | + $this->assertFalse($test->assertPostConditions); |
|
140 | + $this->assertTrue($test->tearDown); |
|
141 | + } |
|
142 | + |
|
143 | + public function testExceptionInTest() |
|
144 | + { |
|
145 | + $test = new \ExceptionInTest('testSomething'); |
|
146 | + $test->run(); |
|
147 | + |
|
148 | + $this->assertTrue($test->setUp); |
|
149 | + $this->assertTrue($test->assertPreConditions); |
|
150 | + $this->assertTrue($test->testSomething); |
|
151 | + $this->assertFalse($test->assertPostConditions); |
|
152 | + $this->assertTrue($test->tearDown); |
|
153 | + } |
|
154 | + |
|
155 | + public function testExceptionInAssertPostConditions() |
|
156 | + { |
|
157 | + $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
158 | + $test->run(); |
|
159 | + |
|
160 | + $this->assertTrue($test->setUp); |
|
161 | + $this->assertTrue($test->assertPreConditions); |
|
162 | + $this->assertTrue($test->testSomething); |
|
163 | + $this->assertTrue($test->assertPostConditions); |
|
164 | + $this->assertTrue($test->tearDown); |
|
165 | + } |
|
166 | + |
|
167 | + public function testExceptionInTearDown() |
|
168 | + { |
|
169 | + $test = new \ExceptionInTearDownTest('testSomething'); |
|
170 | + $test->run(); |
|
171 | + |
|
172 | + $this->assertTrue($test->setUp); |
|
173 | + $this->assertTrue($test->assertPreConditions); |
|
174 | + $this->assertTrue($test->testSomething); |
|
175 | + $this->assertTrue($test->assertPostConditions); |
|
176 | + $this->assertTrue($test->tearDown); |
|
177 | + } |
|
178 | + |
|
179 | + public function testNoArgTestCasePasses() |
|
180 | + { |
|
181 | + $result = new TestResult; |
|
182 | + $t = new TestSuite(\NoArgTestCaseTest::class); |
|
183 | + |
|
184 | + $t->run($result); |
|
185 | + |
|
186 | + $this->assertCount(1, $result); |
|
187 | + $this->assertEquals(0, $result->failureCount()); |
|
188 | + $this->assertEquals(0, $result->errorCount()); |
|
189 | + } |
|
190 | + |
|
191 | + public function testWasRun() |
|
192 | + { |
|
193 | + $test = new \WasRun; |
|
194 | + $test->run(); |
|
195 | + |
|
196 | + $this->assertTrue($test->wasRun); |
|
197 | + } |
|
198 | + |
|
199 | + public function testException() |
|
200 | + { |
|
201 | + $test = new \ThrowExceptionTestCase('test'); |
|
202 | + $test->expectException(\RuntimeException::class); |
|
203 | + |
|
204 | + $result = $test->run(); |
|
205 | + |
|
206 | + $this->assertCount(1, $result); |
|
207 | + $this->assertTrue($result->wasSuccessful()); |
|
208 | + } |
|
209 | + |
|
210 | + public function testExceptionWithEmptyMessage() |
|
211 | + { |
|
212 | + $test = new \ThrowExceptionTestCase('test'); |
|
213 | + $test->expectException(\RuntimeException::class); |
|
214 | + |
|
215 | + $result = $test->run(); |
|
216 | + |
|
217 | + $this->assertCount(1, $result); |
|
218 | + $this->assertTrue($result->wasSuccessful()); |
|
219 | + } |
|
220 | + |
|
221 | + public function testExceptionWithNullMessage() |
|
222 | + { |
|
223 | + $test = new \ThrowExceptionTestCase('test'); |
|
224 | + $test->expectException(\RuntimeException::class); |
|
225 | + |
|
226 | + $result = $test->run(); |
|
227 | + |
|
228 | + $this->assertCount(1, $result); |
|
229 | + $this->assertTrue($result->wasSuccessful()); |
|
230 | + } |
|
231 | + |
|
232 | + public function testExceptionWithMessage() |
|
233 | + { |
|
234 | + $test = new \ThrowExceptionTestCase('test'); |
|
235 | + $test->expectException(\RuntimeException::class); |
|
236 | + $test->expectExceptionMessage('A runtime error occurred'); |
|
237 | + |
|
238 | + $result = $test->run(); |
|
239 | + |
|
240 | + $this->assertCount(1, $result); |
|
241 | + $this->assertTrue($result->wasSuccessful()); |
|
242 | + } |
|
243 | + |
|
244 | + public function testExceptionWithWrongMessage() |
|
245 | + { |
|
246 | + $test = new \ThrowExceptionTestCase('test'); |
|
247 | + $test->expectException(\RuntimeException::class); |
|
248 | + $test->expectExceptionMessage('A logic error occurred'); |
|
249 | + |
|
250 | + $result = $test->run(); |
|
251 | + |
|
252 | + $this->assertEquals(1, $result->failureCount()); |
|
253 | + $this->assertCount(1, $result); |
|
254 | + $this->assertEquals( |
|
255 | + "Failed asserting that exception message 'A runtime error occurred' contains 'A logic error occurred'.", |
|
256 | + $test->getStatusMessage() |
|
257 | + ); |
|
258 | + } |
|
259 | + |
|
260 | + public function testExceptionWithRegexpMessage() |
|
261 | + { |
|
262 | + $test = new \ThrowExceptionTestCase('test'); |
|
263 | + $test->expectException(\RuntimeException::class); |
|
264 | + $test->expectExceptionMessageRegExp('/runtime .*? occurred/'); |
|
265 | + |
|
266 | + $result = $test->run(); |
|
267 | + |
|
268 | + $this->assertCount(1, $result); |
|
269 | + $this->assertTrue($result->wasSuccessful()); |
|
270 | + } |
|
271 | + |
|
272 | + public function testExceptionWithWrongRegexpMessage() |
|
273 | + { |
|
274 | + $test = new \ThrowExceptionTestCase('test'); |
|
275 | + $test->expectException(\RuntimeException::class); |
|
276 | + $test->expectExceptionMessageRegExp('/logic .*? occurred/'); |
|
277 | + |
|
278 | + $result = $test->run(); |
|
279 | + |
|
280 | + $this->assertEquals(1, $result->failureCount()); |
|
281 | + $this->assertCount(1, $result); |
|
282 | + $this->assertEquals( |
|
283 | + "Failed asserting that exception message 'A runtime error occurred' matches '/logic .*? occurred/'.", |
|
284 | + $test->getStatusMessage() |
|
285 | + ); |
|
286 | + } |
|
287 | + |
|
288 | + public function testExceptionWithInvalidRegexpMessage() |
|
289 | + { |
|
290 | + $test = new \ThrowExceptionTestCase('test'); |
|
291 | + $test->expectException(\RuntimeException::class); |
|
292 | + $test->expectExceptionMessageRegExp('#runtime .*? occurred/'); |
|
293 | + |
|
294 | + $test->run(); |
|
295 | + |
|
296 | + $this->assertEquals( |
|
297 | + "Invalid expected exception message regex given: '#runtime .*? occurred/'", |
|
298 | + $test->getStatusMessage() |
|
299 | + ); |
|
300 | + } |
|
301 | + |
|
302 | + public function testNoException() |
|
303 | + { |
|
304 | + $test = new \ThrowNoExceptionTestCase('test'); |
|
305 | + $test->expectException(\RuntimeException::class); |
|
306 | + |
|
307 | + $result = $test->run(); |
|
308 | + |
|
309 | + $this->assertEquals(1, $result->failureCount()); |
|
310 | + $this->assertCount(1, $result); |
|
311 | + } |
|
312 | + |
|
313 | + public function testWrongException() |
|
314 | + { |
|
315 | + $test = new \ThrowExceptionTestCase('test'); |
|
316 | + $test->expectException(\InvalidArgumentException::class); |
|
317 | + |
|
318 | + $result = $test->run(); |
|
319 | + |
|
320 | + $this->assertEquals(1, $result->failureCount()); |
|
321 | + $this->assertCount(1, $result); |
|
322 | + } |
|
323 | + |
|
324 | + /** |
|
325 | + * @backupGlobals enabled |
|
326 | + */ |
|
327 | + public function testGlobalsBackupPre() |
|
328 | + { |
|
329 | + global $a; |
|
330 | + global $i; |
|
331 | + |
|
332 | + $this->assertEquals('a', $a); |
|
333 | + $this->assertEquals('a', $GLOBALS['a']); |
|
334 | + $this->assertEquals('b', $_ENV['b']); |
|
335 | + $this->assertEquals('c', $_POST['c']); |
|
336 | + $this->assertEquals('d', $_GET['d']); |
|
337 | + $this->assertEquals('e', $_COOKIE['e']); |
|
338 | + $this->assertEquals('f', $_SERVER['f']); |
|
339 | + $this->assertEquals('g', $_FILES['g']); |
|
340 | + $this->assertEquals('h', $_REQUEST['h']); |
|
341 | + $this->assertEquals('i', $i); |
|
342 | + $this->assertEquals('i', $GLOBALS['i']); |
|
343 | + |
|
344 | + $GLOBALS['a'] = 'aa'; |
|
345 | + $GLOBALS['foo'] = 'bar'; |
|
346 | + $_ENV['b'] = 'bb'; |
|
347 | + $_POST['c'] = 'cc'; |
|
348 | + $_GET['d'] = 'dd'; |
|
349 | + $_COOKIE['e'] = 'ee'; |
|
350 | + $_SERVER['f'] = 'ff'; |
|
351 | + $_FILES['g'] = 'gg'; |
|
352 | + $_REQUEST['h'] = 'hh'; |
|
353 | + $GLOBALS['i'] = 'ii'; |
|
354 | + |
|
355 | + $this->assertEquals('aa', $a); |
|
356 | + $this->assertEquals('aa', $GLOBALS['a']); |
|
357 | + $this->assertEquals('bar', $GLOBALS['foo']); |
|
358 | + $this->assertEquals('bb', $_ENV['b']); |
|
359 | + $this->assertEquals('cc', $_POST['c']); |
|
360 | + $this->assertEquals('dd', $_GET['d']); |
|
361 | + $this->assertEquals('ee', $_COOKIE['e']); |
|
362 | + $this->assertEquals('ff', $_SERVER['f']); |
|
363 | + $this->assertEquals('gg', $_FILES['g']); |
|
364 | + $this->assertEquals('hh', $_REQUEST['h']); |
|
365 | + $this->assertEquals('ii', $i); |
|
366 | + $this->assertEquals('ii', $GLOBALS['i']); |
|
367 | + } |
|
368 | + |
|
369 | + public function testGlobalsBackupPost() |
|
370 | + { |
|
371 | + global $a; |
|
372 | + global $i; |
|
373 | + |
|
374 | + $this->assertEquals('a', $a); |
|
375 | + $this->assertEquals('a', $GLOBALS['a']); |
|
376 | + $this->assertEquals('b', $_ENV['b']); |
|
377 | + $this->assertEquals('c', $_POST['c']); |
|
378 | + $this->assertEquals('d', $_GET['d']); |
|
379 | + $this->assertEquals('e', $_COOKIE['e']); |
|
380 | + $this->assertEquals('f', $_SERVER['f']); |
|
381 | + $this->assertEquals('g', $_FILES['g']); |
|
382 | + $this->assertEquals('h', $_REQUEST['h']); |
|
383 | + $this->assertEquals('ii', $i); |
|
384 | + $this->assertEquals('ii', $GLOBALS['i']); |
|
385 | + |
|
386 | + $this->assertArrayNotHasKey('foo', $GLOBALS); |
|
387 | + } |
|
388 | + |
|
389 | + /** |
|
390 | + * @backupGlobals enabled |
|
391 | + * @backupStaticAttributes enabled |
|
392 | + * |
|
393 | + * @doesNotPerformAssertions |
|
394 | + */ |
|
395 | + public function testStaticAttributesBackupPre() |
|
396 | + { |
|
397 | + $GLOBALS['singleton'] = \Singleton::getInstance(); |
|
398 | + self::$testStatic = 123; |
|
399 | + } |
|
400 | + |
|
401 | + /** |
|
402 | + * @depends testStaticAttributesBackupPre |
|
403 | + */ |
|
404 | + public function testStaticAttributesBackupPost() |
|
405 | + { |
|
406 | + $this->assertNotSame($GLOBALS['singleton'], \Singleton::getInstance()); |
|
407 | + $this->assertSame(0, self::$testStatic); |
|
408 | + } |
|
409 | + |
|
410 | + public function testIsInIsolationReturnsFalse() |
|
411 | + { |
|
412 | + $test = new \IsolationTest('testIsInIsolationReturnsFalse'); |
|
413 | + $result = $test->run(); |
|
414 | + |
|
415 | + $this->assertCount(1, $result); |
|
416 | + $this->assertTrue($result->wasSuccessful()); |
|
417 | + } |
|
418 | + |
|
419 | + public function testIsInIsolationReturnsTrue() |
|
420 | + { |
|
421 | + $test = new \IsolationTest('testIsInIsolationReturnsTrue'); |
|
422 | + $test->setRunTestInSeparateProcess(true); |
|
423 | + $result = $test->run(); |
|
424 | + |
|
425 | + $this->assertCount(1, $result); |
|
426 | + $this->assertTrue($result->wasSuccessful()); |
|
427 | + } |
|
428 | + |
|
429 | + public function testExpectOutputStringFooActualFoo() |
|
430 | + { |
|
431 | + $test = new \OutputTestCase('testExpectOutputStringFooActualFoo'); |
|
432 | + $result = $test->run(); |
|
433 | + |
|
434 | + $this->assertCount(1, $result); |
|
435 | + $this->assertTrue($result->wasSuccessful()); |
|
436 | + } |
|
437 | + |
|
438 | + public function testExpectOutputStringFooActualBar() |
|
439 | + { |
|
440 | + $test = new \OutputTestCase('testExpectOutputStringFooActualBar'); |
|
441 | + $result = $test->run(); |
|
442 | + |
|
443 | + $this->assertCount(1, $result); |
|
444 | + $this->assertFalse($result->wasSuccessful()); |
|
445 | + } |
|
446 | + |
|
447 | + public function testExpectOutputRegexFooActualFoo() |
|
448 | + { |
|
449 | + $test = new \OutputTestCase('testExpectOutputRegexFooActualFoo'); |
|
450 | + $result = $test->run(); |
|
451 | + |
|
452 | + $this->assertCount(1, $result); |
|
453 | + $this->assertTrue($result->wasSuccessful()); |
|
454 | + } |
|
455 | + |
|
456 | + public function testExpectOutputRegexFooActualBar() |
|
457 | + { |
|
458 | + $test = new \OutputTestCase('testExpectOutputRegexFooActualBar'); |
|
459 | + $result = $test->run(); |
|
460 | + |
|
461 | + $this->assertCount(1, $result); |
|
462 | + $this->assertFalse($result->wasSuccessful()); |
|
463 | + } |
|
464 | + |
|
465 | + public function testSkipsIfRequiresHigherVersionOfPHPUnit() |
|
466 | + { |
|
467 | + $test = new \RequirementsTest('testAlwaysSkip'); |
|
468 | + $result = $test->run(); |
|
469 | + |
|
470 | + $this->assertEquals(1, $result->skippedCount()); |
|
471 | + $this->assertEquals( |
|
472 | + 'PHPUnit >= 1111111 is required.', |
|
473 | + $test->getStatusMessage() |
|
474 | + ); |
|
475 | + } |
|
476 | + |
|
477 | + public function testSkipsIfRequiresHigherVersionOfPHP() |
|
478 | + { |
|
479 | + $test = new \RequirementsTest('testAlwaysSkip2'); |
|
480 | + $result = $test->run(); |
|
481 | + |
|
482 | + $this->assertEquals(1, $result->skippedCount()); |
|
483 | + $this->assertEquals( |
|
484 | + 'PHP >= 9999999 is required.', |
|
485 | + $test->getStatusMessage() |
|
486 | + ); |
|
487 | + } |
|
488 | + |
|
489 | + public function testSkipsIfRequiresNonExistingOs() |
|
490 | + { |
|
491 | + $test = new \RequirementsTest('testAlwaysSkip3'); |
|
492 | + $result = $test->run(); |
|
493 | + |
|
494 | + $this->assertEquals(1, $result->skippedCount()); |
|
495 | + $this->assertEquals( |
|
496 | + 'Operating system matching /DOESNOTEXIST/i is required.', |
|
497 | + $test->getStatusMessage() |
|
498 | + ); |
|
499 | + } |
|
500 | + |
|
501 | + public function testSkipsIfRequiresNonExistingOsFamily() |
|
502 | + { |
|
503 | + $test = new \RequirementsTest('testAlwaysSkip4'); |
|
504 | + $result = $test->run(); |
|
505 | + |
|
506 | + $this->assertEquals(1, $result->skippedCount()); |
|
507 | + $this->assertEquals( |
|
508 | + 'Operating system DOESNOTEXIST is required.', |
|
509 | + $test->getStatusMessage() |
|
510 | + ); |
|
511 | + } |
|
512 | + |
|
513 | + public function testSkipsIfRequiresNonExistingFunction() |
|
514 | + { |
|
515 | + $test = new \RequirementsTest('testNine'); |
|
516 | + $result = $test->run(); |
|
517 | + |
|
518 | + $this->assertEquals(1, $result->skippedCount()); |
|
519 | + $this->assertEquals( |
|
520 | + 'Function testFunc is required.', |
|
521 | + $test->getStatusMessage() |
|
522 | + ); |
|
523 | + } |
|
524 | + |
|
525 | + public function testSkipsIfRequiresNonExistingExtension() |
|
526 | + { |
|
527 | + $test = new \RequirementsTest('testTen'); |
|
528 | + $test->run(); |
|
529 | + |
|
530 | + $this->assertEquals( |
|
531 | + 'Extension testExt is required.', |
|
532 | + $test->getStatusMessage() |
|
533 | + ); |
|
534 | + } |
|
535 | + |
|
536 | + public function testSkipsIfRequiresExtensionWithAMinimumVersion() |
|
537 | + { |
|
538 | + $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
539 | + $test->run(); |
|
540 | + |
|
541 | + $this->assertEquals( |
|
542 | + 'Extension testExt >= 1.8.0 is required.', |
|
543 | + $test->getStatusMessage() |
|
544 | + ); |
|
545 | + } |
|
546 | + |
|
547 | + public function testSkipsProvidesMessagesForAllSkippingReasons() |
|
548 | + { |
|
549 | + $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
550 | + $test->run(); |
|
551 | + |
|
552 | + $this->assertEquals( |
|
553 | + 'PHP >= 99-dev is required.' . PHP_EOL . |
|
554 | + 'PHPUnit >= 9-dev is required.' . PHP_EOL . |
|
555 | + 'Operating system matching /DOESNOTEXIST/i is required.' . PHP_EOL . |
|
556 | + 'Function testFuncOne is required.' . PHP_EOL . |
|
557 | + 'Function testFuncTwo is required.' . PHP_EOL . |
|
558 | + 'Extension testExtOne is required.' . PHP_EOL . |
|
559 | + 'Extension testExtTwo is required.' . PHP_EOL . |
|
560 | + 'Extension testExtThree >= 2.0 is required.', |
|
561 | + $test->getStatusMessage() |
|
562 | + ); |
|
563 | + } |
|
564 | + |
|
565 | + public function testRequiringAnExistingMethodDoesNotSkip() |
|
566 | + { |
|
567 | + $test = new \RequirementsTest('testExistingMethod'); |
|
568 | + $result = $test->run(); |
|
569 | + $this->assertEquals(0, $result->skippedCount()); |
|
570 | + } |
|
571 | + |
|
572 | + public function testRequiringAnExistingFunctionDoesNotSkip() |
|
573 | + { |
|
574 | + $test = new \RequirementsTest('testExistingFunction'); |
|
575 | + $result = $test->run(); |
|
576 | + $this->assertEquals(0, $result->skippedCount()); |
|
577 | + } |
|
578 | + |
|
579 | + public function testRequiringAnExistingExtensionDoesNotSkip() |
|
580 | + { |
|
581 | + $test = new \RequirementsTest('testExistingExtension'); |
|
582 | + $result = $test->run(); |
|
583 | + $this->assertEquals(0, $result->skippedCount()); |
|
584 | + } |
|
585 | + |
|
586 | + public function testRequiringAnExistingOsDoesNotSkip() |
|
587 | + { |
|
588 | + $test = new \RequirementsTest('testExistingOs'); |
|
589 | + $result = $test->run(); |
|
590 | + $this->assertEquals(0, $result->skippedCount()); |
|
591 | + } |
|
592 | + |
|
593 | + public function testCurrentWorkingDirectoryIsRestored() |
|
594 | + { |
|
595 | + $expectedCwd = \getcwd(); |
|
596 | + |
|
597 | + $test = new \ChangeCurrentWorkingDirectoryTest('testSomethingThatChangesTheCwd'); |
|
598 | + $test->run(); |
|
599 | + |
|
600 | + $this->assertSame($expectedCwd, \getcwd()); |
|
601 | + } |
|
602 | + |
|
603 | + /** |
|
604 | + * @requires PHP 7 |
|
605 | + * @expectedException \TypeError |
|
606 | + */ |
|
607 | + public function testTypeErrorCanBeExpected() |
|
608 | + { |
|
609 | + $o = new \ClassWithScalarTypeDeclarations; |
|
610 | + $o->foo(null, null); |
|
611 | + } |
|
612 | + |
|
613 | + public function testCreateMockFromClassName() |
|
614 | + { |
|
615 | + $mock = $this->createMock(\Mockable::class); |
|
616 | + |
|
617 | + $this->assertInstanceOf(\Mockable::class, $mock); |
|
618 | + $this->assertInstanceOf(\PHPUnit_Framework_MockObject_MockObject::class, $mock); |
|
619 | + } |
|
620 | + |
|
621 | + public function testCreateMockMocksAllMethods() |
|
622 | + { |
|
623 | + /** @var \Mockable $mock */ |
|
624 | + $mock = $this->createMock(\Mockable::class); |
|
625 | + |
|
626 | + $this->assertNull($mock->foo()); |
|
627 | + $this->assertNull($mock->bar()); |
|
628 | + } |
|
629 | + |
|
630 | + public function testCreatePartialMockDoesNotMockAllMethods() |
|
631 | + { |
|
632 | + /** @var \Mockable $mock */ |
|
633 | + $mock = $this->createPartialMock(\Mockable::class, ['foo']); |
|
634 | + |
|
635 | + $this->assertNull($mock->foo()); |
|
636 | + $this->assertTrue($mock->bar()); |
|
637 | + } |
|
638 | + |
|
639 | + public function testCreatePartialMockCanMockNoMethods() |
|
640 | + { |
|
641 | + /** @var \Mockable $mock */ |
|
642 | + $mock = $this->createPartialMock(\Mockable::class, []); |
|
643 | + |
|
644 | + $this->assertTrue($mock->foo()); |
|
645 | + $this->assertTrue($mock->bar()); |
|
646 | + } |
|
647 | + |
|
648 | + public function testCreateMockSkipsConstructor() |
|
649 | + { |
|
650 | + /** @var \Mockable $mock */ |
|
651 | + $mock = $this->createMock(\Mockable::class); |
|
652 | + |
|
653 | + $this->assertFalse($mock->constructorCalled); |
|
654 | + } |
|
655 | + |
|
656 | + public function testCreateMockDisablesOriginalClone() |
|
657 | + { |
|
658 | + /** @var \Mockable $mock */ |
|
659 | + $mock = $this->createMock(\Mockable::class); |
|
660 | + |
|
661 | + $cloned = clone $mock; |
|
662 | + $this->assertFalse($cloned->cloned); |
|
663 | + } |
|
664 | + |
|
665 | + public function testConfiguredMockCanBeCreated() |
|
666 | + { |
|
667 | + /** @var \Mockable $mock */ |
|
668 | + $mock = $this->createConfiguredMock( |
|
669 | + \Mockable::class, |
|
670 | + [ |
|
671 | + 'foo' => false |
|
672 | + ] |
|
673 | + ); |
|
674 | + |
|
675 | + $this->assertFalse($mock->foo()); |
|
676 | + $this->assertNull($mock->bar()); |
|
677 | + } |
|
678 | + |
|
679 | + public function testProvidingOfAutoreferencedArray() |
|
680 | + { |
|
681 | + $test = new \TestAutoreferenced('testJsonEncodeException', $this->getAutoreferencedArray()); |
|
682 | + $test->runBare(); |
|
683 | + |
|
684 | + $this->assertInternalType('array', $test->myTestData); |
|
685 | + $this->assertArrayHasKey('data', $test->myTestData); |
|
686 | + $this->assertEquals($test->myTestData['data'][0], $test->myTestData['data']); |
|
687 | + } |
|
688 | + |
|
689 | + /** |
|
690 | + * @return array<string, array> |
|
691 | + */ |
|
692 | + private function getAutoreferencedArray() |
|
693 | + { |
|
694 | + $recursionData = []; |
|
695 | + $recursionData[] = &$recursionData; |
|
696 | + |
|
697 | + return [ |
|
698 | + 'RECURSION' => [ |
|
699 | + 'data' => $recursionData |
|
700 | + ] |
|
701 | + ]; |
|
702 | + } |
|
703 | + |
|
704 | + public function testProvidingArrayThatMixesObjectsAndScalars() |
|
705 | + { |
|
706 | + $data = [ |
|
707 | + [123], |
|
708 | + ['foo'], |
|
709 | + [$this->createMock(\Mockable::class)], |
|
710 | + ]; |
|
711 | + |
|
712 | + $test = new \TestAutoreferenced('testJsonEncodeException', [$data]); |
|
713 | + $test->runBare(); |
|
714 | + |
|
715 | + $this->assertInternalType('array', $test->myTestData); |
|
716 | + $this->assertSame($data, $test->myTestData); |
|
717 | + } |
|
718 | 718 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function testExceptionInSetUp() |
120 | 120 | { |
121 | - $test = new \ExceptionInSetUpTest('testSomething'); |
|
121 | + $test = new \ExceptionInSetUpTest('testSomething'); |
|
122 | 122 | $test->run(); |
123 | 123 | |
124 | 124 | $this->assertTrue($test->setUp); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | public function testExceptionInAssertPreConditions() |
132 | 132 | { |
133 | - $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
133 | + $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
134 | 134 | $test->run(); |
135 | 135 | |
136 | 136 | $this->assertTrue($test->setUp); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | public function testExceptionInTest() |
144 | 144 | { |
145 | - $test = new \ExceptionInTest('testSomething'); |
|
145 | + $test = new \ExceptionInTest('testSomething'); |
|
146 | 146 | $test->run(); |
147 | 147 | |
148 | 148 | $this->assertTrue($test->setUp); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | public function testExceptionInAssertPostConditions() |
156 | 156 | { |
157 | - $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
157 | + $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
158 | 158 | $test->run(); |
159 | 159 | |
160 | 160 | $this->assertTrue($test->setUp); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | public function testExceptionInTearDown() |
168 | 168 | { |
169 | - $test = new \ExceptionInTearDownTest('testSomething'); |
|
169 | + $test = new \ExceptionInTearDownTest('testSomething'); |
|
170 | 170 | $test->run(); |
171 | 171 | |
172 | 172 | $this->assertTrue($test->setUp); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | public function testSkipsIfRequiresNonExistingExtension() |
526 | 526 | { |
527 | - $test = new \RequirementsTest('testTen'); |
|
527 | + $test = new \RequirementsTest('testTen'); |
|
528 | 528 | $test->run(); |
529 | 529 | |
530 | 530 | $this->assertEquals( |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | public function testSkipsIfRequiresExtensionWithAMinimumVersion() |
537 | 537 | { |
538 | - $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
538 | + $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
539 | 539 | $test->run(); |
540 | 540 | |
541 | 541 | $this->assertEquals( |
@@ -546,17 +546,17 @@ discard block |
||
546 | 546 | |
547 | 547 | public function testSkipsProvidesMessagesForAllSkippingReasons() |
548 | 548 | { |
549 | - $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
549 | + $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
550 | 550 | $test->run(); |
551 | 551 | |
552 | 552 | $this->assertEquals( |
553 | - 'PHP >= 99-dev is required.' . PHP_EOL . |
|
554 | - 'PHPUnit >= 9-dev is required.' . PHP_EOL . |
|
555 | - 'Operating system matching /DOESNOTEXIST/i is required.' . PHP_EOL . |
|
556 | - 'Function testFuncOne is required.' . PHP_EOL . |
|
557 | - 'Function testFuncTwo is required.' . PHP_EOL . |
|
558 | - 'Extension testExtOne is required.' . PHP_EOL . |
|
559 | - 'Extension testExtTwo is required.' . PHP_EOL . |
|
553 | + 'PHP >= 99-dev is required.'.PHP_EOL. |
|
554 | + 'PHPUnit >= 9-dev is required.'.PHP_EOL. |
|
555 | + 'Operating system matching /DOESNOTEXIST/i is required.'.PHP_EOL. |
|
556 | + 'Function testFuncOne is required.'.PHP_EOL. |
|
557 | + 'Function testFuncTwo is required.'.PHP_EOL. |
|
558 | + 'Extension testExtOne is required.'.PHP_EOL. |
|
559 | + 'Extension testExtTwo is required.'.PHP_EOL. |
|
560 | 560 | 'Extension testExtThree >= 2.0 is required.', |
561 | 561 | $test->getStatusMessage() |
562 | 562 | ); |
@@ -14,21 +14,21 @@ |
||
14 | 14 | |
15 | 15 | class IsJsonTest extends TestCase |
16 | 16 | { |
17 | - /** |
|
18 | - * @dataProvider evaluateDataprovider |
|
19 | - */ |
|
20 | - public function testEvaluate($expected, $jsonOther) |
|
21 | - { |
|
22 | - $constraint = new IsJson; |
|
17 | + /** |
|
18 | + * @dataProvider evaluateDataprovider |
|
19 | + */ |
|
20 | + public function testEvaluate($expected, $jsonOther) |
|
21 | + { |
|
22 | + $constraint = new IsJson; |
|
23 | 23 | |
24 | - $this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true)); |
|
25 | - } |
|
24 | + $this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true)); |
|
25 | + } |
|
26 | 26 | |
27 | - public static function evaluateDataprovider() |
|
28 | - { |
|
29 | - return [ |
|
30 | - 'valid JSON' => [true, '{}'], |
|
31 | - 'empty string should be treated as invalid JSON' => [false, ''], |
|
32 | - ]; |
|
33 | - } |
|
27 | + public static function evaluateDataprovider() |
|
28 | + { |
|
29 | + return [ |
|
30 | + 'valid JSON' => [true, '{}'], |
|
31 | + 'empty string should be treated as invalid JSON' => [false, ''], |
|
32 | + ]; |
|
33 | + } |
|
34 | 34 | } |
@@ -15,71 +15,71 @@ |
||
15 | 15 | |
16 | 16 | class ArraySubsetTest extends TestCase |
17 | 17 | { |
18 | - /** |
|
19 | - * @param bool $expected |
|
20 | - * @param array|\Traversable $subset |
|
21 | - * @param array|\Traversable $other |
|
22 | - * @param bool $strict |
|
23 | - * @dataProvider evaluateDataProvider |
|
24 | - */ |
|
25 | - public function testEvaluate($expected, $subset, $other, $strict) |
|
26 | - { |
|
27 | - $constraint = new ArraySubset($subset, $strict); |
|
18 | + /** |
|
19 | + * @param bool $expected |
|
20 | + * @param array|\Traversable $subset |
|
21 | + * @param array|\Traversable $other |
|
22 | + * @param bool $strict |
|
23 | + * @dataProvider evaluateDataProvider |
|
24 | + */ |
|
25 | + public function testEvaluate($expected, $subset, $other, $strict) |
|
26 | + { |
|
27 | + $constraint = new ArraySubset($subset, $strict); |
|
28 | 28 | |
29 | - $this->assertSame($expected, $constraint->evaluate($other, '', true)); |
|
30 | - } |
|
29 | + $this->assertSame($expected, $constraint->evaluate($other, '', true)); |
|
30 | + } |
|
31 | 31 | |
32 | - public static function evaluateDataProvider() |
|
33 | - { |
|
34 | - return [ |
|
35 | - 'loose array subset and array other' => [ |
|
36 | - 'expected' => true, |
|
37 | - 'subset' => ['bar' => 0], |
|
38 | - 'other' => ['foo' => '', 'bar' => '0'], |
|
39 | - 'strict' => false |
|
40 | - ], |
|
41 | - 'strict array subset and array other' => [ |
|
42 | - 'expected' => false, |
|
43 | - 'subset' => ['bar' => 0], |
|
44 | - 'other' => ['foo' => '', 'bar' => '0'], |
|
45 | - 'strict' => true |
|
46 | - ], |
|
47 | - 'loose array subset and ArrayObject other' => [ |
|
48 | - 'expected' => true, |
|
49 | - 'subset' => ['bar' => 0], |
|
50 | - 'other' => new \ArrayObject(['foo' => '', 'bar' => '0']), |
|
51 | - 'strict' => false |
|
52 | - ], |
|
53 | - 'strict ArrayObject subset and array other' => [ |
|
54 | - 'expected' => true, |
|
55 | - 'subset' => new \ArrayObject(['bar' => 0]), |
|
56 | - 'other' => ['foo' => '', 'bar' => 0], |
|
57 | - 'strict' => true |
|
58 | - ], |
|
59 | - ]; |
|
60 | - } |
|
32 | + public static function evaluateDataProvider() |
|
33 | + { |
|
34 | + return [ |
|
35 | + 'loose array subset and array other' => [ |
|
36 | + 'expected' => true, |
|
37 | + 'subset' => ['bar' => 0], |
|
38 | + 'other' => ['foo' => '', 'bar' => '0'], |
|
39 | + 'strict' => false |
|
40 | + ], |
|
41 | + 'strict array subset and array other' => [ |
|
42 | + 'expected' => false, |
|
43 | + 'subset' => ['bar' => 0], |
|
44 | + 'other' => ['foo' => '', 'bar' => '0'], |
|
45 | + 'strict' => true |
|
46 | + ], |
|
47 | + 'loose array subset and ArrayObject other' => [ |
|
48 | + 'expected' => true, |
|
49 | + 'subset' => ['bar' => 0], |
|
50 | + 'other' => new \ArrayObject(['foo' => '', 'bar' => '0']), |
|
51 | + 'strict' => false |
|
52 | + ], |
|
53 | + 'strict ArrayObject subset and array other' => [ |
|
54 | + 'expected' => true, |
|
55 | + 'subset' => new \ArrayObject(['bar' => 0]), |
|
56 | + 'other' => ['foo' => '', 'bar' => 0], |
|
57 | + 'strict' => true |
|
58 | + ], |
|
59 | + ]; |
|
60 | + } |
|
61 | 61 | |
62 | - public function testEvaluateWithArrayAccess() |
|
63 | - { |
|
64 | - $arrayAccess = new \ArrayAccessible(['foo' => 'bar']); |
|
62 | + public function testEvaluateWithArrayAccess() |
|
63 | + { |
|
64 | + $arrayAccess = new \ArrayAccessible(['foo' => 'bar']); |
|
65 | 65 | |
66 | - $constraint = new ArraySubset(['foo' => 'bar']); |
|
66 | + $constraint = new ArraySubset(['foo' => 'bar']); |
|
67 | 67 | |
68 | - $this->assertTrue($constraint->evaluate($arrayAccess, '', true)); |
|
69 | - } |
|
68 | + $this->assertTrue($constraint->evaluate($arrayAccess, '', true)); |
|
69 | + } |
|
70 | 70 | |
71 | - public function testEvaluateFailMessage() |
|
72 | - { |
|
73 | - $constraint = new ArraySubset(['foo' => 'bar']); |
|
71 | + public function testEvaluateFailMessage() |
|
72 | + { |
|
73 | + $constraint = new ArraySubset(['foo' => 'bar']); |
|
74 | 74 | |
75 | - try { |
|
76 | - $constraint->evaluate(['baz' => 'bar'], '', false); |
|
77 | - $this->fail(\sprintf('Expected %s to be thrown.', ExpectationFailedException::class)); |
|
78 | - } catch (ExpectationFailedException $expectedException) { |
|
79 | - $comparisonFailure = $expectedException->getComparisonFailure(); |
|
80 | - $this->assertNotNull($comparisonFailure); |
|
81 | - $this->assertContains('[foo] => bar', $comparisonFailure->getExpectedAsString()); |
|
82 | - $this->assertContains('[baz] => bar', $comparisonFailure->getActualAsString()); |
|
83 | - } |
|
84 | - } |
|
75 | + try { |
|
76 | + $constraint->evaluate(['baz' => 'bar'], '', false); |
|
77 | + $this->fail(\sprintf('Expected %s to be thrown.', ExpectationFailedException::class)); |
|
78 | + } catch (ExpectationFailedException $expectedException) { |
|
79 | + $comparisonFailure = $expectedException->getComparisonFailure(); |
|
80 | + $this->assertNotNull($comparisonFailure); |
|
81 | + $this->assertContains('[foo] => bar', $comparisonFailure->getExpectedAsString()); |
|
82 | + $this->assertContains('[baz] => bar', $comparisonFailure->getActualAsString()); |
|
83 | + } |
|
84 | + } |
|
85 | 85 | } |
@@ -14,135 +14,135 @@ |
||
14 | 14 | |
15 | 15 | class CountTest extends TestCase |
16 | 16 | { |
17 | - public function testCount() |
|
18 | - { |
|
19 | - $countConstraint = new Count(3); |
|
20 | - $this->assertTrue($countConstraint->evaluate([1, 2, 3], '', true)); |
|
17 | + public function testCount() |
|
18 | + { |
|
19 | + $countConstraint = new Count(3); |
|
20 | + $this->assertTrue($countConstraint->evaluate([1, 2, 3], '', true)); |
|
21 | 21 | |
22 | - $countConstraint = new Count(0); |
|
23 | - $this->assertTrue($countConstraint->evaluate([], '', true)); |
|
22 | + $countConstraint = new Count(0); |
|
23 | + $this->assertTrue($countConstraint->evaluate([], '', true)); |
|
24 | 24 | |
25 | - $countConstraint = new Count(2); |
|
26 | - $it = new \TestIterator([1, 2]); |
|
27 | - $ia = new \TestIteratorAggregate($it); |
|
28 | - $ia2 = new \TestIteratorAggregate2($ia); |
|
29 | - |
|
30 | - $this->assertTrue($countConstraint->evaluate($it, '', true)); |
|
31 | - $this->assertTrue($countConstraint->evaluate($ia, '', true)); |
|
32 | - $this->assertTrue($countConstraint->evaluate($ia2, '', true)); |
|
33 | - } |
|
34 | - |
|
35 | - public function testCountDoesNotChangeIteratorKey() |
|
36 | - { |
|
37 | - $countConstraint = new Count(2); |
|
38 | - |
|
39 | - // test with 1st implementation of Iterator |
|
40 | - $it = new \TestIterator([1, 2]); |
|
41 | - |
|
42 | - $countConstraint->evaluate($it, '', true); |
|
43 | - $this->assertEquals(1, $it->current()); |
|
44 | - |
|
45 | - $it->next(); |
|
46 | - $countConstraint->evaluate($it, '', true); |
|
47 | - $this->assertEquals(2, $it->current()); |
|
48 | - |
|
49 | - $it->next(); |
|
50 | - $countConstraint->evaluate($it, '', true); |
|
51 | - $this->assertFalse($it->valid()); |
|
52 | - |
|
53 | - // test with 2nd implementation of Iterator |
|
54 | - $it = new \TestIterator2([1, 2]); |
|
55 | - |
|
56 | - $countConstraint = new Count(2); |
|
57 | - $countConstraint->evaluate($it, '', true); |
|
58 | - $this->assertEquals(1, $it->current()); |
|
59 | - |
|
60 | - $it->next(); |
|
61 | - $countConstraint->evaluate($it, '', true); |
|
62 | - $this->assertEquals(2, $it->current()); |
|
63 | - |
|
64 | - $it->next(); |
|
65 | - $countConstraint->evaluate($it, '', true); |
|
66 | - $this->assertFalse($it->valid()); |
|
67 | - |
|
68 | - // test with IteratorAggregate |
|
69 | - $it = new \TestIterator([1, 2]); |
|
70 | - $ia = new \TestIteratorAggregate($it); |
|
71 | - |
|
72 | - $countConstraint = new Count(2); |
|
73 | - $countConstraint->evaluate($ia, '', true); |
|
74 | - $this->assertEquals(1, $it->current()); |
|
75 | - |
|
76 | - $it->next(); |
|
77 | - $countConstraint->evaluate($ia, '', true); |
|
78 | - $this->assertEquals(2, $it->current()); |
|
79 | - |
|
80 | - $it->next(); |
|
81 | - $countConstraint->evaluate($ia, '', true); |
|
82 | - $this->assertFalse($it->valid()); |
|
83 | - |
|
84 | - // test with nested IteratorAggregate |
|
85 | - $it = new \TestIterator([1, 2]); |
|
86 | - $ia = new \TestIteratorAggregate($it); |
|
87 | - $ia2 = new \TestIteratorAggregate2($ia); |
|
88 | - |
|
89 | - $countConstraint = new Count(2); |
|
90 | - $countConstraint->evaluate($ia2, '', true); |
|
91 | - $this->assertEquals(1, $it->current()); |
|
92 | - |
|
93 | - $it->next(); |
|
94 | - $countConstraint->evaluate($ia2, '', true); |
|
95 | - $this->assertEquals(2, $it->current()); |
|
96 | - |
|
97 | - $it->next(); |
|
98 | - $countConstraint->evaluate($ia2, '', true); |
|
99 | - $this->assertFalse($it->valid()); |
|
100 | - } |
|
101 | - |
|
102 | - public function testCountGeneratorsDoNotRewind() |
|
103 | - { |
|
104 | - $generatorMaker = new \TestGeneratorMaker; |
|
105 | - |
|
106 | - $countConstraint = new Count(3); |
|
107 | - |
|
108 | - $generator = $generatorMaker->create([1, 2, 3]); |
|
109 | - $this->assertEquals(1, $generator->current()); |
|
110 | - $countConstraint->evaluate($generator, '', true); |
|
111 | - $this->assertEquals(null, $generator->current()); |
|
112 | - |
|
113 | - $countConstraint = new Count(2); |
|
114 | - |
|
115 | - $generator = $generatorMaker->create([1, 2, 3]); |
|
116 | - $this->assertEquals(1, $generator->current()); |
|
117 | - $generator->next(); |
|
118 | - $this->assertEquals(2, $generator->current()); |
|
119 | - $countConstraint->evaluate($generator, '', true); |
|
120 | - $this->assertEquals(null, $generator->current()); |
|
121 | - |
|
122 | - $countConstraint = new Count(1); |
|
123 | - |
|
124 | - $generator = $generatorMaker->create([1, 2, 3]); |
|
125 | - $this->assertEquals(1, $generator->current()); |
|
126 | - $generator->next(); |
|
127 | - $this->assertEquals(2, $generator->current()); |
|
128 | - $generator->next(); |
|
129 | - $this->assertEquals(3, $generator->current()); |
|
130 | - $countConstraint->evaluate($generator, '', true); |
|
131 | - $this->assertEquals(null, $generator->current()); |
|
132 | - } |
|
133 | - |
|
134 | - public function testCountTraversable() |
|
135 | - { |
|
136 | - $countConstraint = new Count(5); |
|
137 | - |
|
138 | - // DatePeriod is used as an object that is Traversable but does not |
|
139 | - // implement Iterator or IteratorAggregate. The following ISO 8601 |
|
140 | - // recurring time interval will yield five total DateTime objects. |
|
141 | - $datePeriod = new \DatePeriod('R4/2017-05-01T00:00:00Z/P1D'); |
|
142 | - |
|
143 | - $this->assertInstanceOf(\Traversable::class, $datePeriod); |
|
144 | - $this->assertNotInstanceOf(\Iterator::class, $datePeriod); |
|
145 | - $this->assertNotInstanceOf(\IteratorAggregate::class, $datePeriod); |
|
146 | - $this->assertTrue($countConstraint->evaluate($datePeriod, '', true)); |
|
147 | - } |
|
25 | + $countConstraint = new Count(2); |
|
26 | + $it = new \TestIterator([1, 2]); |
|
27 | + $ia = new \TestIteratorAggregate($it); |
|
28 | + $ia2 = new \TestIteratorAggregate2($ia); |
|
29 | + |
|
30 | + $this->assertTrue($countConstraint->evaluate($it, '', true)); |
|
31 | + $this->assertTrue($countConstraint->evaluate($ia, '', true)); |
|
32 | + $this->assertTrue($countConstraint->evaluate($ia2, '', true)); |
|
33 | + } |
|
34 | + |
|
35 | + public function testCountDoesNotChangeIteratorKey() |
|
36 | + { |
|
37 | + $countConstraint = new Count(2); |
|
38 | + |
|
39 | + // test with 1st implementation of Iterator |
|
40 | + $it = new \TestIterator([1, 2]); |
|
41 | + |
|
42 | + $countConstraint->evaluate($it, '', true); |
|
43 | + $this->assertEquals(1, $it->current()); |
|
44 | + |
|
45 | + $it->next(); |
|
46 | + $countConstraint->evaluate($it, '', true); |
|
47 | + $this->assertEquals(2, $it->current()); |
|
48 | + |
|
49 | + $it->next(); |
|
50 | + $countConstraint->evaluate($it, '', true); |
|
51 | + $this->assertFalse($it->valid()); |
|
52 | + |
|
53 | + // test with 2nd implementation of Iterator |
|
54 | + $it = new \TestIterator2([1, 2]); |
|
55 | + |
|
56 | + $countConstraint = new Count(2); |
|
57 | + $countConstraint->evaluate($it, '', true); |
|
58 | + $this->assertEquals(1, $it->current()); |
|
59 | + |
|
60 | + $it->next(); |
|
61 | + $countConstraint->evaluate($it, '', true); |
|
62 | + $this->assertEquals(2, $it->current()); |
|
63 | + |
|
64 | + $it->next(); |
|
65 | + $countConstraint->evaluate($it, '', true); |
|
66 | + $this->assertFalse($it->valid()); |
|
67 | + |
|
68 | + // test with IteratorAggregate |
|
69 | + $it = new \TestIterator([1, 2]); |
|
70 | + $ia = new \TestIteratorAggregate($it); |
|
71 | + |
|
72 | + $countConstraint = new Count(2); |
|
73 | + $countConstraint->evaluate($ia, '', true); |
|
74 | + $this->assertEquals(1, $it->current()); |
|
75 | + |
|
76 | + $it->next(); |
|
77 | + $countConstraint->evaluate($ia, '', true); |
|
78 | + $this->assertEquals(2, $it->current()); |
|
79 | + |
|
80 | + $it->next(); |
|
81 | + $countConstraint->evaluate($ia, '', true); |
|
82 | + $this->assertFalse($it->valid()); |
|
83 | + |
|
84 | + // test with nested IteratorAggregate |
|
85 | + $it = new \TestIterator([1, 2]); |
|
86 | + $ia = new \TestIteratorAggregate($it); |
|
87 | + $ia2 = new \TestIteratorAggregate2($ia); |
|
88 | + |
|
89 | + $countConstraint = new Count(2); |
|
90 | + $countConstraint->evaluate($ia2, '', true); |
|
91 | + $this->assertEquals(1, $it->current()); |
|
92 | + |
|
93 | + $it->next(); |
|
94 | + $countConstraint->evaluate($ia2, '', true); |
|
95 | + $this->assertEquals(2, $it->current()); |
|
96 | + |
|
97 | + $it->next(); |
|
98 | + $countConstraint->evaluate($ia2, '', true); |
|
99 | + $this->assertFalse($it->valid()); |
|
100 | + } |
|
101 | + |
|
102 | + public function testCountGeneratorsDoNotRewind() |
|
103 | + { |
|
104 | + $generatorMaker = new \TestGeneratorMaker; |
|
105 | + |
|
106 | + $countConstraint = new Count(3); |
|
107 | + |
|
108 | + $generator = $generatorMaker->create([1, 2, 3]); |
|
109 | + $this->assertEquals(1, $generator->current()); |
|
110 | + $countConstraint->evaluate($generator, '', true); |
|
111 | + $this->assertEquals(null, $generator->current()); |
|
112 | + |
|
113 | + $countConstraint = new Count(2); |
|
114 | + |
|
115 | + $generator = $generatorMaker->create([1, 2, 3]); |
|
116 | + $this->assertEquals(1, $generator->current()); |
|
117 | + $generator->next(); |
|
118 | + $this->assertEquals(2, $generator->current()); |
|
119 | + $countConstraint->evaluate($generator, '', true); |
|
120 | + $this->assertEquals(null, $generator->current()); |
|
121 | + |
|
122 | + $countConstraint = new Count(1); |
|
123 | + |
|
124 | + $generator = $generatorMaker->create([1, 2, 3]); |
|
125 | + $this->assertEquals(1, $generator->current()); |
|
126 | + $generator->next(); |
|
127 | + $this->assertEquals(2, $generator->current()); |
|
128 | + $generator->next(); |
|
129 | + $this->assertEquals(3, $generator->current()); |
|
130 | + $countConstraint->evaluate($generator, '', true); |
|
131 | + $this->assertEquals(null, $generator->current()); |
|
132 | + } |
|
133 | + |
|
134 | + public function testCountTraversable() |
|
135 | + { |
|
136 | + $countConstraint = new Count(5); |
|
137 | + |
|
138 | + // DatePeriod is used as an object that is Traversable but does not |
|
139 | + // implement Iterator or IteratorAggregate. The following ISO 8601 |
|
140 | + // recurring time interval will yield five total DateTime objects. |
|
141 | + $datePeriod = new \DatePeriod('R4/2017-05-01T00:00:00Z/P1D'); |
|
142 | + |
|
143 | + $this->assertInstanceOf(\Traversable::class, $datePeriod); |
|
144 | + $this->assertNotInstanceOf(\Iterator::class, $datePeriod); |
|
145 | + $this->assertNotInstanceOf(\IteratorAggregate::class, $datePeriod); |
|
146 | + $this->assertTrue($countConstraint->evaluate($datePeriod, '', true)); |
|
147 | + } |
|
148 | 148 | } |
@@ -15,72 +15,72 @@ |
||
15 | 15 | |
16 | 16 | class JsonMatchesTest extends TestCase |
17 | 17 | { |
18 | - /** |
|
19 | - * @dataProvider evaluateDataprovider |
|
20 | - */ |
|
21 | - public function testEvaluate($expected, $jsonOther, $jsonValue) |
|
22 | - { |
|
23 | - $constraint = new JsonMatches($jsonValue); |
|
18 | + /** |
|
19 | + * @dataProvider evaluateDataprovider |
|
20 | + */ |
|
21 | + public function testEvaluate($expected, $jsonOther, $jsonValue) |
|
22 | + { |
|
23 | + $constraint = new JsonMatches($jsonValue); |
|
24 | 24 | |
25 | - $this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true)); |
|
26 | - } |
|
25 | + $this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true)); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @dataProvider evaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatchDataprovider |
|
30 | - */ |
|
31 | - public function testEvaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatch($jsonOther, $jsonValue) |
|
32 | - { |
|
33 | - $constraint = new JsonMatches($jsonValue); |
|
28 | + /** |
|
29 | + * @dataProvider evaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatchDataprovider |
|
30 | + */ |
|
31 | + public function testEvaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatch($jsonOther, $jsonValue) |
|
32 | + { |
|
33 | + $constraint = new JsonMatches($jsonValue); |
|
34 | 34 | |
35 | - try { |
|
36 | - $constraint->evaluate($jsonOther, '', false); |
|
37 | - $this->fail(\sprintf('Expected %s to be thrown.', ExpectationFailedException::class)); |
|
38 | - } catch (ExpectationFailedException $expectedException) { |
|
39 | - $comparisonFailure = $expectedException->getComparisonFailure(); |
|
40 | - $this->assertNotNull($comparisonFailure); |
|
41 | - $this->assertSame($jsonOther, $comparisonFailure->getExpectedAsString()); |
|
42 | - $this->assertSame($jsonValue, $comparisonFailure->getActualAsString()); |
|
43 | - $this->assertSame('Failed asserting that two json values are equal.', $comparisonFailure->getMessage()); |
|
44 | - } |
|
45 | - } |
|
35 | + try { |
|
36 | + $constraint->evaluate($jsonOther, '', false); |
|
37 | + $this->fail(\sprintf('Expected %s to be thrown.', ExpectationFailedException::class)); |
|
38 | + } catch (ExpectationFailedException $expectedException) { |
|
39 | + $comparisonFailure = $expectedException->getComparisonFailure(); |
|
40 | + $this->assertNotNull($comparisonFailure); |
|
41 | + $this->assertSame($jsonOther, $comparisonFailure->getExpectedAsString()); |
|
42 | + $this->assertSame($jsonValue, $comparisonFailure->getActualAsString()); |
|
43 | + $this->assertSame('Failed asserting that two json values are equal.', $comparisonFailure->getMessage()); |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - public function testToString() |
|
48 | - { |
|
49 | - $jsonValue = \json_encode(['Mascott' => 'Tux']); |
|
50 | - $constraint = new JsonMatches($jsonValue); |
|
47 | + public function testToString() |
|
48 | + { |
|
49 | + $jsonValue = \json_encode(['Mascott' => 'Tux']); |
|
50 | + $constraint = new JsonMatches($jsonValue); |
|
51 | 51 | |
52 | - $this->assertEquals('matches JSON string "' . $jsonValue . '"', $constraint->toString()); |
|
53 | - } |
|
52 | + $this->assertEquals('matches JSON string "' . $jsonValue . '"', $constraint->toString()); |
|
53 | + } |
|
54 | 54 | |
55 | - public static function evaluateDataprovider() |
|
56 | - { |
|
57 | - return [ |
|
58 | - 'valid JSON' => [true, \json_encode(['Mascott' => 'Tux']), \json_encode(['Mascott' => 'Tux'])], |
|
59 | - 'error syntax' => [false, '{"Mascott"::}', \json_encode(['Mascott' => 'Tux'])], |
|
60 | - 'error UTF-8' => [false, \json_encode('\xB1\x31'), \json_encode(['Mascott' => 'Tux'])], |
|
61 | - 'invalid JSON in class instantiation' => [false, \json_encode(['Mascott' => 'Tux']), '{"Mascott"::}'], |
|
62 | - 'string type not equals number' => [false, '{"age": "5"}', '{"age": 5}'], |
|
63 | - 'string type not equals boolean' => [false, '{"age": "true"}', '{"age": true}'], |
|
64 | - 'string type not equals null' => [false, '{"age": "null"}', '{"age": null}'], |
|
65 | - 'object fields are unordered' => [true, '{"first":1, "second":"2"}', '{"second":"2", "first":1}'], |
|
66 | - 'child object fields are unordered' => [true, '{"Mascott": {"name":"Tux", "age":5}}', '{"Mascott": {"age":5, "name":"Tux"}}'], |
|
67 | - 'null field different from missing field' => [false, '{"present": true, "missing": null}', '{"present": true}'], |
|
68 | - 'array elements are ordered' => [false, '["first", "second"]', '["second", "first"]'], |
|
69 | - 'single boolean valid json' => [true, 'true', 'true'], |
|
70 | - 'single number valid json' => [true, '5.3', '5.3'], |
|
71 | - 'single null valid json' => [true, 'null', 'null'], |
|
72 | - ]; |
|
73 | - } |
|
55 | + public static function evaluateDataprovider() |
|
56 | + { |
|
57 | + return [ |
|
58 | + 'valid JSON' => [true, \json_encode(['Mascott' => 'Tux']), \json_encode(['Mascott' => 'Tux'])], |
|
59 | + 'error syntax' => [false, '{"Mascott"::}', \json_encode(['Mascott' => 'Tux'])], |
|
60 | + 'error UTF-8' => [false, \json_encode('\xB1\x31'), \json_encode(['Mascott' => 'Tux'])], |
|
61 | + 'invalid JSON in class instantiation' => [false, \json_encode(['Mascott' => 'Tux']), '{"Mascott"::}'], |
|
62 | + 'string type not equals number' => [false, '{"age": "5"}', '{"age": 5}'], |
|
63 | + 'string type not equals boolean' => [false, '{"age": "true"}', '{"age": true}'], |
|
64 | + 'string type not equals null' => [false, '{"age": "null"}', '{"age": null}'], |
|
65 | + 'object fields are unordered' => [true, '{"first":1, "second":"2"}', '{"second":"2", "first":1}'], |
|
66 | + 'child object fields are unordered' => [true, '{"Mascott": {"name":"Tux", "age":5}}', '{"Mascott": {"age":5, "name":"Tux"}}'], |
|
67 | + 'null field different from missing field' => [false, '{"present": true, "missing": null}', '{"present": true}'], |
|
68 | + 'array elements are ordered' => [false, '["first", "second"]', '["second", "first"]'], |
|
69 | + 'single boolean valid json' => [true, 'true', 'true'], |
|
70 | + 'single number valid json' => [true, '5.3', '5.3'], |
|
71 | + 'single null valid json' => [true, 'null', 'null'], |
|
72 | + ]; |
|
73 | + } |
|
74 | 74 | |
75 | - public static function evaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatchDataprovider() |
|
76 | - { |
|
77 | - return [ |
|
78 | - 'error UTF-8' => [\json_encode('\xB1\x31'), \json_encode(['Mascott' => 'Tux'])], |
|
79 | - 'string type not equals number' => ['{"age": "5"}', '{"age": 5}'], |
|
80 | - 'string type not equals boolean' => ['{"age": "true"}', '{"age": true}'], |
|
81 | - 'string type not equals null' => ['{"age": "null"}', '{"age": null}'], |
|
82 | - 'null field different from missing field' => ['{"present": true, "missing": null}', '{"present": true}'], |
|
83 | - 'array elements are ordered' => ['["first", "second"]', '["second", "first"]'] |
|
84 | - ]; |
|
85 | - } |
|
75 | + public static function evaluateThrowsExpectationFailedExceptionWhenJsonIsValidButDoesNotMatchDataprovider() |
|
76 | + { |
|
77 | + return [ |
|
78 | + 'error UTF-8' => [\json_encode('\xB1\x31'), \json_encode(['Mascott' => 'Tux'])], |
|
79 | + 'string type not equals number' => ['{"age": "5"}', '{"age": 5}'], |
|
80 | + 'string type not equals boolean' => ['{"age": "true"}', '{"age": true}'], |
|
81 | + 'string type not equals null' => ['{"age": "null"}', '{"age": null}'], |
|
82 | + 'null field different from missing field' => ['{"present": true, "missing": null}', '{"present": true}'], |
|
83 | + 'array elements are ordered' => ['["first", "second"]', '["second", "first"]'] |
|
84 | + ]; |
|
85 | + } |
|
86 | 86 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $jsonValue = \json_encode(['Mascott' => 'Tux']); |
50 | 50 | $constraint = new JsonMatches($jsonValue); |
51 | 51 | |
52 | - $this->assertEquals('matches JSON string "' . $jsonValue . '"', $constraint->toString()); |
|
52 | + $this->assertEquals('matches JSON string "'.$jsonValue.'"', $constraint->toString()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public static function evaluateDataprovider() |