From 13fd93c953b2381169d1a2271427d79ebe975ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= <adam@phenaproxima.net> Date: Fri, 7 Jan 2022 11:10:07 -0500 Subject: [PATCH] Adjust core tests to accommodate package_manager --- .../tests/src/Build/UpdateTestBase.php | 17 ++++++++++------- .../StagedDatabaseUpdateValidatorTest.php | 2 +- .../help/tests/src/Kernel/HelpEmptyPageTest.php | 2 +- ...ResolvedLibraryDefinitionsFilesMatchTest.php | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/modules/auto_updates/tests/src/Build/UpdateTestBase.php b/core/modules/auto_updates/tests/src/Build/UpdateTestBase.php index dae6215766f1..8ef429977846 100644 --- a/core/modules/auto_updates/tests/src/Build/UpdateTestBase.php +++ b/core/modules/auto_updates/tests/src/Build/UpdateTestBase.php @@ -32,14 +32,17 @@ protected function tearDown(): void { protected function createTestProject(string $template): void { parent::createTestProject($template); + // BEGIN: DELETE FROM CORE MERGE REQUEST // Install Automatic Updates into the test project and ensure it wasn't // symlinked. - $dir = 'project'; - $this->runComposer('composer config repo.auto_updates path ' . __DIR__ . '/../../..', $dir); - $this->runComposer('composer require --no-update "drupal/auto_updates:@dev"', $dir); - $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer update --with-all-dependencies', $dir); - $this->assertStringNotContainsString('Symlinking', $output); - + if (__NAMESPACE__ === 'Drupal\Tests\automatic_updates\Build') { + $dir = 'project'; + $this->runComposer('composer config repo.automatic_updates path ' . __DIR__ . '/../../..', $dir); + $this->runComposer('composer require --no-update "drupal/automatic_updates:@dev"', $dir); + $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer update --with-all-dependencies', $dir); + $this->assertStringNotContainsString('Symlinking', $output); + } + // END: DELETE FROM CORE MERGE REQUEST // Install Drupal. Always allow test modules to be installed in the UI and, // for easier debugging, always display errors in their dubious glory. $this->installQuickStart('minimal'); @@ -128,7 +131,7 @@ protected function installModules(array $modules): void { $form_id = $assert_session->elementExists('css', 'input[type="hidden"][name="form_id"]') ->getValue(); - if ($form_id === 'system_modules_confirm_form') { + if (preg_match('/^system_modules_(experimental_)?confirm_form$/', $form_id)) { $page->pressButton('Continue'); $assert_session->statusCodeEquals(200); } diff --git a/core/modules/auto_updates/tests/src/Kernel/ReadinessValidation/StagedDatabaseUpdateValidatorTest.php b/core/modules/auto_updates/tests/src/Kernel/ReadinessValidation/StagedDatabaseUpdateValidatorTest.php index 1dbfdc399aaf..11a90b4fa094 100644 --- a/core/modules/auto_updates/tests/src/Kernel/ReadinessValidation/StagedDatabaseUpdateValidatorTest.php +++ b/core/modules/auto_updates/tests/src/Kernel/ReadinessValidation/StagedDatabaseUpdateValidatorTest.php @@ -164,7 +164,7 @@ public function testUpdatesAddedInStage(): void { // The file we're creating shouldn't already exist in the staging area // unless it's a file we actually ship, which is a scenario covered by // ::testFileChanged(). - $this->assertFileNotExists($file); + $this->assertFileDoesNotExist($file); file_put_contents($file, $this->randomString()); } diff --git a/core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php b/core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php index 663d168005f4..7a61d33c6002 100644 --- a/core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php +++ b/core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php @@ -17,7 +17,7 @@ class HelpEmptyPageTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['system', 'help_test', 'user', 'path_alias']; + protected static $modules = ['system', 'help_test', 'user', 'path_alias', 'package_manager']; /** * {@inheritdoc} diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index 026f8d326386..fcdbeeddd5f8 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -88,7 +88,7 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['system', 'user', 'path_alias']; + protected static $modules = ['system', 'user', 'path_alias', 'package_manager']; /** * {@inheritdoc} @@ -132,6 +132,7 @@ protected function setUp(): void { $this->allModules[] = 'system'; $this->allModules[] = 'user'; $this->allModules[] = 'path_alias'; + $this->allModules[] = 'package_manager'; $database_module = \Drupal::database()->getProvider(); if ($database_module !== 'core') { $this->allModules[] = $database_module; -- GitLab