public function testInsertObject_atIndex() { $array = RTMutableArray::arrayWithArray(array("42", 42, YES, NO)); try { $array->insertObject_atIndex(null, 0); $this->fail("Should not be able to insert a null object"); } catch (InvalidArgumentException $e) { try { $array->insertObject_atIndex("object", $array->count() + 1); $this->fail("Should not be able to add an object using an out of bounds index."); } catch (RTRangeException $e) { return; } } return fail("Expected specific exceptions to be thrown."); }
/** Returns the components of the URLs path as an array. \returns RTArray */ public function pathComponents() { $path = RTString::stringWithString($this->path()); $components = RTMutableArray::arrayWithArray($path->componentsSeparatedByString("/")); if ($components->count() > 0) { $components->removeObjectAtIndex(0); } return RTArray::arrayWithArray($components); }