1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Adapted for version 5.3.7 from
From 67f2b31d5dbb7ba0ad423d07a1256f14b6f019c5 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 23 Mar 2023 10:05:04 +0100
Subject: [PATCH] fix testObject for redis 7.2
---
tests/RedisTest.php | 8 +++++---
tests/TestSuite.php | 6 +++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff -up ./tests/RedisTest.php.pr2335 ./tests/RedisTest.php
--- ./tests/RedisTest.php.pr2335 2023-03-23 10:17:56.611597097 +0100
+++ ./tests/RedisTest.php 2023-03-23 10:19:48.911307411 +0100
@@ -2744,14 +2744,15 @@ class Redis_Test extends TestSuite
/* Newer versions of redis are going to encode lists as 'quicklists',
* so 'quicklist' or 'ziplist' is valid here */
$str_encoding = $this->redis->object('encoding', 'key');
- $this->assertTrue($str_encoding === "ziplist" || $str_encoding === 'quicklist');
+ $this->assertTrue($str_encoding === "ziplist" || $str_encoding === 'quicklist' || $str_encoding === 'listpack', $str_encoding);
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
$this->assertTrue($this->redis->object('idletime', 'key') === 0);
$this->redis->del('key');
$this->redis->sadd('key', 'value');
- $this->assertTrue($this->redis->object('encoding', 'key') === "hashtable");
+ $str_encoding = $this->redis->object('encoding', 'key');
+ $this->assertTrue($str_encoding === "hashtable" || $str_encoding === 'listpack', $str_encoding);
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
$this->assertTrue($this->redis->object('idletime', 'key') === 0);
diff -up ./tests/TestSuite.php.pr2335 ./tests/TestSuite.php
--- ./tests/TestSuite.php.pr2335 2022-02-15 19:25:22.000000000 +0100
+++ ./tests/TestSuite.php 2023-03-23 10:17:56.611597097 +0100
@@ -99,13 +99,13 @@ class TestSuite
return false;
}
- protected function assertTrue($bool) {
+ protected function assertTrue($bool, $msg='') {
if($bool)
return true;
$bt = debug_backtrace(false);
- self::$errors []= sprintf("Assertion failed: %s:%d (%s)\n",
- $bt[0]["file"], $bt[0]["line"], $bt[1]["function"]);
+ self::$errors []= sprintf("Assertion failed: %s:%d (%s) %s\n",
+ $bt[0]["file"], $bt[0]["line"], $bt[1]["function"], $msg);
return false;
}
|