diff -u b/drupalci.yml b/drupalci.yml --- b/drupalci.yml +++ b/drupalci.yml @@ -13,6 +13,7 @@ commands: - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-07/3085728.patch | git apply - - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-16/3088400-8_0.patch | git apply - + - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-16/3088447.patch | git apply - # run_tests task is executed several times in order of performance speeds. # halt-on-fail can be set on the run_tests tasks in order to fail fast. # suppress-deprecations is false in order to be alerted to usages of diff -u b/tests/src/Build/InPlaceUpdateTest.php b/tests/src/Build/InPlaceUpdateTest.php --- b/tests/src/Build/InPlaceUpdateTest.php +++ b/tests/src/Build/InPlaceUpdateTest.php @@ -6,6 +6,7 @@ use Drupal\Component\FileSystem\FileSystem as DrupalFilesystem; use Drupal\Component\Utility\Html; use Drupal\Tests\automatic_updates\Build\QuickStart\QuickStartTestBase; +use Drupal\Tests\automatic_updates\Traits\InstallTestTrait; use GuzzleHttp\Client; use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; use Symfony\Component\Finder\Finder; @@ -22,6 +23,7 @@ * @requires externalCommand tar */ class InPlaceUpdateTest extends QuickStartTestBase { + use InstallTestTrait; /** * The files which are candidates for deletion during an upgrade. @@ -66,14 +68,15 @@ $this->installQuickStart('minimal'); // Currently, this test has to use extension_discovery_scan_tests so we can - // enable test modules. + // install test modules. $fs->chmod($this->getWorkspaceDirectory() . '/sites/default/settings.php', 0640, 0000); file_put_contents($this->getWorkspaceDirectory() . '/sites/default/settings.php', '$settings[\'extension_discovery_scan_tests\'] = TRUE;' . PHP_EOL, FILE_APPEND); // Log in so that we can install modules. $this->formLogin($this->adminUsername, $this->adminPassword); - $this->moduleEnable('automatic_updates'); - $this->moduleEnable('test_automatic_updates'); + $this->moduleInstall('update'); + $this->moduleInstall('automatic_updates'); + $this->moduleInstall('test_automatic_updates'); // Confirm we are running correct Drupal version. $finder = new Finder(); @@ -138,15 +141,16 @@ } // Currently, this test has to use extension_discovery_scan_tests so we can - // enable test modules. + // install test modules. $fs->chmod($this->getWorkspaceDirectory() . '/sites/default/settings.php', 0640, 0000); file_put_contents($this->getWorkspaceDirectory() . '/sites/default/settings.php', '$settings[\'extension_discovery_scan_tests\'] = TRUE;' . PHP_EOL, FILE_APPEND); // Log in so that we can install projects. $this->formLogin($this->adminUsername, $this->adminPassword); - $this->moduleEnable('automatic_updates'); - $this->moduleEnable('test_automatic_updates'); - $this->{"{$project_type}Enable"}($project); + $this->moduleInstall('update'); + $this->moduleInstall('automatic_updates'); + $this->moduleInstall('test_automatic_updates'); + $this->{"{$project_type}Install"}($project); // Assert that the site is functional before updating. $this->visit(); @@ -258,31 +262,2 @@ - /** - * Helper method that uses Drupal's module page to enable a module. - */ - protected function moduleEnable($module_name) { - $assert = $this->visit('/admin/modules') - ->assertSession(); - $field = Html::getClass("edit-modules $module_name enable"); - // No need to enable a module if it is already enabled. - if ($this->getMink()->getSession()->getPage()->findField($field)->isChecked()) { - return; - } - $assert->fieldExists($field)->check(); - $session = $this->getMink()->getSession(); - $session->getPage()->findButton('Install')->submit(); - $assert->fieldExists($field)->isChecked(); - $assert->statusCodeEquals(200); - } - - /** - * Helper method that uses Drupal's theme page to enable a theme. - */ - protected function themeEnable($theme_name) { - $this->moduleEnable('test_automatic_updates'); - $assert = $this->visit("/admin/appearance/default?theme=$theme_name") - ->assertSession(); - $assert->pageTextNotContains('theme was not found'); - $assert->statusCodeEquals(200); - } - } diff -u b/tests/src/Build/ModifiedFilesTest.php b/tests/src/Build/ModifiedFilesTest.php --- b/tests/src/Build/ModifiedFilesTest.php +++ b/tests/src/Build/ModifiedFilesTest.php @@ -4,6 +4,7 @@ use Drupal\Component\Utility\Html; use Drupal\Tests\automatic_updates\Build\QuickStart\QuickStartTestBase; +use Drupal\Tests\automatic_updates\Traits\InstallTestTrait; use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; /** @@ -17,6 +18,7 @@ * @requires externalCommand tar */ class ModifiedFilesTest extends QuickStartTestBase { + use InstallTestTrait; /** * Symfony file system. @@ -122,7 +124,7 @@ $this->installQuickStart('minimal'); // Currently, this test has to use extension_discovery_scan_tests so we can - // enable test modules. + // install test modules. $this->symfonyFileSystem->chmod($this->getWorkspaceDirectory() . '/sites/default', 0750, 0000); $this->symfonyFileSystem->chmod($this->getWorkspaceDirectory() . '/sites/default/settings.php', 0640, 0000); $settings_php = $this->getWorkspaceDirectory() . '/sites/default/settings.php'; @@ -136,9 +138,9 @@ // Log in so that we can install modules. $this->formLogin($this->adminUsername, $this->adminPassword); - $this->moduleEnable('update'); - $this->moduleEnable('automatic_updates'); - $this->moduleEnable('test_automatic_updates'); + $this->moduleInstall('update'); + $this->moduleInstall('automatic_updates'); + $this->moduleInstall('test_automatic_updates'); // Assert that the site is functional. $this->visit(); @@ -166,19 +168,2 @@ - /** - * Helper method that uses Drupal's module page to enable a module. - */ - protected function moduleEnable($module_name) { - $this->visit('/admin/modules'); - $field = Html::getClass("edit-modules $module_name enable"); - // No need to enable a module if it is already enabled. - if ($this->getMink()->getSession()->getPage()->findField($field)->isChecked()) { - return; - } - $assert = $this->getMink()->assertSession(); - $assert->fieldExists($field)->check(); - $session = $this->getMink()->getSession(); - $session->getPage()->findButton('Install')->submit(); - $assert->fieldExists($field)->isChecked(); - } - } only in patch2: unchanged: --- /dev/null +++ b/tests/src/Traits/InstallTestTrait.php @@ -0,0 +1,41 @@ +visit('/admin/modules') + ->assertSession(); + $field = Html::getClass("edit-modules $module_name enable"); + // No need to install a module if it is already install. + if ($this->getMink()->getSession()->getPage()->findField($field)->isChecked()) { + return; + } + $assert->fieldExists($field)->check(); + $session = $this->getMink()->getSession(); + $session->getPage()->findButton('Install')->submit(); + $assert->fieldExists($field)->isChecked(); + $assert->statusCodeEquals(200); + } + + /** + * Helper method that uses Drupal's theme page to install a theme. + */ + protected function themeInstall($theme_name) { + $this->moduleInstall('test_automatic_updates'); + $assert = $this->visit("/admin/appearance/default?theme=$theme_name") + ->assertSession(); + $assert->pageTextNotContains('theme was not found'); + $assert->statusCodeEquals(200); + } + +}