function testRead() { $scope = __FUNCTION__; Redis::config(array('format' => $scope)); $this->assertTrue($this->redis->hMset("{$scope}:foo", array('name' => 'Joe', 'salary' => 2000))); $this->assertTrue($this->redis->hExists("{$scope}:foo", 'name')); $this->assertTrue($this->redis->hExists("{$scope}:foo", 'salary')); $this->assertTrue($this->redis->set("{$scope}:bar", 'baz')); $this->assertTrue($this->redis->set("{$scope}:baz", 'foobar')); $expected = array('name' => 'Joe', 'salary' => '2000'); $this->assertEqual($expected, Redis::read('foo')); $expected = 'baz'; $this->assertEqual($expected, Redis::read('bar')); $expected = 'foobar'; $this->assertEqual($expected, Redis::read('baz')); $expected = array('bar' => 'baz', 'baz' => 'foobar'); $this->assertEqual($expected, Redis::read(array('bar', 'baz'))); $expected = array('bar' => 'baz', 'baz' => 'foobar', 'foo' => array('name' => 'Joe', 'salary' => '2000')); $this->assertEqual($expected, Redis::read(array('bar', 'baz', 'foo'))); }