Skip to content

Commit f3f0bec

Browse files
committed
Shim createMock for php7.2 compatibility
1 parent d78e4da commit f3f0bec

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/CredisSentinelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function testGetHostAndPort()
155155
$host = 'localhost';
156156
$port = '123456';
157157

158-
$client = $this->createMock('\Credis_Client');
158+
$client = $this->createMockShim('\Credis_Client');
159159
$sentinel = new Credis_Sentinel($client);
160160

161161
$client->expects($this->once())->method('getHost')->willReturn($host);

tests/CredisTestCommon.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ public static function tearDownAfterClass()
151151
}
152152
}
153153

154+
155+
//
154156
/**
157+
* php 7.2 compat fix, as directly polyfilling for older PHPUnit causes a function signature compatibility issue
158+
* This is due to the defined return type
159+
*
155160
* Polyfill for older PHPUnit
156161
*/
157-
protected function createMock($originalClassName)
162+
protected function createMockShim($originalClassName)
158163
{
159164
if (method_exists($this, 'getMock')) {
160165
return $this->getMock($originalClassName);
@@ -165,6 +170,7 @@ protected function createMock($originalClassName)
165170

166171
/**
167172
* php 7.2 compat fix, as directly polyfilling for older PHPUnit causes a function signature compatibility issue
173+
* This is due to the defined return type
168174
*/
169175
public function setExpectedExceptionShim($class, $message = NULL, $code = NULL)
170176
{

0 commit comments

Comments
 (0)