/**
  * Test the scan family of commands
  */
 public function testScan()
 {
     $this->redis->flushdb();
     $keys = ['testScan', 'testScanHello', 'testScanHallo', 'testScanHaallo', 'testScanHoula', 'testScan2', 'testScanHello2', 'testScanHallo2', 'testScanHaallo2', 'testScanHoula2', 'testScan3', 'testScanHello3', 'testScanHallo3', 'testScanHaallo3', 'testScanHoula3'];
     foreach ($keys as $key) {
         $this->redis->set($key, 'someValue');
     }
     // a bit tricky to test, since we can't determine the outcome of a single iteration (or can we?)
     // so we just iterate until the iterator is exhausted and then compare the final results
     $iterator = 0;
     // we unroll the iteration here, to have better control over the involved values
     $result = $this->redis->scan($iterator);
     $this->assertNotEmpty($result);
     //$this->assertSame(10, count($result));
     $this->assertNotSame(0, $iterator);
     $result = array_merge($result, $this->redis->scan($iterator));
     foreach ($keys as $key) {
         $this->assertContains($key, $result);
     }
     $this->assertSame(15, count($result));
     $this->assertSame(0, $iterator);
     $result1 = $this->redis->scan($iterator, 'testScanH?llo', 20);
     $this->assertContains('testScanHello', $result1);
     $this->assertContains('testScanHallo', $result1);
     $this->assertEquals(2, count($result1));
     $this->assertSame(0, $iterator);
     $result2 = $this->redis->scan($iterator, 'testScanH*llo', 20);
     $this->assertContains('testScanHello', $result2);
     $this->assertContains('testScanHallo', $result2);
     $this->assertContains('testScanHaallo', $result2);
     $this->assertEquals(3, count($result2));
     $this->assertSame(0, $iterator);
     $result3 = $this->redis->scan($iterator, 'testScanH[ae]llo', 20);
     $this->assertContains('testScanHello', $result3);
     $this->assertContains('testScanHallo', $result3);
     $this->assertEquals(2, count($result3));
     $this->assertSame(0, $iterator);
     $result4 = $this->redis->scan($iterator, '*', 20);
     $this->assertEquals(15, count($result4));
     $this->assertSame(0, $iterator);
 }