Пример #1
0
 /**
  * @test
  */
 public function iteratorMethodsAreCorrectlyImplemented()
 {
     $array1 = array('foo' => 'Foo1', 'bar' => 'Bar1');
     $array2 = array('foo' => 'Foo2', 'bar' => 'Bar2');
     $this->assertEquals($array1, $this->queryResult->current());
     $this->assertTrue($this->queryResult->valid());
     $this->queryResult->next();
     $this->assertEquals($array2, $this->queryResult->current());
     $this->assertTrue($this->queryResult->valid());
     $this->assertEquals(1, $this->queryResult->key());
     $this->queryResult->next();
     $this->assertFalse($this->queryResult->current());
     $this->assertFalse($this->queryResult->valid());
     $this->assertNull($this->queryResult->key());
     $this->queryResult->rewind();
     $this->assertEquals(0, $this->queryResult->key());
     $this->assertEquals($array1, $this->queryResult->current());
 }
 /**
  * Returns the query result count
  *
  * @return integer The query result count
  * @api
  */
 public function count()
 {
     $result = new QueryResult($this);
     return $result->count();
 }