/** * Tests version specific files. */ public function testFetchVersionSpecific() { $fetcher = new FileFetcher(new RemoteFilesystem(new NullIO()), 'http://cgit.drupalcode.org/drupal/plain/{path}?h={version}', ['.eslintrc', '.eslintrc.json']); $this->setExpectedException(TransportException::class); $fetcher->fetch('8.2.x', $this->tmpDir); $this->assertFileExists($this->tmpDir . '/.eslintrc'); $this->assertFileNotExists($this->tmpDir . '/.eslintrc.json'); // Remove downloaded files to retest with 8.3.x. @unlink($this->tmpDir . '/.eslintrc'); $this->setExpectedException(TransportException::class); $fetcher->fetch('8.3.x', $this->tmpDir); $this->assertFileExists($this->tmpDir . '/.eslintrc.json'); $this->assertFileNotExists($this->tmpDir . '/.eslintrc'); }
/** * Downloads drupal scaffold files for the current process. */ public function downloadScaffold() { $drupalCorePackage = $this->getDrupalCorePackage(); $webroot = realpath($this->getWebRoot()); // Collect options, excludes and settings files. $options = $this->getOptions(); $files = array_diff($this->getIncludes(), $this->getExcludes()); // Call any pre-scaffold scripts that may be defined. $dispatcher = new EventDispatcher($this->composer, $this->io); $dispatcher->dispatch(self::PRE_DRUPAL_SCAFFOLD_CMD); $version = $this->getDrupalCoreVersion($drupalCorePackage); $remoteFs = new RemoteFilesystem($this->io); $fetcher = new FileFetcher($remoteFs, $options['source'], $files); $fetcher->fetch($version, $webroot); $initialFileFetcher = new InitialFileFetcher($remoteFs, $options['source'], $this->getInitial()); $initialFileFetcher->fetch($version, $webroot); // Call post-scaffold scripts. $dispatcher->dispatch(self::POST_DRUPAL_SCAFFOLD_CMD); }