/** * Removes a given module version * * @param io.Folder $cwd The working directory * @param io.collections.FileCollection $version The version * @return bool whether the module was active */ protected function remove($cwd, FileCollection $version) { $versioned = basename($version->getURI()); $vendor = basename($version->getOrigin()->getURI()); Console::writeLine('Removing ', $vendor, '/', $versioned, ' -> ', $version); // Remove corresponding .pth file $pth = new File($cwd, '.' . $vendor . '.' . $versioned . '.pth'); if ($pth->exists()) { $active = true; $pth->unlink(); } else { $active = false; } // Remove folder $fld = new Folder($version->getURI()); $fld->unlink(); return $active; }
public function movingToAnotherFolder() { $this->writeData($this->file, null); $target = new File($this->folder, $this->file->getFilename()); $this->file->move($this->folder); $exists = $target->exists(); $target->unlink(); $this->assertTrue($exists); }