$collectionObject->add(11); $collectionObject->add(12); echo 'Count: '; echo count($collectionObject); echo '<br/>'; echo 'Add 13, 14, 15 and 16 as a array: '; echo '<br/>'; $collectionObject->addAll(array(13, 14, 15, 16)); echo 'Count: '; echo count($collectionObject); echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'remove value: '; echo '<br/>'; $collectionObject = new Collection(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); $collectionObject->remove(4); $collectionObject->remove(10); echo 'Count: '; echo count($collectionObject); echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'is empty (has any entries): '; if ($collectionObject->isEmpty()) { echo 'FALSE'; } else { echo 'TRUE'; } echo '<br/>'; echo 'clear list';
/** * @depends testInit * @param Collection * @return void */ public function testClear(Collection $collectionObject) { $this->assertFalse($collectionObject->isEmpty()); $collectionObject->clear(); $this->assertTrue($collectionObject->isEmpty()); }