示例#1
0
 public function symlink(\Codeception\Event\SuiteEvent $e)
 {
     $rootFolder = $this->getRootFolder();
     $destination = $this->getDestination($rootFolder, $e->getSettings());
     try {
         if (!$this->filesystem->file_exists($destination)) {
             $this->filesystem->symlink($rootFolder, $destination, true);
             $this->writeln('Symbolically linked plugin folder [' . $destination . ']');
         }
     } catch (IOException $e) {
         throw new ExtensionException(__CLASS__, "Error while trying to symlink plugin or theme to destination.\n\n" . $e->getMessage());
     }
 }
示例#2
0
 /**
  * @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());
 }