Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ env:
- PHPUNIT_VERSION=~7.2.0
- PHPUNIT_VERSION=~7.3.0
- PHPUNIT_VERSION=~7.4.0
- PHPUNIT_VERSION=~7.5.0
- PHPUNIT_VERSION=~8.0.0

php:
- 7.3
Expand All @@ -30,8 +32,16 @@ php:
matrix:
fast_finish: true
exclude:
- php: 7.1
env: PHPUNIT_VERSION=dev-master
- php: 7.1
env: PHPUNIT_VERSION=~8.0.0
- php: 7
env: PHPUNIT_VERSION=dev-master
- php: 7
env: PHPUNIT_VERSION=~8.0.0
- php: 7
env: PHPUNIT_VERSION=~7.5.0
- php: 7
env: PHPUNIT_VERSION=~7.4.0
- php: 7
Expand Down
14 changes: 14 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ class_alias(
);
}

if (! class_exists(\PHPUnit\Framework\MockObject\Matcher\MethodName::class)) {
class_alias(
\PHPUnit_Framework_MockObject_Matcher_MethodName::class,
\PHPUnit\Framework\MockObject\Matcher\MethodName::class
);
}

if (! interface_exists(\PHPUnit\Framework\MockObject\Stub\MatcherCollection::class)) {
class_alias(
\PHPUnit_Framework_MockObject_Stub_MatcherCollection::class,
\PHPUnit\Framework\MockObject\Stub\MatcherCollection::class
);
}

if (! class_exists(\PHPUnit\Framework\BaseTestListener::class)) {
include __DIR__ . '/compatibility/BaseTestListener.php';
class_alias(
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require": {
"php": ">=7",
"phpunit/phpunit": "^6 || ^7",
"phpunit/phpunit": "^6 || ^7 || ^8",
"php-mock/php-mock-integration": "^2"
},
"archive": {
Expand Down
16 changes: 13 additions & 3 deletions tests/MockObjectProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace phpmock\phpunit;

use PHPUnit\Framework\MockObject\Matcher\MethodName;
use PHPUnit\Framework\MockObject\Stub\MatcherCollection;
use PHPUnit\Framework\TestCase;
use phpmock\integration\MockDelegateFunctionBuilder;
use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
Expand Down Expand Up @@ -29,9 +31,11 @@ public function testExpects()
{
$matcher = $this->getMockBuilder(Invocation::class)->getMock();

$invocationMocker = $this->getMockBuilder(InvocationMocker::class)->disableOriginalConstructor()->getMock();
$invocationMocker->expects($this->once())->method("method")
->with(MockDelegateFunctionBuilder::METHOD)->willReturn($invocationMocker);
$invocationMocker = new InvocationMocker(
$this->prophesize(MatcherCollection::class)->reveal(),
$this->prophesize(Invocation::class)->reveal(),
[MockDelegateFunctionBuilder::METHOD]
);

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

$result = $proxy->expects($matcher);
$this->assertEquals($invocationMocker, $result);

$this->assertSame(
(new MethodName(MockDelegateFunctionBuilder::METHOD))->toString(),
($invocationMocker->getMatcher()->methodNameMatcher
?? $invocationMocker->getMatcher()->getMethodNameMatcher())->toString()
);
}

/**
Expand Down