/** * @test * it should allow for relative destinations */ public function it_should_allow_for_relative_destinations() { mkdir(codecept_data_dir('destination'), 0777, true); $this->config = ['files' => [codecept_data_dir('some-file') => 'tests/_data/destination/some-file', codecept_data_dir('some-folder') => 'tests/_data/destination/some-folder']]; $sut = $this->make_instance(); $sut->copyFiles($this->suiteEvent->reveal()); $destination = codecept_data_dir('destination'); $this->assertFileExists($destination . '/some-file'); $this->assertFileExists($destination . '/some-folder'); $this->assertFileExists($destination . '/some-folder/some-file'); }
/** * @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()); }