Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drupal-composer / drupal-scaffold / tests / PluginTest.php
index 70464916044fb1f22afdd66f8d870f5f9f537655..2a0f3f904f5e2aabb22b059b842f1e6d3a6099fa 100644 (file)
@@ -68,7 +68,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
   public function testComposerInstallAndUpdate() {
     $exampleScaffoldFile = $this->tmpDir . DIRECTORY_SEPARATOR . 'index.php';
     $this->assertFileNotExists($exampleScaffoldFile, 'Scaffold file should not be exist.');
-    $this->composer('install');
+    $this->composer('install --no-dev --prefer-dist');
     $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . 'core', 'Drupal core is installed.');
     $this->assertFileExists($exampleScaffoldFile, 'Scaffold file should be automatically installed.');
     $this->fs->remove($exampleScaffoldFile);
@@ -76,16 +76,35 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
     $this->composer('drupal-scaffold');
     $this->assertFileExists($exampleScaffoldFile, 'Scaffold file should be installed by "drupal-scaffold" command.');
 
-    foreach (['8.0.1', '8.1.x-dev'] as $version) {
+    foreach (['8.0.1', '8.1.x-dev', '8.3.0', '8.5.x-dev'] as $version) {
       // We touch a scaffold file, so we can check the file was modified after
       // the scaffold update.
       touch($exampleScaffoldFile);
       $mtime_touched = filemtime($exampleScaffoldFile);
       // Requiring a newer version triggers "composer update"
-      $this->composer('require --update-with-dependencies drupal/core:"' . $version .'"');
+      $this->composer('require --update-with-dependencies --prefer-dist --update-no-dev drupal/core:"' . $version .'"');
       clearstatcache();
       $mtime_after = filemtime($exampleScaffoldFile);
       $this->assertNotEquals($mtime_after, $mtime_touched, 'Scaffold file was modified by composer update. (' . $version . ')');
+      switch ($version) {
+        case '8.0.1':
+        case '8.1.x-dev':
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc');
+          $this->assertFileNotExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc.json');
+          $this->assertFileNotExists($this->tmpDir . DIRECTORY_SEPARATOR . '.ht.router.php');
+          break;
+        case '8.3.0':
+          // Note we don't clean up .eslintrc file.
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc');
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc.json');
+          $this->assertFileNotExists($this->tmpDir . DIRECTORY_SEPARATOR . '.ht.router.php');
+          break;
+        case '8.5.x-dev':
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc');
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.eslintrc.json');
+          $this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . '.ht.router.php');
+          break;
+      }
     }
 
     // We touch a scaffold file, so we can check the file was modified after