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 e9950ea..69ef797 100644 --- a/core/modules/config/src/Tests/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -1,17 +1,17 @@ $element) { - $this->assertIdentical((string) $element[0], $expected_items[$key]); + $this->assertIdentical($element->getText(), $expected_items[$key]); } // Check the number of table row cells. @@ -178,9 +178,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 c0dc97b..4d0cd3e 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/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 @@ 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 92% rename from core/modules/config/src/Tests/ConfigInstallWebTest.php rename to core/modules/config/tests/src/Functional/ConfigInstallWebTest.php index 63ecb5b..0da8813 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); @@ -148,7 +149,8 @@ public function testPreExistingConfigInstall() { ->save(); $this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], t('Install')); - $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default already exist in active configuration.'); + $placeholder = str_replace('/', DIRECTORY_SEPARATOR, 'language/fr/config_test.dynamic.dotted.default'); + $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default, ' . $placeholder . ' already exist in active configuration.'); // Test installing a theme through the UI that has existing configuration. // This relies on the fact the config_test has been installed and created @@ -156,8 +158,9 @@ 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->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.'); + $this->drupalGet($this->getAbsoluteUrl($url->getText())); + $placeholder = str_replace('/', DIRECTORY_SEPARATOR, 'language/fr/config_test.dynamic.dotted.default'); + $this->assertRaw('Unable to install config_clash_test_theme, config_test.dynamic.dotted.default, ' . $placeholder . ' already exist in active configuration.'); // Test installing a theme through the API that has existing configuration. try { @@ -167,7 +170,8 @@ public function testPreExistingConfigInstall() { catch (PreExistingConfigException $e) { $this->assertEqual($e->getExtension(), 'config_clash_test_theme'); $this->assertEqual($e->getConfigObjects(), [StorageInterface::DEFAULT_COLLECTION => ['config_test.dynamic.dotted.default'], 'language.fr' => ['config_test.dynamic.dotted.default']]); - $this->assertEqual($e->getMessage(), 'Configuration objects (config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default) provided by config_clash_test_theme already exist in active configuration'); + $placeholder = str_replace('/', DIRECTORY_SEPARATOR, 'language/fr/config_test.dynamic.dotted.default'); + $this->assertEqual($e->getMessage(), 'Configuration objects (config_test.dynamic.dotted.default, ' . $placeholder . ') provided by config_clash_test_theme already exist in active 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 @@