diff --git a/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideIntegrationTest.php b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php similarity index 89% rename from core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideIntegrationTest.php rename to core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php index 3ef0754..f2f8730 100644 --- a/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideIntegrationTest.php +++ b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php @@ -1,15 +1,18 @@ drupalGet('admin/structure/config_test/manage/dotted.default'); $elements = $this->xpath('//input[@name="label"]'); - $this->assertIdentical((string) $elements[0]['value'], $original_label); + $this->assertIdentical((string) $elements[0]->getValue(), $original_label); $this->assertNoText($overridden_label); // Change to a new label and test that the listing now has the edited label. @@ -61,7 +61,7 @@ public function testFormsWithOverrides() { // Test that the editing page now has the edited label. $this->drupalGet('admin/structure/config_test/manage/dotted.default'); $elements = $this->xpath('//input[@name="label"]'); - $this->assertIdentical((string) $elements[0]['value'], $edited_label); + $this->assertIdentical((string) $elements[0]->getValue(), $edited_label); // Test that the overridden label is still loaded with the entity. $this->assertEqual($config_test_storage->load('dotted.default')->label(), $overridden_label); diff --git a/core/modules/config/src/Tests/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php similarity index 96% rename from core/modules/config/src/Tests/ConfigEntityListTest.php rename to core/modules/config/tests/src/Functional/ConfigEntityListTest.php index 46c0c06..ae9be13 100644 --- a/core/modules/config/src/Tests/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -1,18 +1,18 @@ $element) { - $this->assertIdentical((string) $element[0], $expected_items[$key]); + $this->assertIdentical($element->getText(), $expected_items[$key]); } // Check the number of table row cells. @@ -181,9 +181,9 @@ public function testListUI() { // Check the contents of each row cell. The first cell contains the label, // the second contains the machine name, and the third contains the // operations list. - $this->assertIdentical((string) $elements[0], 'Default'); - $this->assertIdentical((string) $elements[1], 'dotted.default'); - $this->assertTrue($elements[2]->children()->xpath('//ul'), 'Operations list found.'); + $this->assertIdentical($elements[0]->getText(), 'Default'); + $this->assertIdentical($elements[1]->getText(), 'dotted.default'); + $this->assertNotEmpty($elements[2]->find('xpath', '//ul'), 'Operations list found.'); // Add a new entity using the operations link. $this->assertLink('Add test configuration'); diff --git a/core/modules/config/src/Tests/ConfigEntityTest.php b/core/modules/config/tests/src/Functional/ConfigEntityTest.php similarity index 99% rename from core/modules/config/src/Tests/ConfigEntityTest.php rename to core/modules/config/tests/src/Functional/ConfigEntityTest.php index 2cd47ff..5b237c4 100644 --- a/core/modules/config/src/Tests/ConfigEntityTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php @@ -1,6 +1,6 @@ drupalGet('admin/config/development/configuration/full/export'); $this->assertFieldById('edit-submit', t('Export')); - // Submit the export form and verify response. + // Submit the export form and verify response. This will create a file in + // temporary directory with the default name config.tar.gz. $this->drupalPostForm('admin/config/development/configuration/full/export', [], t('Export')); $this->assertResponse(200, 'User can access the download callback.'); @@ -55,14 +56,8 @@ public function testExport() { $header_match = (boolean) preg_match('/attachment; filename="config-' . preg_quote($hostname) . '-\d{4}-\d{2}-\d{2}-\d{2}-\d{2}\.tar\.gz"/', $header_content_disposition); $this->assertTrue($header_match, "Header with filename matches the expected format."); - // Get the archived binary file provided to user for download. - $archive_data = $this->getRawContent(); - - // Temporarily save the archive file. - $uri = file_unmanaged_save_data($archive_data, 'temporary://config.tar.gz'); - // Extract the archive and verify it's not empty. - $file_path = file_directory_temp() . '/' . file_uri_target($uri); + $file_path = file_directory_temp() . '/' . 'config.tar.gz'; $archiver = new Tar($file_path); $archive_contents = $archiver->listContents(); $this->assert(!empty($archive_contents), 'Downloaded archive file is not empty.'); diff --git a/core/modules/config/src/Tests/ConfigFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php similarity index 81% rename from core/modules/config/src/Tests/ConfigFormOverrideTest.php rename to core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php index f721eeb..59276e3 100644 --- a/core/modules/config/src/Tests/ConfigFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php @@ -1,8 +1,8 @@ drupalGet('admin/config/system/site-information'); $this->assertTitle('Basic site settings | ' . $overridden_name); $elements = $this->xpath('//input[@name="site_name"]'); - $this->assertIdentical((string) $elements[0]['value'], 'Drupal'); + $this->assertIdentical((string) $elements[0]->getValue(), 'Drupal'); // Submit the form and ensure the site name is not changed. $edit = [ @@ -41,7 +41,7 @@ public function testFormsWithOverrides() { $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration')); $this->assertTitle('Basic site settings | ' . $overridden_name); $elements = $this->xpath('//input[@name="site_name"]'); - $this->assertIdentical((string) $elements[0]['value'], $edit['site_name']); + $this->assertIdentical((string) $elements[0]->getValue(), $edit['site_name']); } } diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php similarity index 97% rename from core/modules/config/src/Tests/ConfigImportAllTest.php rename to core/modules/config/tests/src/Functional/ConfigImportAllTest.php index 459be7a..0608681 100644 --- a/core/modules/config/src/Tests/ConfigImportAllTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php @@ -1,12 +1,13 @@ assertText(t('There are no configuration changes to import.')); + $this->rebuildContainer(); // Verify site name has changed. $this->assertIdentical($new_site_name, $this->config('system.site')->get('name')); diff --git a/core/modules/config/src/Tests/ConfigImportUploadTest.php b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php similarity index 86% rename from core/modules/config/src/Tests/ConfigImportUploadTest.php rename to core/modules/config/tests/src/Functional/ConfigImportUploadTest.php index 5e21295..955842d 100644 --- a/core/modules/config/src/Tests/ConfigImportUploadTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php @@ -1,15 +1,18 @@ assertResponse(200); // Attempt to upload a non-tar file. - $text_file = current($this->drupalGetTestFiles('text')); + $text_file = $this->getTestFiles('text')[0]; $edit = ['files[import_tarball]' => drupal_realpath($text_file->uri)]; $this->drupalPostForm('admin/config/development/configuration/full/import', $edit, t('Upload')); $this->assertText(t('Could not extract the contents of the tar file')); diff --git a/core/modules/config/src/Tests/ConfigInstallWebTest.php b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php similarity index 98% rename from core/modules/config/src/Tests/ConfigInstallWebTest.php rename to core/modules/config/tests/src/Functional/ConfigInstallWebTest.php index 63ecb5b..5dc3119 100644 --- a/core/modules/config/src/Tests/ConfigInstallWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php @@ -1,11 +1,11 @@ install(['config_integration_test']); + $this->resetAll(); // Verify that default module config exists. \Drupal::configFactory()->reset($default_config); @@ -156,7 +157,7 @@ public function testPreExistingConfigInstall() { // override created still exists. $this->drupalGet('admin/appearance'); $url = $this->xpath("//a[contains(@href,'config_clash_test_theme') and contains(@href,'/install?')]/@href")[0]; - $this->drupalGet($this->getAbsoluteUrl($url)); + $this->drupalGet($this->getAbsoluteUrl($url->getText())); $this->assertRaw('Unable to install config_clash_test_theme, config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default already exist in active configuration.'); // Test installing a theme through the API that has existing configuration. diff --git a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php similarity index 94% rename from core/modules/config/src/Tests/ConfigSingleImportExportTest.php rename to core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php index 607e80c..dc10323 100644 --- a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php +++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php @@ -1,16 +1,16 @@ drupalGet('admin/config/development/configuration/single/export/system.simple'); $this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Simple configuration'), 'The simple configuration option is selected when specified in the URL.'); // Spot check several known simple configuration files. - $element = $this->xpath('//select[@name="config_name"]'); - $options = $this->getAllOptions($element[0]); + $element = $this->xpath('//select[@name="config_name"]')[0]; + $options = $element->findAll('css', 'option'); $expected_options = ['system.site', 'user.settings']; foreach ($options as &$option) { - $option = (string) $option; + $option = $option->getValue(); } $this->assertIdentical($expected_options, array_intersect($expected_options, $options), 'The expected configuration files are listed.'); $this->drupalGet('admin/config/development/configuration/single/export/system.simple/system.image'); - $this->assertFieldByXPath('//textarea[@name="export"]', "toolkit: gd\n_core:\n default_config_hash: durWHaKeBaq4d9Wpi4RqwADj1OufDepcnJuhVLmKN24\n", 'The expected system configuration is displayed.'); + $this->assertEquals("toolkit: gd\n_core:\n default_config_hash: durWHaKeBaq4d9Wpi4RqwADj1OufDepcnJuhVLmKN24\n", $this->xpath('//textarea[@name="export"]')[0]->getValue(), 'The expected system configuration is displayed.'); $this->drupalGet('admin/config/development/configuration/single/export/date_format'); $this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Date format'), 'The date format entity type is selected when specified in the URL.'); @@ -243,7 +243,7 @@ public function testExport() { $this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format (fallback)'), 'The fallback date format config entity is selected when specified in the URL.'); $fallback_date = \Drupal::entityManager()->getStorage('date_format')->load('fallback'); - $yaml_text = (string) $this->xpath('//textarea[@name="export"]')[0]; + $yaml_text = $this->xpath('//textarea[@name="export"]')[0]->getValue(); $this->assertEqual(Yaml::decode($yaml_text), $fallback_date->toArray(), 'The fallback date format config entity export code is displayed.'); } diff --git a/core/modules/config/src/Tests/LanguageNegotiationFormOverrideTest.php b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php similarity index 93% rename from core/modules/config/src/Tests/LanguageNegotiationFormOverrideTest.php rename to core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php index ba67960..6c4e1bb 100644 --- a/core/modules/config/src/Tests/LanguageNegotiationFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php @@ -1,8 +1,8 @@