X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FUpdateScriptTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Fsrc%2FTests%2FUpdate%2FUpdateScriptTest.php;h=29d4d08e238b5e720f568517555a6793b2176578;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=ed076b8156799e5eb7baa68b5d185db11444288b;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/web/core/modules/system/tests/src/Functional/Update/UpdateScriptTest.php similarity index 94% rename from web/core/modules/system/src/Tests/Update/UpdateScriptTest.php rename to web/core/modules/system/tests/src/Functional/Update/UpdateScriptTest.php index ed076b815..29d4d08e2 100644 --- a/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php +++ b/web/core/modules/system/tests/src/Functional/Update/UpdateScriptTest.php @@ -1,17 +1,17 @@ assertNoText('This is a requirements warning provided by the update_script_test module.'); $this->clickLink(t('Continue')); $this->clickLink(t('Apply pending updates')); + $this->checkForMetaRefresh(); $this->assertText(t('The update_script_test_update_8001() update was executed successfully.'), 'End of update process was reached.'); // Confirm that all caches were cleared. $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.'); @@ -167,7 +168,7 @@ class UpdateScriptTest extends WebTestBase { $this->clickLink(t('Continue')); $this->assertText(t('No pending updates.')); $this->assertNoLink('Administration pages'); - $this->assertNoLinkByHrefInMainRegion('update.php', 0); + $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Front page'); $this->assertResponse(200); @@ -178,7 +179,7 @@ class UpdateScriptTest extends WebTestBase { $this->clickLink(t('Continue')); $this->assertText(t('No pending updates.')); $this->assertLink('Administration pages'); - $this->assertNoLinkByHrefInMainRegion('update.php', 1); + $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Administration pages'); $this->assertResponse(200); } @@ -189,7 +190,7 @@ class UpdateScriptTest extends WebTestBase { public function testSuccessfulUpdateFunctionality() { $initial_maintenance_mode = $this->container->get('state')->get('system.maintenance_mode'); $this->assertFalse($initial_maintenance_mode, 'Site is not in maintenance mode.'); - $this->updateScriptTest($initial_maintenance_mode); + $this->runUpdates($initial_maintenance_mode); $final_maintenance_mode = $this->container->get('state')->get('system.maintenance_mode'); $this->assertEqual($final_maintenance_mode, $initial_maintenance_mode, 'Maintenance mode should not have changed after database updates.'); @@ -209,10 +210,11 @@ class UpdateScriptTest extends WebTestBase { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->clickLink(t('Continue')); $this->clickLink(t('Apply pending updates')); + $this->checkForMetaRefresh(); $this->assertText('Updates were attempted.'); $this->assertLink('logged'); $this->assertLink('Administration pages'); - $this->assertNoLinkByHrefInMainRegion('update.php', 1); + $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Administration pages'); $this->assertResponse(200); } @@ -226,7 +228,7 @@ class UpdateScriptTest extends WebTestBase { $initial_maintenance_mode = $this->container->get('state') ->get('system.maintenance_mode'); $this->assertTrue($initial_maintenance_mode, 'Site is in maintenance mode.'); - $this->updateScriptTest($initial_maintenance_mode); + $this->runUpdates($initial_maintenance_mode); $final_maintenance_mode = $this->container->get('state') ->get('system.maintenance_mode'); $this->assertEqual($final_maintenance_mode, $initial_maintenance_mode, 'Maintenance mode should not have changed after database updates.'); @@ -275,10 +277,11 @@ class UpdateScriptTest extends WebTestBase { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->clickLink(t('Continue')); $this->clickLink(t('Apply pending updates')); + $this->checkForMetaRefresh(); $this->assertText('Updates were attempted.'); $this->assertLink('logged'); $this->assertLink('Administration pages'); - $this->assertNoLinkByHrefInMainRegion('update.php', 1); + $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Administration pages'); $this->assertResponse(200); } @@ -286,7 +289,7 @@ class UpdateScriptTest extends WebTestBase { /** * Helper function to run updates via the browser. */ - protected function updateScriptTest($maintenance_mode) { + protected function runUpdates($maintenance_mode) { $schema_version = drupal_get_installed_schema_version('update_script_test'); $this->assertEqual($schema_version, 8001, 'update_script_test is initially installed with schema version 8001.'); @@ -306,6 +309,7 @@ class UpdateScriptTest extends WebTestBase { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->clickLink(t('Continue')); $this->clickLink(t('Apply pending updates')); + $this->checkForMetaRefresh(); // Verify that updates were completed successfully. $this->assertText('Updates were attempted.'); @@ -318,7 +322,7 @@ class UpdateScriptTest extends WebTestBase { // Verify that there are no links to different parts of the workflow. $this->assertNoLink('Administration pages'); - $this->assertNoLinkByHrefInMainRegion('update.php', 0); + $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->assertNoLink('logged'); // Verify the front page can be visited following the upgrade.