public function testParse() { //we create new objects in order to test the private parse() method //testing blocks, both with and without the .php extension, with and without dots in the filename $files = array(); $files[] = 'subdir/file'; $files[] = 'subdir/file.php'; $files[] = 'sub.dir.with.dots/file'; $files[] = 'sub.dir.with.dots/file.php'; $files[] = 'file'; $files[] = 'file.php'; $files[] = 'a.file.with.dots'; $files[] = 'a.file.with.dots.php'; $files[] = 'subdir/a.file.with.dots'; $files[] = 'subdir/a.file.with.dots.php'; $files[] = 'sub.dir.with.dots/a.file.with.dots'; $files[] = 'sub.dir.with.dots/a.file.with.dots.php'; foreach ($files as $file) { $block = new Request('tools/blocks/block_handle/' . $file); $this->assertEquals('BLOCK_TOOL', $block->getIncludeType()); $this->assertEquals('block_handle', $block->getBlock()); $this->assertEquals($file . (substr($file, -3) == 'php' ? '' : '.php'), $block->getFilename()); $package = new Request('tools/packages/package_handle/' . $file); $this->assertEquals('PACKAGE_TOOL', $package->getIncludeType()); $this->assertEquals('package_handle', $package->getPackageHandle()); $this->assertEquals($file . (substr($file, -3) == 'php' ? '' : '.php'), $package->getFilename()); $core = new Request('tools/required/' . $file); $this->assertEquals('CONCRETE_TOOL', $core->getIncludeType()); $this->assertEquals($file . (substr($file, -3) == 'php' ? '' : '.php'), $core->getFilename()); $tool = new Request('tools/' . $file); $this->assertEquals('TOOL', $tool->getIncludeType()); $this->assertEquals($file . (substr($file, -3) == 'php' ? '' : '.php'), $tool->getFilename()); } $files = array(); $files = array(); $files[] = 'subdir/file'; $files[] = 'subdir/file.css'; $files[] = 'sub.dir.with.dots/file'; $files[] = 'sub.dir.with.dots/file.css'; $files[] = 'file'; $files[] = 'file.css'; $files[] = 'a.file.with.dots'; $files[] = 'a.file.with.dots.css'; $files[] = 'subdir/a.file.with.dots'; $files[] = 'subdir/a.file.with.dots.css'; $files[] = 'sub.dir.with.dots/a.file.with.dots'; $files[] = 'sub.dir.with.dots/a.file.with.dots.css'; foreach ($files as $file) { $css = new Request('tools/css/themes/theme_handle/' . $file); $this->assertEquals('CONCRETE_TOOL', $css->getIncludeType()); $this->assertEquals('theme_handle', $css->getAuxiliaryData()->theme); $this->assertEquals($file . (substr($file, -3) == 'css' ? '' : '.css'), $css->getAuxiliaryData()->file); } }