public function unlink(\Codeception\Event\SuiteEvent $e) { $rootFolder = $this->getRootFolder(); $destination = $this->getDestination($rootFolder, $e->getSettings()); if ($this->filesystem->file_exists($destination)) { $unlinked = $this->filesystem->unlink($destination); if (!$unlinked) { // let's not kill the suite but let's notify the user $this->writeln('Could not unlink file [' . $destination . '], manual removal is required.'); } $this->writeln('Unliked plugin folder [' . $destination . ']'); } }
/** * @test * it should allow specifying the root folder in the configuration */ public function it_should_allow_specifying_the_root_folder_in_the_configuration() { $rootFolder = __DIR__; $defaultDestinationFolder = '/default'; $defaultDestination = $defaultDestinationFolder; $envDestinations = ['default' => $defaultDestinationFolder]; $this->config = ['mode' => 'plugin', 'destination' => $envDestinations, 'rootFolder' => $rootFolder]; $this->event->getSettings()->willReturn(['current_environment' => 'default']); $this->filesystem->file_exists($defaultDestination . DIRECTORY_SEPARATOR . basename($rootFolder))->willReturn(false); $this->filesystem->is_dir($defaultDestinationFolder)->willReturn(true); $this->filesystem->is_writeable($defaultDestinationFolder)->willReturn(true); $this->filesystem->is_dir($rootFolder)->willReturn(true); $this->filesystem->is_readable($rootFolder)->willReturn(true); $this->filesystem->symlink(rtrim($rootFolder, DIRECTORY_SEPARATOR), $defaultDestination . DIRECTORY_SEPARATOR . basename($rootFolder), true)->shouldBeCalled(); $sut = $this->make_instance(); $sut->symlink($this->event->reveal()); }
/** * @param $localCodeceptionConfig */ protected function ensureCodeceptionLocalConfigExists($localCodeceptionConfig) { if (!$this->filesystem->file_exists($localCodeceptionConfig)) { throw new RuntimeException('Bootstrap and configure your codeception locally before running the setup:scaffold command.'); } }