8000 Update tests to allow users to use a custom class. · phpredis/phpredis@5f6ce41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f6ce41

Browse files
Update tests to allow users to use a custom class.
Add a mechanism that allows users to specify an arbitrary class name, in combination with a search path so that PhpRedis unit tests can be run against a different client. Additionally, this commit allows multiple classes to be invoked in one test execution either by passing multiple `--class` arguments, or a class argument with a comma separated value.
1 parent dc05d65 commit 5f6ce41

File tree

5 files changed

+290
-191
lines changed

5 files changed

+290
-191
lines changed

tests/RedisArrayTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function setUp() {
5959
if ($this->getAuth()) {
6060
$options['auth'] = $this->getAuth();
6161
}
62+
6263
$this->ra = new RedisArray($newRing, $options);
6364
$this->min_version = getMinVersion($this->ra);
6465
}
@@ -507,7 +508,7 @@ public function testMultiExec() {
507508

508509
// change both in a transaction.
509510
$host = $this->ra->_target('{employee:joe}'); // transactions are per-node, so we need a reference to it.
510-
$tr = $this->ra->multi($host)
511+
$this->ra->multi($host)
511512
->set('1_{employee:joe}_group', $newGroup)
512513
->set('1_{employee:joe}_salary', $newSalary)
513514
->exec();
@@ -603,7 +604,6 @@ public function testDiscard() {
603604
// Get after discard, unchanged:
604605
$this->assertTrue($this->ra->get($key) === 'test1');
605606
}
606-
607607
}
608608

609609
// Test custom distribution function
@@ -660,7 +660,6 @@ function run_tests($className, $str_filter, $str_host, $auth) {
660660
$newRing = ["$str_host:6379", "$str_host:6380", "$str_host:6381"];
661661
$oldRing = [];
662662
$serverList = ["$str_host:6379", "$str_host:6380", "$str_host:6381", "$str_host:6382"];
663-
664663
// run
665664
return TestSuite::run($className, $str_filter, $str_host, NULL, $auth);
666665
}

tests/RedisClusterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ public function testRandomKey() {
133133
}
134134

135135
public function testEcho() {
136-
$this->assertEquals($this->redis->echo('k1', 'hello'), 'hello');
137-
$this->assertEquals($this->redis->echo('k2', 'world'), 'world');
138-
$this->assertEquals($this->redis->echo('k3', " 0123 "), " 0123 ");
136+
$this->assertEquals($this->redis->echo('echo1', 'hello'), 'hello');
137+
$this->assertEquals($this->redis->echo('echo2', 'world'), 'world');
138+
$this->assertEquals($this->redis->echo('echo3', " 0123 "), " 0123 ");
139139
}
140140

141141
public function testSortPrefix() {

0 commit comments

Comments
 (0)
0