|
3 | 3 |
|
4 | 4 | use AspectMock\Intercept\FunctionInjector; |
5 | 5 | use AspectMock\Test as test; |
| 6 | +use PHPUnit\Framework\ExpectationFailedException; |
6 | 7 |
|
7 | 8 | class FunctionInjectorTest extends \Codeception\TestCase\Test |
8 | 9 | { |
@@ -32,20 +33,20 @@ public function _before() |
32 | 33 | public function testTemplate() |
33 | 34 | { |
34 | 35 | $php = $this->funcInjector->getPHP(); |
35 | | - verify($php)->contains("function strlen()"); |
36 | | - verify($php)->contains("return call_user_func_array('strlen', func_get_args());"); |
| 36 | + verify($php)->stringContainsString("function strlen()"); |
| 37 | + verify($php)->stringContainsString("return call_user_func_array('strlen', func_get_args());"); |
37 | 38 | } |
38 | 39 |
|
39 | 40 | public function testReferencedParameterTemplate() |
40 | 41 | { |
41 | 42 | $php = $this->funcReferencedParameterInjector->getPHP(); |
42 | | - verify($php)->contains("function preg_match(\$p0, \$p1, &\$p2=NULL, \$p3=NULL, \$p4=NULL)"); |
43 | | - verify($php)->contains("case 5: \$args = [\$p0, \$p1, &\$p2, \$p3, \$p4]; break;"); |
44 | | - verify($php)->contains("case 4: \$args = [\$p0, \$p1, &\$p2, \$p3]; break;"); |
45 | | - verify($php)->contains("case 3: \$args = [\$p0, \$p1, &\$p2]; break;"); |
46 | | - verify($php)->contains("case 2: \$args = [\$p0, \$p1]; break;"); |
47 | | - verify($php)->contains("case 1: \$args = [\$p0]; break;"); |
48 | | - verify($php)->contains("return call_user_func_array('preg_match', \$args);"); |
| 43 | + verify($php)->stringContainsString("function preg_match(\$p0, \$p1, &\$p2=NULL, \$p3=NULL, \$p4=NULL)"); |
| 44 | + verify($php)->stringContainsString("case 5: \$args = [\$p0, \$p1, &\$p2, \$p3, \$p4]; break;"); |
| 45 | + verify($php)->stringContainsString("case 4: \$args = [\$p0, \$p1, &\$p2, \$p3]; break;"); |
| 46 | + verify($php)->stringContainsString("case 3: \$args = [\$p0, \$p1, &\$p2]; break;"); |
| 47 | + verify($php)->stringContainsString("case 2: \$args = [\$p0, \$p1]; break;"); |
| 48 | + verify($php)->stringContainsString("case 1: \$args = [\$p0]; break;"); |
| 49 | + verify($php)->stringContainsString("return call_user_func_array('preg_match', \$args);"); |
49 | 50 | } |
50 | 51 |
|
51 | 52 | public function testSave() |
@@ -96,10 +97,10 @@ public function testVerifierFullyQualifiedNamespace() |
96 | 97 |
|
97 | 98 | /** |
98 | 99 | * @test |
99 | | - * @expectedException PHPUnit\Framework\ExpectationFailedException |
100 | 100 | */ |
101 | 101 | public function testFailedVerification() |
102 | 102 | { |
| 103 | + $this->expectException(ExpectationFailedException::class); |
103 | 104 | $func = test::func('demo', 'strlen', function() { return 10; }); |
104 | 105 | expect(strlen('hello'))->equals(10); |
105 | 106 | $func->verifyNeverInvoked(); |
|
0 commit comments