소스 검색

Fix of Predis\Client mock creation

Predis\Client uses __call method to process commands (rPush, lTrim),
getPartialMock() doesn't work with addMethods()
Victor Pryazhnikov 4 년 전
부모
커밋
67294a3a5f
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      tests/Monolog/Handler/RedisHandlerTest.php

+ 4 - 1
tests/Monolog/Handler/RedisHandlerTest.php

@@ -109,7 +109,10 @@ class RedisHandlerTest extends TestCase
     {
         $redis = $this->createPartialMock('Predis\Client', ['transaction']);
 
-        $redisTransaction = $this->createPartialMock('Predis\Client', ['rPush', 'lTrim']);
+        $redisTransaction = $this->getMockBuilder('Predis\Client')
+            ->disableOriginalConstructor()
+            ->addMethods(['rPush', 'lTrim'])
+            ->getMock();
 
         $redisTransaction->expects($this->once())
             ->method('rPush')