reverted: --- b/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php +++ a/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php @@ -18,17 +18,10 @@ $this->drupalLogin($admin_user); $this->drupalPostForm('admin/config/regional/language/add', array('predefined_langcode' => 'hu'), t('Add language')); $this->drupalGet('admin/structure/block/add/system_menu_block:admin/stark'); + $this->assertNoFieldByXPath('//input[@id="edit-visibility-language-langcodes-und"]', NULL, '\'Not specified\' option does not appear at block config, language settings section.'); + $this->assertNoFieldByXpath('//input[@id="edit-visibility-language-langcodes-zxx"]', NULL, '\'Not applicable\' option does not appear at block config, language settings section.'); + $this->assertFieldByXPath('//input[@id="edit-visibility-language-langcodes-en"]', NULL, '\'English\' option appears at block config, language settings section.'); + $this->assertFieldByXpath('//input[@id="edit-visibility-language-langcodes-hu"]', NULL, '\'Hungarian\' option appears at block config, language settings section.'); - - // 'Not specified' option does not appear at block config, language settings - // section. - $this->assertSession()->fieldNotExists('edit-visibility-language-langcodes-und'); - // 'Not applicable' option does not appear. - $this->assertSession()->fieldNotExists('edit-visibility-language-langcodes-zxx'); - - // // 'English' option appears.. - $this->assertSession()->fieldExists('edit-visibility-language-langcodes-en'); - // // 'Hungarian' option appears.. - $this->assertSession()->fieldExists('edit-visibility-language-langcodes-hu'); } } diff -u b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php --- b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php +++ b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php @@ -5,8 +5,8 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\language\Entity\ContentLanguageSettings; -use Drupal\Tests\BrowserTestBase; use Drupal\taxonomy\Entity\Vocabulary; +use Drupal\Tests\BrowserTestBase; /** * Tests the features of the language configuration element field. diff -u b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php --- b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php @@ -34,13 +34,11 @@ // Check if the Default English language has no path prefix. $this->drupalGet('admin/config/regional/language/detection/url'); - // Default English has no path prefix. - $this->assertSession()->fieldValueEquals('prefix[en]', ''); + $this->assertFieldByXPath('//input[@name="prefix[en]"]', '', 'Default English has no path prefix.'); // Check that Add language is a primary button. $this->drupalGet('admin/config/regional/language/add'); - $button = $this->assertSession()->buttonExists('Add language'); - $this->assertTrue($button->hasClass('button--primary')); + $this->assertFieldByXPath('//input[contains(@class, "button--primary")]', 'Add language', 'Add language is a primary button'); // Add predefined language. $edit = array( @@ -55,10 +53,10 @@ // Check if the Default English language has no path prefix. $this->drupalGet('admin/config/regional/language/detection/url'); - $this->assertSession()->fieldValueEquals('prefix[en]', ''); + $this->assertFieldByXPath('//input[@name="prefix[en]"]', '', 'Default English has no path prefix.'); // Check if French has a path prefix. $this->drupalGet('admin/config/regional/language/detection/url'); - $this->assertSession()->fieldValueEquals('prefix[fr]', 'fr'); + $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', 'French has a path prefix.'); // Check if we can change the default language. $this->drupalGet('admin/config/regional/language'); @@ -76,17 +74,17 @@ // Check if a valid language prefix is added after changing the default // language. $this->drupalGet('admin/config/regional/language/detection/url'); - $this->assertSession()->fieldValueEquals('prefix[en]', 'en'); + $this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', 'A valid path prefix has been added to the previous default language.'); // Check if French still has a path prefix. $this->drupalGet('admin/config/regional/language/detection/url'); - $this->assertSession()->fieldValueEquals('prefix[fr]', 'fr'); + $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', 'French still has a path prefix.'); // Check that prefix can be changed. $edit = array( 'prefix[fr]' => 'french', ); $this->drupalPostForm(NULL, $edit, t('Save configuration')); - $this->assertSession()->fieldValueEquals('prefix[fr]', 'french'); + $this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'french', 'French path prefix has changed.'); // Check that the prefix can be removed. $edit = array( diff -u b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php --- b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php @@ -2,9 +2,9 @@ namespace Drupal\Tests\language\Functional; -use Drupal\Tests\BrowserTestBase; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; +use Drupal\Tests\BrowserTestBase; /** * Adds and configures custom languages. diff -u b/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php --- b/core/modules/language/tests/src/Functional/LanguageListTest.php +++ b/core/modules/language/tests/src/Functional/LanguageListTest.php @@ -3,9 +3,9 @@ namespace Drupal\Tests\language\Functional; use Drupal\language\Entity\ConfigurableLanguage; -use Drupal\Tests\BrowserTestBase; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; +use Drupal\Tests\BrowserTestBase; /** * Adds a new language and tests changing its status and the default language. @@ -23,6 +23,9 @@ /** * Functional tests for adding, editing and deleting languages. + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Input "site_default_language" cannot take "nl" as a value (possible values: xx). */ function testLanguageList() { @@ -177,14 +180,9 @@ // Ensure that NL cannot be set default when it's not available. $this->drupalGet('admin/config/regional/language'); - try { - $this->drupalPostForm(NULL, array('site_default_language' => 'nl'), t('Save configuration')); - $this->fail('Form validation InvalidArgumentException thrown but not caught.'); - } - catch (\InvalidArgumentException $e) { - $this->assertEquals($e->getMessage(), 'Input "site_default_language" cannot take "nl" as a value (possible values: xx).'); - } - $this->assertFieldChecked('edit-site-default-language-xx', 'The previous default language still selected.'); + $this->drupalPostForm(NULL, array('site_default_language' => 'nl'), t('Save configuration')); + $this->assertText(t('Selected default language no longer exists.')); + $this->assertNoFieldChecked('edit-site-default-language-xx', 'The previous default language got deselected.'); } /** diff -u b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php --- b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php @@ -8,9 +8,9 @@ use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSession; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; +use Drupal\Tests\BrowserTestBase; use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUser; use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin; -use Drupal\Tests\BrowserTestBase; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; use Symfony\Component\HttpFoundation\Request;