function testAdd()
{
$scope = __FUNCTION__;
Redis::config(array('format' => $scope));
// simplest call
$expected = array('bar');
$this->assertEqual(1, Lists::add('foo', 'bar'));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:foo", 0, -1));
$expected = array('bar', 'baz');
$this->assertEqual(2, Lists::add('foo', 'baz'));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:foo", 0, -1));
// call with array
$expected = array('bar', 'baz');
$this->assertEqual(2, Lists::add('withArray', array('bar', 'baz')));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:withArray", 0, -1));
// call with big array
$expected = array_fill(0, 100, 'blub');
$this->assertEqual(100, Lists::add('manyItems', $expected));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:manyItems", 0, -1));
// call with bigger array
$expected = array_fill(0, 1000, 'blub');
$this->assertEqual(1000, Lists::add('lotsItems', $expected));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:lotsItems", 0, -1));
// call with collection
$data = array('lassy', 'barker', 'wuff', 'patty');
$dogs = new Collection(compact('data'));
$expected = $dogs->to('array');
$this->assertEqual(4, Lists::add('dogs', $dogs));
$this->assertEqual($expected, $this->redis->lRange("{$scope}:lists:dogs", 0, -1));
// offset
$this->assertEqual(array('barker'), $this->redis->lRange("{$scope}:lists:dogs", 1, 1));
}