public function offsetGet($index) { if (!isset($this[$index])) { $file = new TableOfContents\File(); $file->setFilename($index); $this[] = $file; } return parent::offsetGet($index); }
public function testRecognizesModule() { $file = new TableOfContents\File(); $file->setFilename('test'); $file2 = new TableOfContents\File(); $file2->setFilename('test2'); $file3 = new TableOfContents\File(); $file3->setFilename('index'); $file4 = new TableOfContents\File(); $file4->setFilename('INDEX'); $file5 = new TableOfContents\File(); $file5->setFilename('test3'); $this->object[] = $file; $this->object[] = $file2; $this->object[] = $file3; $this->object[] = $file4; $this->assertCount(2, $this->object->getModules()); $this->assertSame(array($file3, $file4), $this->object->getModules()); }