-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/40-phpunit-8.4'
- Loading branch information
Showing
14 changed files
with
290 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.phpunit.result.cache | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace phpmock\phpunit; | ||
|
||
use phpmock\generator\MockFunctionGenerator; | ||
use PHPUnit\Framework\MockObject\Invocation; | ||
use PHPUnit\Framework\MockObject\Rule\InvocationOrder; | ||
|
||
/** | ||
* Removes default arguments from the invocation. | ||
* | ||
* @author Markus Malkusch <[email protected]> | ||
* @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations | ||
* @license http://www.wtfpl.net/txt/copying/ WTFPL | ||
* @internal | ||
*/ | ||
class DefaultArgumentRemoverReturnTypes84 extends InvocationOrder | ||
{ | ||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
public function invokedDo(Invocation $invocation) | ||
{ | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
public function matches(Invocation $invocation) : bool | ||
{ | ||
$iClass = class_exists(Invocation::class); | ||
|
||
if ($iClass | ||
|| $invocation instanceof Invocation\StaticInvocation | ||
) { | ||
$this->removeDefaultArguments( | ||
$invocation, | ||
$iClass ? Invocation::class : Invocation\StaticInvocation::class | ||
); | ||
} else { | ||
MockFunctionGenerator::removeDefaultArguments($invocation->parameters); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function verify() : void | ||
{ | ||
} | ||
|
||
/** | ||
* This method is not defined in the interface, but used in | ||
* PHPUnit_Framework_MockObject_InvocationMocker::hasMatchers(). | ||
* | ||
* @return boolean | ||
* @see \PHPUnit_Framework_MockObject_InvocationMocker::hasMatchers() | ||
*/ | ||
public function hasMatchers() | ||
{ | ||
return false; | ||
} | ||
|
||
public function toString() : string | ||
{ | ||
return __CLASS__; | ||
} | ||
|
||
/** | ||
* Remove default arguments from StaticInvocation or its children (hack) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
private function removeDefaultArguments(Invocation $invocation, string $class) | ||
{ | ||
$remover = function () { | ||
MockFunctionGenerator::removeDefaultArguments($this->parameters); | ||
}; | ||
|
||
$remover->bindTo($invocation, $class)(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace phpmock\phpunit; | ||
|
||
use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker; | ||
use PHPUnit\Framework\MockObject\InvocationHandler; | ||
use PHPUnit\Framework\MockObject\Rule\InvocationOrder; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use phpmock\integration\MockDelegateFunctionBuilder; | ||
|
||
/** | ||
* Proxy for PHPUnit's PHPUnit_Framework_MockObject_MockObject. | ||
* | ||
* @author Markus Malkusch <[email protected]> | ||
* @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations | ||
* @license http://www.wtfpl.net/txt/copying/ WTFPL | ||
* @internal | ||
*/ | ||
class MockObjectProxyReturnTypes84 implements MockObject | ||
{ | ||
/** | ||
* @var MockObject $mockObject The mock object. | ||
*/ | ||
private $mockObject; | ||
|
||
/** | ||
* Inject the subject. | ||
* | ||
* @param MockObject $mockObject The subject. | ||
*/ | ||
public function __construct(MockObject $mockObject) | ||
{ | ||
$this->mockObject = $mockObject; | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
// @codingStandardsIgnoreStart | ||
public function __phpunit_getInvocationHandler(): InvocationHandler | ||
{ | ||
return $this->mockObject->__phpunit_getInvocationHandler(); | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
// @codingStandardsIgnoreStart | ||
public function __phpunit_setOriginalObject($originalObject) : void | ||
{ | ||
// @codingStandardsIgnoreEnd | ||
$this->mockObject->__phpunit_setOriginalObject($originalObject); | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
// @codingStandardsIgnoreStart | ||
public function __phpunit_verify(bool $unsetInvocationMocker = true) : void | ||
{ | ||
// @codingStandardsIgnoreEnd | ||
$this->mockObject->__phpunit_verify($unsetInvocationMocker); | ||
} | ||
|
||
public function expects(InvocationOrder $matcher) : BuilderInvocationMocker | ||
{ | ||
return $this->mockObject->expects($matcher)->method(MockDelegateFunctionBuilder::METHOD); | ||
} | ||
|
||
/** | ||
* This method is not part of the contract but was found in | ||
* PHPUnit's mocked_class.tpl.dist. | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
// @codingStandardsIgnoreStart | ||
public function __phpunit_hasMatchers() : bool | ||
{ | ||
// @codingStandardsIgnoreEnd | ||
return $this->mockObject->__phpunit_hasMatchers(); | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
// @codingStandardsIgnoreStart | ||
public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration) : void | ||
{ | ||
// @codingStandardsIgnoreEnd | ||
$this->mockObject->__phpunit_setReturnValueGeneration($returnValueGeneration); | ||
} | ||
} |
Oops, something went wrong.