/**
  * Tests `Collection::rewind` and `Collection::current`.
  */
 public function testNextRewindCurrent()
 {
     $collection = new DocumentSet(array('data' => array('title' => 'Lorem Ipsum', 'value' => 42, 'foo' => 'bar')));
     $this->assertEqual('Lorem Ipsum', $collection->current());
     $this->assertEqual(42, $collection->next());
     $this->assertEqual('bar', $collection->next());
     $this->assertEqual('Lorem Ipsum', $collection->rewind());
     $this->assertEqual(42, $collection->next());
 }
Exemple #2
0
 public function testSetMultiple()
 {
     $doc = new DocumentSet(array('model' => $this->_model));
     $doc->set(array(array('id' => 1, 'name' => 'One', 'content' => 'Lorem ipsum one'), array('id' => 2, 'name' => 'Two', 'content' => 'Lorem ipsum two'), array('id' => 3, 'name' => 'Three', 'content' => 'Lorem ipsum three')));
     $expected = array('id' => 1, 'name' => 'One', 'content' => 'Lorem ipsum one');
     return;
     $result = $doc->current()->data();
     $this->assertEqual($expected, $result);
     $expected = array('id' => 2, 'name' => 'Two', 'content' => 'Lorem ipsum two');
     $result = $doc->next()->data();
     $this->assertEqual($expected, $result);
 }