Skip to content

Commit 754810d

Browse files
committed
Support PHPUnit 6 and PHPUnit Mock Objects 4
1 parent 8bb8290 commit 754810d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ composer require --dev mnapoli/phpunit-easymock
2121
To be able to use EasyMock in your tests **you must include the trait in your class**:
2222

2323
```php
24-
class MyTest extends \PHPUnit_Framework_TestCase
24+
class MyTest extends \PHPUnit\Framework\TestCase
2525
{
2626
use \EasyMock\EasyMock;
2727

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
},
1818
"require": {
1919
"php": "~5.4|~7.0",
20-
"phpunit/phpunit-mock-objects": "~2.0|~3.0"
20+
"phpunit/phpunit-mock-objects": "~2.0|~3.0|~4.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~4.0|~5.0"
23+
"phpunit/phpunit": "~4.8.35|~5.7|~6.4"
2424
}
2525
}

tests/EasyMockTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use EasyMock\Test\Fixture\ClassWithConstructor;
88
use EasyMock\Test\Fixture\CustomException;
99
use EasyMock\Test\Fixture\InterfaceFixture;
10+
use PHPUnit\Framework\TestCase;
11+
use PHPUnit\Framework\ExpectationFailedException;
1012

1113
/**
1214
* @author Matthieu Napoli <[email protected]>
1315
*/
14-
class EasyMockTest extends \PHPUnit_Framework_TestCase
16+
class EasyMockTest extends TestCase
1517
{
1618
use EasyMock;
1719

@@ -126,7 +128,7 @@ public function should_allow_to_spy_method_calls()
126128
));
127129

128130
// Test PHPUnit's internals to check that the spy was registered
129-
$property = new \ReflectionProperty('PHPUnit_Framework_TestCase', 'mockObjects');
131+
$property = new \ReflectionProperty(TestCase::class, 'mockObjects');
130132
$property->setAccessible(true);
131133
$mockObjects = $property->getValue($this);
132134

@@ -137,7 +139,7 @@ public function should_allow_to_spy_method_calls()
137139
try {
138140
$mock->__phpunit_verify();
139141
$this->fail('Exception not thrown');
140-
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
142+
} catch (ExpectationFailedException $e) {
141143
$this->assertContains('Expected invocation at least once but it never occur', $e->getMessage());
142144
}
143145

0 commit comments

Comments
 (0)