diff -u b/core/modules/path/src/Tests/PathAliasTest.php b/core/modules/path/src/Tests/PathAliasTest.php --- b/core/modules/path/src/Tests/PathAliasTest.php +++ b/core/modules/path/src/Tests/PathAliasTest.php @@ -22,13 +22,13 @@ * * @var array */ - public static $modules = array('path'); + public static $modules = array('path', 'language'); protected function setUp() { parent::setUp(); // Create test user and login. - $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases')); + $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases', 'administer site configuration', 'administer languages')); $this->drupalLogin($web_user); } @@ -73,9 +73,10 @@ $node1 = $this->drupalCreateNode(); // Create alias. - $edit = array(); - $edit['source'] = '/node/' . $node1->id(); - $edit['alias'] = '/' . $this->randomMachineName(8); + $edit = array( + 'source' => '/node/' . $node1->id(), + 'alias' => '/' . $this->randomMachineName(8), + ); $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); // Ensure the alias is set as default language English and the language @@ -85,6 +86,27 @@ $elements = $this->xpath("//a[text()='Language']"); $this->assertTrue(isset($elements[0]), 'The language column is available.'); $this->assertText('English', 'The new alias uses the default language.'); + $this->drupalPostForm('admin/config/search/path/edit/' . $this->getPID($edit['alias']), array(), t('Delete')); + $this->drupalPostForm(NULL, array(), t('Confirm')); + + // Change the site default language. + $language_name = $this->randomMachineName(16); + $edit = array( + 'predefined_langcode' => 'custom', + 'langcode' => 'xx', + 'label' => $language_name, + ); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language'); + $this->config('system.site')->set('default_langcode', 'xx')->save(); + + // Create alias. + $edit = array( + 'source' => '/node/' . $node1->id(), + 'alias' => '/' . $this->randomMachineName(8), + ); + $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); + $this->drupalGet('admin/config/search/path'); + $this->assertText($language_name, 'The new alias uses the default language.'); // Confirm that the alias works. $this->drupalGet($edit['alias']);