Skip to content

Commit 2227851

Browse files
authored
Update dependencies (#177)
* Updated dev dependencies * Made tests compatible with PHPUnit 9 * Fixed broken tests * Run tests on PHP 7.3 and 7.4 * Support symfony/finder 5
1 parent 349b60c commit 2227851

11 files changed

+39
-32
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ php:
44
- 7.0
55
- 7.1
66
- 7.2
7+
- 7.3
8+
- 7.4
79

810
before_script:
911
- stty cols 160

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"php": ">=7.0.0",
1717
"goaop/framework": "^2.2.0",
1818
"phpunit/phpunit": "> 6.0.0",
19-
"symfony/finder": "~2.4|~3.0|~4.0"
19+
"symfony/finder": "~2.4|~3.0|~4.0|~5.0"
2020
},
2121
"require-dev": {
22-
"codeception/base": "^2.4",
23-
"codeception/verify": "~0.2",
24-
"codeception/specify": "~0.3"
22+
"codeception/codeception": "^4.0",
23+
"codeception/verify": "^1.2",
24+
"codeception/specify": "^1.0"
2525
},
2626
"license": "MIT"
2727
}

tests/unit/AccessDemoClassesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace demo;
33

4+
use PHPUnit\Framework\AssertionFailedError;
5+
46
class AccessDemoClassesTest extends \PHPUnit\Framework\TestCase
57
{
68
public function testUserModel()
@@ -9,11 +11,9 @@ public function testUserModel()
911
$this->assertEquals('davert', $user->getName());
1012
}
1113

12-
/**
13-
* @expectedException \PHPUnit\Framework\AssertionFailedError
14-
*/
1514
public function testUserService()
1615
{
16+
$this->expectException(AssertionFailedError::class);
1717
$service = new UserService();
1818
$service->create(['name' => 'davert']);
1919
}

tests/unit/ClassProxyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testMegaClassValidations()
3535

3636
public function testUndefinedClass()
3737
{
38-
$this->setExpectedException('Exception');
38+
$this->expectException('Exception');
3939
test::double('MyUndefinedClass');
4040
}
4141

tests/unit/FunctionInjectorTest.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use AspectMock\Intercept\FunctionInjector;
55
use AspectMock\Test as test;
6+
use PHPUnit\Framework\ExpectationFailedException;
67

78
class FunctionInjectorTest extends \Codeception\TestCase\Test
89
{
@@ -32,20 +33,20 @@ public function _before()
3233
public function testTemplate()
3334
{
3435
$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());");
3738
}
3839

3940
public function testReferencedParameterTemplate()
4041
{
4142
$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);");
4950
}
5051

5152
public function testSave()
@@ -96,10 +97,10 @@ public function testVerifierFullyQualifiedNamespace()
9697

9798
/**
9899
* @test
99-
* @expectedException PHPUnit\Framework\ExpectationFailedException
100100
*/
101101
public function testFailedVerification()
102102
{
103+
$this->expectException(ExpectationFailedException::class);
103104
$func = test::func('demo', 'strlen', function() { return 10; });
104105
expect(strlen('hello'))->equals(10);
105106
$func->verifyNeverInvoked();

tests/unit/MockFailedTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
use AspectMock\Proxy\ClassProxy;
77
use AspectMock\Proxy\InstanceProxy;
88
use \AspectMock\Core\Registry as double;
9+
use Codeception\PHPUnit\TestCase;
910

10-
class MockFailedTest extends \PHPUnit\Framework\TestCase
11+
class MockFailedTest extends TestCase
1112
{
1213

13-
protected function setUp()
14+
protected function _setUp()
1415
{
1516
$this->expectException('PHPUnit\Framework\ExpectationFailedException');
1617
}
1718

18-
protected function tearDown()
19+
protected function _tearDown()
1920
{
2021
double::clean();
2122
}

tests/unit/MockTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
use \AspectMock\Core\Registry as double;
44
use AspectMock\Proxy\ClassProxy;
55
use AspectMock\Proxy\InstanceProxy;
6+
use Codeception\PHPUnit\TestCase;
67

7-
class MockTest extends \PHPUnit\Framework\TestCase
8+
class MockTest extends TestCase
89
{
910
use \Codeception\Specify;
1011

11-
protected function tearDown()
12+
protected function _tearDown()
1213
{
1314
double::clean();
1415
}

tests/unit/StubTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace demo;
33
use \AspectMock\Core\Registry as double;
4+
use Codeception\PHPUnit\TestCase;
45

5-
class StubTest extends \PHPUnit\Framework\TestCase
6+
class StubTest extends TestCase
67
{
7-
protected function tearDown()
8+
protected function _tearDown()
89
{
910
double::clean();
1011
}

tests/unit/VerifierTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
use \AspectMock\Core\Registry as double;
44
use AspectMock\Proxy\ClassProxy;
55
use AspectMock\Proxy\InstanceProxy;
6+
use Codeception\PHPUnit\TestCase;
67

7-
class VerifierTest extends \PHPUnit\Framework\TestCase
8+
class VerifierTest extends TestCase
89
{
910
use \Codeception\Specify;
1011

11-
protected function tearDown()
12+
protected function _tearDown()
1213
{
1314
double::clean();
1415
}

tests/unit/_bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22
// Here you can initialize variables that will for your tests
33

4-
Codeception\Specify\Config::setDeepClone(false);
4+
//Codeception\Specify\Config::setDeepClone(false);

0 commit comments

Comments
 (0)