Example #1
0
 public function getCollection()
 {
     $collection = new Collection();
     $collection->add(1);
     $collection->add(2);
     $collection->add(3);
     $collection->add(4);
     $collection->add(5);
     $collection->add(6);
     return array(array(new Paginator($collection, 1, 1)));
 }
Example #2
0
 public function testSearchForAMissingElementReturnsFalse()
 {
     $collection = new Collection();
     $collection->add((object) array('property' => '12345'));
     $collection->add((object) array('property' => '12'));
     $collection->add((object) array('property' => '2'));
     $this->assertFalse($collection->exists(function ($element) {
         return $element->property === '1';
     }));
 }
Example #3
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Collection is read only
  */
 public function testRemoveElementThrowsExceptionAsCollectionIsReadOnly()
 {
     $collection = new Collection();
     $collection->setReadOnly(false);
     $collection->add('test');
     $collection->setReadOnly(true);
     unset($collection[0]);
 }