8000 Update WAITAOF test to use different assertion + add debug info · phpredis/phpredis@9b90c03 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b90c03

Browse files
Update WAITAOF test to use different assertion + add debug info
* Add what value failed to pass our callback assertion so we can see what we actually got from the server. * WAITAOF requires Redis >= 7.2.0 so don't run it if the server is older than that.
1 parent ed7c9f6 commit 9b90c03

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

tests/RedisTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7678,10 +7678,16 @@ protected function execWaitAOF() {
76787678
}
76797679

76807680
public function testWaitAOF() {
7681+
if (!$this->minVersionCheck("7.2.0"))
7682+
$this->markTestSkipped();
7683+
76817684
$res = $this->execWaitAOF();
7682-
$this->assertTrue(is_array($res) && count($res) == 2 &&
7683-
isset($res[0]) && is_int($res[0]) &&
7684-
isset($res[1]) && is_int($res[1]));
7685+
$this->assertValidate($res, function ($v) {
7686+
if ( ! is_array($v) || count($v) != 2)
7687+
return false;
7688+
return isset($v[0]) && is_int($v[0]) &&
7689+
isset($v[1]) && is_int($v[1]);
7690+
});
76857691
}
76867692

76877693
/* Make sure we handle a bad option value gracefully */

tests/TestSuite.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ protected function assertValidate($val, $cb) {
140140
return true;
141141

142142
$bt = debug_backtrace(false);
143-
self::$errors []= sprintf("Assertion failed: %s:%d (%s)\n",
144-
$bt[0]["file"], $bt[0]["line"], $bt[1]["function"]);
143+
self::$errors []= sprintf("Assertion failed: %s:%d (%s)\n--- VALUE ---\n%s\n",
144+
$bt[0]["file"], $bt[0]["line"], $bt[1]["function"], print_r($val, true));
145145

146146
return false;
147147
}

0 commit comments

Comments
 (0)
0