Skip to content

Commit 5c65c03

Browse files
committed
Updated unit tests
1 parent 1d6133d commit 5c65c03

File tree

3 files changed

+21
-127
lines changed

3 files changed

+21
-127
lines changed

tests/TestRedis.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
2-
require_once 'PHPUnit/Framework/TestCase.php';
2+
require_once 'PHPUnit.php';
33

44
echo "Note: these tests might take up to a minute. Don't worry :-)\n";
55

6-
class Redis_Test extends PHPUnit_Framework_TestCase
6+
class Redis_Test extends PHPUnit_TestCase
77
{
88
const HOST = '127.0.0.1';
99
const PORT = 6379;
@@ -34,7 +34,7 @@ public function tearDown()
3434
if($this->redis) {
3535
$this->redis->close();
3636
}
37-
unset($this->redis);
37+
// unset($this->redis);
3838
}
3939

4040
public function reset()
@@ -52,7 +52,6 @@ public function testPing()
5252
while($count --) {
5353
$this->assertEquals('+PONG', $this->redis->ping());
5454
}
55-
5655
}
5756

5857
public function testBitsets() {
@@ -416,27 +415,27 @@ public function testDelete()
416415
$this->redis->set($key, 'val');
417416
$this->assertEquals('val', $this->redis->get($key));
418417
$this->assertEquals(1, $this->redis->delete($key));
419-
$this->assertEquals(null, $this->redis->get($key));
418+
$this->assertEquals(false, $this->redis->get($key));
420419

421420
// multiple, all existing
422421
$this->redis->set('x', 0);
423422
$this->redis->set('y', 1);
424423
$this->redis->set('z', 2);
425424
$this->assertEquals(3, $this->redis->delete('x', 'y', 'z'));
426-
$this->assertEquals(NULL, $this->redis->get('x'));
427-
$this->assertEquals(NULL, $this->redis->get('y'));
428-
$this->assertEquals(NULL, $this->redis->get('z'));
425+
$this->assertEquals(false, $this->redis->get('x'));
426+
$this->assertEquals(false, $this->redis->get('y'));
427+
$this->assertEquals(false, $this->redis->get('z'));
429428

430429
// multiple, none existing
431430
$this->assertEquals(0, $this->redis->delete('x', 'y', 'z'));
432-
$this->assertEquals(NULL, $this->redis->get('x'));
433-
$this->assertEquals(NULL, $this->redis->get('y'));
434-
$this->assertEquals(NULL, $this->redis->get('z'));
431+
$this->assertEquals(false, $this->redis->get('x'));
432+
$this->assertEquals(false, $this->redis->get('y'));
433+
$this->assertEquals(false, $this->redis->get('z'));
435434

436435
// multiple, some existing
437436
$this->redis->set('y', 1);
438437
$this->assertEquals(1, $this->redis->delete('x', 'y', 'z'));
439-
$this->assertEquals(NULL, $this->redis->get('y'));
438+
$this->assertEquals(false, $this->redis->get('y'));
440439

441440
$this->redis->set('x', 0);
442441
$this->redis->set('y', 1);
@@ -1682,10 +1681,10 @@ public function testZX() {
16821681
$this->assertTrue(0 === $this->redis->zUnion('keyU', array('X', 'Y')));
16831682
$this->assertTrue(array() === $this->redis->zRange('keyU', 0, -1));
16841683

1685-
// !Exist U Exist
1686-
$this->redis->delete('keyU');
1687-
$this->assertTrue(2 === $this->redis->zUnion('keyU', array('key1', 'X')));
1688-
$this->assertTrue($this->redis->zRange('key1', 0, -1) === $this->redis->zRange('keyU', 0, -1));
1684+
// !Exist U Exist → 0
1685+
$this->redis->delete('keyU', 'X');
1686+
var_dump($this->redis->zUnion('keyU', array('key1', 'X')));
1687+
$this->assertTrue(0 === $this->redis->zUnion('keyU', array('key1', 'X')));
16891688

16901689
// test weighted zUnion
16911690
$this->redis->delete('keyZ');
@@ -2733,7 +2732,12 @@ private function checkSerializer($mode) {
27332732
$this->assertTrue($this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE) === TRUE); // set ok
27342733
$this->assertTrue($this->redis->getOption(Redis::OPT_SERIALIZER) === Redis::SERIALIZER_NONE); // get ok
27352734
}
2736-
27372735
}
27382736

2737+
$suite = new PHPUnit_TestSuite("Redis_Test");
2738+
$result = PHPUnit::run($suite);
2739+
2740+
echo $result->toString();
2741+
2742+
27392743
?>

tests/commandsStatus.txt

Lines changed: 0 additions & 107 deletions
This file was deleted.

tests/executeTests.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)