diff options
author | Arnold Daniels <arnold@jasny.net> | 2016-11-03 23:45:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 23:45:36 +0100 |
commit | f3d05dfca77843a869e938028824f19307780939 (patch) | |
tree | 846c5e559360e530d200d897f67b5af02f8795e5 /tests/support | |
parent | aa31c40618b0cc7b43b7a1cb107e97b49e2c06f1 (diff) | |
parent | bd4cb77fbf04923fa31a08fdd1f33f2c0db87864 (diff) | |
download | router-1.0.0.zip router-1.0.0.tar.gz router-1.0.0.tar.bz2 |
Merge pull request #13 from jasny/fix-testsv1.0.0
Fix tests
Diffstat (limited to 'tests/support')
-rw-r--r-- | tests/support/TestHelpers.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/support/TestHelpers.php b/tests/support/TestHelpers.php new file mode 100644 index 0000000..e4fdff7 --- /dev/null +++ b/tests/support/TestHelpers.php @@ -0,0 +1,30 @@ +<?php + +namespace Jasny\Router; + +use PHPUnit_Framework_MockObject_Matcher_Invocation as Invocation; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +/** + * Helper methods for PHPUnit tests + */ +trait TestHelpers +{ + /** + * Create mock for next callback + * + * @param Invocation $matcher + * @param array $with With arguments + * @param mixed $return + * @return MockObject + */ + protected function createCallbackMock(Invocation $matcher, $with = [], $return = null) + { + $callback = $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock(); + $callback->expects($matcher)->method('__invoke') + ->with(...$with) + ->willReturn($return); + + return $callback; + } +} |