/** * @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()); }
private function checkRootFolder($rootFolder) { if (!($this->filesystem->is_dir($rootFolder) && $this->filesystem->is_readable($rootFolder))) { throw new ExtensionException(__CLASS__, '[rootFolder] parameter [' . $rootFolder . '] is not an existing and readable directory.'); } }