Esempio n. 1
0
 public function testPush()
 {
     $listener = Mockery::mock(ListenerInterface::CLASS);
     $listener->shouldReceive('onCollectionChanged')->with(CollectionChangedEvent::CLASS)->once();
     $items = $this->createRandomItems();
     $list = new ArrayList($items);
     $list->addListener($listener);
     $prev_count = $list->getSize();
     $new_item = TestObject::createRandomInstance();
     $list->push($new_item);
     $this->assertEquals($prev_count + 1, $list->getSize());
     $this->assertEquals($new_item, $list->getLast());
 }