diff --git a/core/modules/path/lib/Drupal/path/Plugin/field/widget/PathWidget.php b/core/modules/path/lib/Drupal/path/Plugin/field/widget/PathWidget.php index 7460948..dcd03bb 100644 --- a/core/modules/path/lib/Drupal/path/Plugin/field/widget/PathWidget.php +++ b/core/modules/path/lib/Drupal/path/Plugin/field/widget/PathWidget.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\path\Plugin\field\widget\PathWidget. + * Contains \Drupal\path\Plugin\field\widget\PathWidget. */ namespace Drupal\path\Plugin\field\widget; @@ -26,7 +26,7 @@ class PathWidget extends WidgetBase { /** - * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement(). + * Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement(). */ public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) { $entity = $element['#entity']; diff --git a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php index 121857a..c79c1c1 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php @@ -130,26 +130,27 @@ function testAdminAlias() { function testNodeAlias() { // Create test node. $node1 = $this->drupalCreateNode(); + $lang_code = LANGUAGE_NOT_SPECIFIED; // Create alias. $edit = array(); - $edit['path[und][0][value]'] = $this->randomName(8); + $edit["path[$lang_code][0][value]"] = $this->randomName(8); $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save')); // Confirm that the alias works. - $this->drupalGet($edit['path[und][0][value]']); + $this->drupalGet($edit["path[$lang_code][0][value]"]); $this->assertText($node1->label(), 'Alias works.'); $this->assertResponse(200); // Change alias to one containing "exotic" characters. - $previous = $edit['path[und][0][value]']; - $edit['path[und][0][value]'] = "- ._~!$'\"()*@[]?&+%#,;=:" . // "Special" ASCII characters. + $previous = $edit["path[$lang_code][0][value]"]; + $edit["path[$lang_code][0][value]"] = "- ._~!$'\"()*@[]?&+%#,;=:" . // "Special" ASCII characters. "%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string. "éøïвβ中國書۞"; // Characters from various non-ASCII alphabets. $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save')); // Confirm that the alias works. - $this->drupalGet($edit['path[und][0][value]']); + $this->drupalGet($edit["path[$lang_code][0][value]"]); $this->assertText($node1->label(), 'Changed alias works.'); $this->assertResponse(200); @@ -172,7 +173,7 @@ function testNodeAlias() { $this->drupalPost('node/' . $node1->nid . '/edit', array('path[und][0][value]' => ''), t('Save')); // Confirm that the alias no longer works. - $this->drupalGet($edit['path[und][0][value]']); + $this->drupalGet($edit["path[$lang_code][0][value]"]); $this->assertNoText($node1->label(), 'Alias was successfully deleted.'); $this->assertResponse(404); } @@ -197,13 +198,14 @@ function testDuplicateNodeAlias() { // Create one node with a random alias. $node_one = $this->drupalCreateNode(); $edit = array(); - $edit['path[und][0][value]'] = $this->randomName(); + $lang_code = LANGUAGE_NOT_SPECIFIED; + $edit["path[$lang_code][0][value]"] = $this->randomName(); $this->drupalPost('node/' . $node_one->nid . '/edit', $edit, t('Save')); // Now create another node and try to set the same alias. $node_two = $this->drupalCreateNode(); $this->drupalPost('node/' . $node_two->nid . '/edit', $edit, t('Save')); $this->assertText(t('The alias is already in use.')); - $this->assertFieldByXPath("//input[@name='path[und][0][value]' and contains(@class, 'error')]", $edit['path[und][0][value]'], 'Textfield exists and has the error class.'); + $this->assertFieldByXPath("//input[@name='path[$lang_code][0][value]' and contains(@class, 'error')]", $edit["path[$lang_code][0][value]"], 'Textfield exists and has the error class.'); } } diff --git a/core/modules/path/lib/Drupal/path/Tests/PathFieldCRUDUnitTest.php b/core/modules/path/lib/Drupal/path/Tests/PathFieldCRUDUnitTest.php index c5fd850..4f29248 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathFieldCRUDUnitTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathFieldCRUDUnitTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\path\Tests\PathFieldCRUDUnitTest. + * Contains \Drupal\path\Tests\PathFieldCRUDUnitTest. */ namespace Drupal\path\Tests; diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php index 03a1d63..93512e2 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php @@ -50,22 +50,6 @@ function setUp() { 'settings[node][page][fields][path]' => 'path', ); $this->drupalPost('admin/config/regional/content-language', $edit, t('Save')); - - /* @todo un-comment when moved to DrupalUnitTestBase. - // Enable entity translation for the entity type/bundle. - translation_entity_set_config('node', 'page', 'enabled', TRUE); - drupal_static_reset(); - entity_info_cache_clear(); - menu_router_rebuild(); - // Enable field translation for the body field. - $field = field_info_field('body'); - $field['translatable'] = TRUE; - field_update_field($field); - // Enable field translation for the default path field. - $field = field_info_field('path'); - $field['translatable'] = TRUE; - field_update_field($field); - */ } /** @@ -85,7 +69,8 @@ function testAliasTranslation() { // Edit the node to set language and path. $edit = array(); $edit['langcode'] = 'en'; - $edit['path[und][0][value]'] = $english_alias; + $lang_code = LANGUAGE_NOT_SPECIFIED; + $edit["path[$lang_code][0][value]"] = $english_alias; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save and keep published')); // Confirm that the alias works.