add() 공개 메소드

Add an item to the collection.
public add ( mixed $item ) : Collection
$item mixed
리턴 Collection
 public function testContainsIndicatesIfKeyedModelInArray()
 {
     $mockModel = m::mock('LMongo\\Eloquent\\Model');
     $mockModel->shouldReceive('getKey')->andReturn(1);
     $c = new Collection(array($mockModel));
     $mockModel2 = m::mock('LMongo\\Eloquent\\Model');
     $mockModel2->shouldReceive('getKey')->andReturn(2);
     $c->add($mockModel2);
     $this->assertTrue($c->contains(1));
     $this->assertTrue($c->contains(2));
     $this->assertFalse($c->contains(3));
 }