comparison core/modules/path/tests/src/Functional/PathLanguageUiTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\path\Functional; 3 namespace Drupal\Tests\path\Functional;
4
5 use Drupal\Core\Language\LanguageInterface;
4 6
5 /** 7 /**
6 * Confirm that the Path module user interface works with languages. 8 * Confirm that the Path module user interface works with languages.
7 * 9 *
8 * @group path 10 * @group path
76 78
77 $this->drupalGet('fr/' . $name); 79 $this->drupalGet('fr/' . $name);
78 $this->assertText(t('Filter aliases'), 'Foreign URL alias works'); 80 $this->assertText(t('Filter aliases'), 'Foreign URL alias works');
79 } 81 }
80 82
83 /**
84 * Test that language unspecific aliases are shown and saved in the node form.
85 */
86 public function testNotSpecifiedNode() {
87 // Create test node.
88 $node = $this->drupalCreateNode();
89
90 // Create a language-unspecific alias in the admin UI, ensure that is
91 // displayed and the langcode is not changed when saving.
92 $edit = [
93 'source' => '/node/' . $node->id(),
94 'alias' => '/' . $this->getRandomGenerator()->word(8),
95 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
96 ];
97 $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
98
99 $this->drupalGet($node->toUrl('edit-form'));
100 $this->assertSession()->fieldValueEquals('path[0][alias]', $edit['alias']);
101 $this->drupalPostForm(NULL, [], t('Save'));
102
103 $this->drupalGet('admin/config/search/path');
104 $this->assertSession()->pageTextContains('None');
105 $this->assertSession()->pageTextNotContains('English');
106
107 // Create another node, with no alias, to ensure non-language specific
108 // aliases are loaded correctly.
109 $node = $this->drupalCreateNode();
110 $this->drupalget($node->toUrl('edit-form'));
111 $this->drupalPostForm(NULL, [], t('Save'));
112 $this->assertSession()->pageTextNotContains(t('The alias is already in use.'));
113 }
114
81 } 115 }