瀏覽代碼

fix test for ArgumentCountError exception with PHP 7.1

Remi Collet 8 年之前
父節點
當前提交
d1290dfde0
共有 1 個文件被更改,包括 20 次插入1 次删除
  1. 20 1
      tests/Predis/Command/RawCommandTest.php

+ 20 - 1
tests/Predis/Command/RawCommandTest.php

@@ -74,10 +74,29 @@ class RawCommandTest extends PredisTestCase
      * argument is missing, PHP emits an E_WARNING.
      * argument is missing, PHP emits an E_WARNING.
      *
      *
      * @group disconnected
      * @group disconnected
-     * @expectedException \PHPUnit_Framework_Error_Warning
      */
      */
     public function testPHPWarningOnMissingCommandIDWithStaticCreate()
     public function testPHPWarningOnMissingCommandIDWithStaticCreate()
     {
     {
+        if (version_compare(PHP_VERSION, "7.1", '>')) {
+            $this->markTestSkipped('only for PHP < 7.1');
+        }
+        $this->setExpectedException('PHPUnit_Framework_Error_Warning');
+        RawCommand::create();
+    }
+
+    /**
+     * The signature of RawCommand::create() requires one argument which is the
+     * ID of the command (other arguments are fetched dinamically). If the first
+     * argument is missing, PHP 7.1 throw an exception
+     *
+     * @group disconnected
+     */
+    public function testPHPWarningOnMissingCommandIDWithStaticCreate71()
+    {
+        if (version_compare(PHP_VERSION, "7.1", '<')) {
+            $this->markTestSkipped('only for PHP > 7.1');
+        }
+        $this->setExpectedException('ArgumentCountError');
         RawCommand::create();
         RawCommand::create();
     }
     }