Преглед изворни кода

Fix of PhpAmqpLib\Channel\AMQPChannel mock creation

__destruct was removed in v2.5.0, but version check is impossible
(\PhpAmqpLib\Package::VERSION was introduced in v2.11.1)
Victor Pryazhnikov пре 4 година
родитељ
комит
240a159d44
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      tests/Monolog/Handler/AmqpHandlerTest.php

+ 6 - 1
tests/Monolog/Handler/AmqpHandlerTest.php

@@ -84,8 +84,13 @@ class AmqpHandlerTest extends TestCase
 
         $messages = [];
 
+        $methodsToMock = ['basic_publish'];
+        if (method_exists('PhpAmqpLib\Channel\AMQPChannel', '__destruct')) {
+            $methodsToMock[] = '__destruct';
+        }
+
         $exchange = $this->getMockBuilder('PhpAmqpLib\Channel\AMQPChannel')
-            ->onlyMethods(['basic_publish', '__destruct'])
+            ->onlyMethods($methodsToMock)
             ->disableOriginalConstructor()
             ->getMock();