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

This commit is contained in:
Daniele Alessandri
2013-12-19 11:50:39 +01:00
parent b7cba07014
commit b45f87caf2
+8 -6
View File
@@ -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);
}
/**