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 not attempt unlinking if destination file does not exist */ public function it_should_not_attempt_unlinking_if_destination_file_does_not_exist() { $this->config = ['mode' => 'theme', 'destination' => __DIR__]; $this->filesystem->file_exists($this->filename)->willReturn(false); $this->filesystem->unlink(__DIR__ . DIRECTORY_SEPARATOR . basename(codecept_root_dir()))->shouldNotBeCalled(); $sut = $this->make_instance(); $sut->unlink($this->event->reveal()); }