diff --git a/core/modules/block/custom_block/custom_block.module b/core/modules/block/custom_block/custom_block.module index 74b52b4..e3cde94 100644 --- a/core/modules/block/custom_block/custom_block.module +++ b/core/modules/block/custom_block/custom_block.module @@ -17,7 +17,7 @@ function custom_block_help($path, $arg) { return t('Allows the creation of custom blocks through the user interface.'); case 'admin/structure/custom-blocks/types': - $output = '
' . t('This page provides a list of all custom-block types on your site. Each custom-block type can consists of different fields and display settings. From here you can manage the fields on each custom-block type as well as create new custom-block types.') . '
'; + $output = '' . t('This page lists user-created blocks. These blocks are derived from block types. A block type can consist of different fields and display settings. From the block types tab you can manage these fields as well as create new block types.') . '
'; return $output; } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php index 935e229..e28083a 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php @@ -40,7 +40,7 @@ public function testListing() { $this->drupalGet('admin/structure/custom-blocks'); // Test for the page title. - $this->assertTitle('Custom blocks | Drupal'); + $this->assertTitle(t('Custom blocks') . ' | Drupal'); // Test for the table. $element = $this->xpath('//div[@class="l-content"]//table'); @@ -51,24 +51,27 @@ public function testListing() { $this->assertEqual(count($elements), 2, 'Correct number of table header cells found.'); // Test the contents of each th cell. - $expected_items = array('Label', 'Operations'); + $expected_items = array(t('Label'), t('Operations')); foreach ($elements as $key => $element) { $this->assertIdentical((string) $element[0], $expected_items[$key]); } + $label = t('Antelope'); + $new_label = t('Albatross'); // Add a new entity using the operations link. - $this->assertLink('Add custom block'); - $this->clickLink('Add custom block'); + $link_text = t('Add custom block'); + $this->assertLink($link_text); + $this->clickLink($link_text); $this->assertResponse(200); $edit = array(); $langcode = Language::LANGCODE_NOT_SPECIFIED; - $edit['info'] = 'Antelope'; + $edit['info'] = $label; $edit["block_body[$langcode][0][value]"] = $this->randomName(16); $this->drupalPost(NULL, $edit, t('Save')); // Confirm that once the user returns to the listing, the text of the label // (versus elsewhere on the page). - $this->assertFieldByXpath('//td', 'Antelope', "Label found for added block."); + $this->assertFieldByXpath('//td', $label, 'Label found for added block.'); // Check the number of table row cells. $elements = $this->xpath('//div[@class="l-content"]//table/tbody/tr[@class="odd"]/td'); @@ -76,20 +79,20 @@ public function testListing() { // 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], 'Antelope'); + $this->assertIdentical((string) $elements[0], $label); // Edit the entity using the operations link. $blocks = $this->container ->get('plugin.manager.entity') ->getStorageController('custom_block') - ->loadByProperties(array('info' => 'Antelope')); + ->loadByProperties(array('info' => $label)); $block = reset($blocks); if (!empty($block)) { $this->assertLinkByHref('block/' . $block->id()); - $this->clickLink('Edit'); + $this->clickLink(t('Edit')); $this->assertResponse(200); - $this->assertTitle(t('Edit custom block Antelope | Drupal')); - $edit = array('info' => 'Albatross'); + $this->assertTitle(strip_tags(t('Edit custom block %label', array('%label' => $label)) . ' | Drupal')); + $edit = array('info' => $new_label); $this->drupalPost(NULL, $edit, t('Save')); } else { @@ -98,18 +101,19 @@ public function testListing() { // Confirm that once the user returns to the listing, the text of the label // (versus elsewhere on the page). - $this->assertFieldByXpath('//td', 'Albatross', "Label found for updated 'Albatross' entity."); + $this->assertFieldByXpath('//td', $new_label, 'Label found for updated custom block.'); // Delete the added entity using the operations link. $this->assertLinkByHref('block/' . $block->id() . '/delete'); - $this->clickLink('Delete'); + $delete_text = t('Delete'); + $this->clickLink($delete_text); $this->assertResponse(200); - $this->assertTitle(t('Are you sure you want to delete Albatross? | Drupal')); - $this->drupalPost(NULL, array(), t('Delete')); + $this->assertTitle(strip_tags(t('Are you sure you want to delete %label?', array('%label' => $new_label)) . ' | Drupal')); + $this->drupalPost(NULL, array(), $delete_text); // Verify that the text of the label and machine name does not appear in // the list (though it may appear elsewhere on the page). - $this->assertNoFieldByXpath('//td', 'Albatross', "No label found for deleted 'Albatross' entity."); + $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.'); // Confirm that the empty text is displayed. $this->assertText(t('There is no Custom Block yet.'));