From 4e0c09a3cfc04bbf8992db2a03cc725fafd07c8b Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sun, 11 Dec 2011 16:57:47 +0100 Subject: [PATCH] Fix E_STRICT error messages. --- lib/Predis/Commands/PrefixHelpers.php | 2 +- tests/PHPUnit/ArrayHasSameValuesConstraint.php | 8 +++++--- tests/Predis/Commands/ServerSlowlogTest.php | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Predis/Commands/PrefixHelpers.php b/lib/Predis/Commands/PrefixHelpers.php index f344eed5..98180c6e 100644 --- a/lib/Predis/Commands/PrefixHelpers.php +++ b/lib/Predis/Commands/PrefixHelpers.php @@ -24,7 +24,7 @@ class PrefixHelpers * @param ICommand $command Command instance. * @param string $prefix Prefix string. */ - public function first(ICommand $command, $prefix) + public static function first(ICommand $command, $prefix) { if ($arguments = $command->getArguments()) { $arguments[0] = "$prefix{$arguments[0]}"; diff --git a/tests/PHPUnit/ArrayHasSameValuesConstraint.php b/tests/PHPUnit/ArrayHasSameValuesConstraint.php index 8fa3d3e7..c19cb781 100644 --- a/tests/PHPUnit/ArrayHasSameValuesConstraint.php +++ b/tests/PHPUnit/ArrayHasSameValuesConstraint.php @@ -30,13 +30,15 @@ class ArrayHasSameValuesConstraint extends PHPUnit_Framework_Constraint /** * {@inheritdoc} */ - public function evaluate($other) + public function evaluate($other, $description = '', $returnResult = FALSE) { + $description = $description ?: 'Failed asserting that two arrays have the same elements.'; + if (count($this->array) !== count($other)) { - throw new PHPUnit_Framework_ExpectationFailedException('Failed asserting that two arrays have the same elements.'); + throw new PHPUnit_Framework_ExpectationFailedException($description); } if (array_diff($this->array, $other)) { - throw new PHPUnit_Framework_ExpectationFailedException('Failed asserting that two arrays have the same elements.'); + throw new PHPUnit_Framework_ExpectationFailedException($description); } return true; diff --git a/tests/Predis/Commands/ServerSlowlogTest.php b/tests/Predis/Commands/ServerSlowlogTest.php index 92f579cc..3ee58ece 100644 --- a/tests/Predis/Commands/ServerSlowlogTest.php +++ b/tests/Predis/Commands/ServerSlowlogTest.php @@ -79,7 +79,8 @@ class ServerSlowlogTest extends CommandTestCase { $redis = $this->getClient(); - $threshold = array_pop($redis->config('get', 'slowlog-log-slower-than')); + $config = $redis->config('get', 'slowlog-log-slower-than'); + $threshold = array_pop($config); $redis->config('set', 'slowlog-log-slower-than', 0); $redis->set('foo', 'bar');