Selaa lähdekoodia

[tests] Add $message as third parameter for our custom assertions.

Daniele Alessandri 11 vuotta sitten
vanhempi
commit
b45f87caf2
1 muutettua tiedostoa jossa 8 lisäystä ja 6 poistoa
  1. 8 6
      tests/PHPUnit/PredisTestCase.php

+ 8 - 6
tests/PHPUnit/PredisTestCase.php

@@ -40,8 +40,9 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
      *
      * @param array|string|CommandInterface $expected Expected command.
      * @param mixed                         $actual   Actual command.
+     * @param string                        $message  Optional assertion message.
      */
-    public function assertRedisCommand($expected, $actual)
+    public function assertRedisCommand($expected, $actual, $message = '')
     {
         if (is_array($expected)) {
             @list($command, $arguments) = $expected;
@@ -50,18 +51,19 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
             $arguments = null;
         }
 
-        $this->assertThat($actual, new RedisCommandConstraint($command, $arguments));
+        $this->assertThat($actual, new RedisCommandConstraint($command, $arguments), $message);
     }
 
     /**
      * Asserts that two arrays have the same values, even if with different order.
      *
-     * @param array $expected Expected array.
-     * @param array $actual   Actual array.
+     * @param array  $expected Expected array.
+     * @param array  $actual   Actual array.
+     * @param string $message  Optional assertion message.
      */
-    public function assertSameValues(array $expected, array $actual)
+    public function assertSameValues(array $expected, array $actual, $message = '')
     {
-        $this->assertThat($actual, new ArrayHasSameValuesConstraint($expected));
+        $this->assertThat($actual, new ArrayHasSameValuesConstraint($expected), $message);
     }
 
     /**