Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c3cee2c

Browse files
Merge branch 'feature/phpunit-8'
Close #31 Close #33
2 parents c11139a + a25b10b commit c3cee2c

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

‎.travis.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ env:
1919
- PHPUNIT_VERSION=~7.2.0
2020
- PHPUNIT_VERSION=~7.3.0
2121
- PHPUNIT_VERSION=~7.4.0
22+
- PHPUNIT_VERSION=~7.5.0
23+
- PHPUNIT_VERSION=~8.0.0
2224

2325
php:
2426
- 7.3
@@ -30,8 +32,16 @@ php:
3032
matrix:
3133
fast_finish: true
3234
exclude:
35+
- php: 7.1
36+
env: PHPUNIT_VERSION=dev-master
37+
- php: 7.1
38+
env: PHPUNIT_VERSION=~8.0.0
3339
- php: 7
3440
env: PHPUNIT_VERSION=dev-master
41+
- php: 7
42+
env: PHPUNIT_VERSION=~8.0.0
43+
- php: 7
44+
env: PHPUNIT_VERSION=~7.5.0
3545
- php: 7
3646
env: PHPUNIT_VERSION=~7.4.0
3747
- php: 7

‎autoload.php‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ class_alias(
2828
);
2929
}
3030

31+
if (! class_exists(\PHPUnit\Framework\MockObject\Matcher\MethodName::class)) {
32+
class_alias(
33+
\PHPUnit_Framework_MockObject_Matcher_MethodName::class,
34+
\PHPUnit\Framework\MockObject\Matcher\MethodName::class
35+
);
36+
}
37+
38+
if (! interface_exists(\PHPUnit\Framework\MockObject\Stub\MatcherCollection::class)) {
39+
class_alias(
40+
\PHPUnit_Framework_MockObject_Stub_MatcherCollection::class,
41+
\PHPUnit\Framework\MockObject\Stub\MatcherCollection::class
42+
);
43+
}
44+
3145
if (! class_exists(\PHPUnit\Framework\BaseTestListener::class)) {
3246
include __DIR__ . '/compatibility/BaseTestListener.php';
3347
class_alias(

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"require": {
2121
"php": ">=7",
22-
"phpunit/phpunit": "^6 || ^7",
22+
"phpunit/phpunit": "^6 || ^7 || ^8",
2323
"php-mock/php-mock-integration": "^2"
2424
},
2525
"archive": {

‎tests/MockObjectProxyTest.php‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace phpmock\phpunit;
44

5+
use PHPUnit\Framework\MockObject\Matcher\MethodName;
6+
use PHPUnit\Framework\MockObject\Stub\MatcherCollection;
57
use PHPUnit\Framework\TestCase;
68
use phpmock\integration\MockDelegateFunctionBuilder;
79
use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
@@ -29,9 +31,11 @@ public function testExpects()
2931
{
3032
$matcher = $this->getMockBuilder(Invocation::class)->getMock();
3133

32-
$invocationMocker = $this->getMockBuilder(InvocationMocker::class)->disableOriginalConstructor()->getMock();
33-
$invocationMocker->expects($this->once())->method("method")
34-
->with(MockDelegateFunctionBuilder::METHOD)->willReturn($invocationMocker);
34+
$invocationMocker = new InvocationMocker(
35+
$this->prophesize(MatcherCollection::class)->reveal(),
36+
$this->prophesize(Invocation::class)->reveal(),
37+
[MockDelegateFunctionBuilder::METHOD]
38+
);
3539

3640
$prophecy = $this->prophesize(MockObject::class);
3741
$prophecy->expects($matcher)->willReturn($invocationMocker);
@@ -41,6 +45,12 @@ public function testExpects()
4145

4246
$result = $proxy->expects($matcher);
4347
$this->assertEquals($invocationMocker, $result);
48+
49+
$this->assertSame(
50+
(new MethodName(MockDelegateFunctionBuilder::METHOD))->toString(),
51+
($invocationMocker->getMatcher()->methodNameMatcher
52+
?? $invocationMocker->getMatcher()->getMethodNameMatcher())->toString()
53+
);
4454
}
4555

4656
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /