/** * Test ArrayAccess methods * * @covers \Hubzero\Pathway\Trail::set * @covers \Hubzero\Pathway\Trail::get * @covers \Hubzero\Pathway\Trail::has * @covers \Hubzero\Pathway\Trail::forget * @covers \Hubzero\Pathway\Trail::offsetSet * @covers \Hubzero\Pathway\Trail::offsetGet * @covers \Hubzero\Pathway\Trail::offsetUnset * @covers \Hubzero\Pathway\Trail::offsetExists * @return void **/ public function testArrayAccessMethods() { $pathway = new Trail(); $crumb1 = new Item('Crumb 1', 'index.php?option=com_lorem'); $crumb2 = new Item('Crumb 2', 'index.php?option=com_ipsum'); $crumb3 = new Item('Crumb 3', 'index.php?option=com_dolor'); $pathway->set(0, $crumb1); $pathway->set(1, $crumb2); $pathway->offsetSet(2, $crumb3); $this->assertTrue($pathway->has(1)); $this->assertFalse($pathway->has(3)); $item = $pathway->get(0); $this->assertEquals($crumb1->name, $item->name); $this->assertEquals($crumb1->link, $item->link); $item = $pathway->get(1); $this->assertEquals($crumb2->name, $item->name); $this->assertEquals($crumb2->link, $item->link); $item = $pathway->offsetGet(2); $this->assertEquals($crumb3->name, $item->name); $this->assertEquals($crumb3->link, $item->link); $pathway->forget(1); $this->assertFalse($pathway->has(1)); $pathway->offsetUnset(2); $this->assertFalse($pathway->offsetExists(2)); }