public function testMatchPathsNoCurrDirError() { $this->setExpectedException('LogicException'); $this->assertSame('DUMMY', Scisr_Operations_RenameFile::matchPaths('/foo/bar', './relative/path')); }
/** * Callback that uses the class information from the first pass to figure * out how to rename class files. */ protected function doRenameClassFile($oldClass, $newClass) { $oldFilePath = $this->_dbClasses->getClassFile($oldClass); if ($oldFilePath !== null) { $pieces = explode('_', $oldClass); foreach (array_keys($this->getAllowedFileExtensions()) as $ext) { if (basename($oldFilePath) == "{$oldClass}.{$ext}") { $dir = dirname($oldFilePath); $this->setRenameFile($oldFilePath, "{$dir}/{$newClass}.{$ext}"); break; } else { if (count($pieces) > 1) { $namespacedFile = implode('/', $pieces) . ".{$ext}"; $baseDir = Scisr_Operations_RenameFile::matchPaths($oldFilePath, $namespacedFile); if ($baseDir !== false) { $newNamespacedFile = implode('/', explode('_', $newClass)) . ".{$ext}"; $this->setRenameFile($oldFilePath, "{$baseDir}{$newNamespacedFile}"); break; } } } } } }