/** * @depends testInit * @param Set * @return void */ public function testClear(Set $setObject) { $this->assertFalse($setObject->isEmpty()); $setObject->clear(); $this->assertTrue($setObject->isEmpty()); }
echo 'Add duplicate Array (17,11,12,18): '; echo '<br/>'; try { $setObject->addAll(array(17, 11, 12, 18)); // 11 and 12 are duplicate elements } catch (SetException $exception) { echo ' > Exception!<br/>'; } echo 'Count: '; echo count($setObject); echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'remove value: '; echo '<br/>'; $setObject = new Set(); $setObject->addAll(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); $setObject->remove(4); $setObject->remove(10); echo 'Count: '; echo count($setObject); echo '<br/>'; echo 'is empty (has any entries): '; if ($setObject->isEmpty()) { echo 'FALSE'; } else { echo 'TRUE'; } echo '<br/>'; echo 'clear set'; $setObject->clear();