diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 92bdb80..598fa9e 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -344,7 +344,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { foreach ($reasons as $reason) { $reason_message[] = implode(', ', $reason); } - throw new ModuleUninstallValidatorException('The following reasons prevents the modules from being uninstalled: ' . implode('; ', $reason_message)); + throw new ModuleUninstallValidatorException('The following reasons that prevents the modules from being uninstalled: ' . implode('; ', $reason_message)); } // Set the actual module weights. $module_list = array_map(function ($module) use ($module_data) { diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index b1c9fa3..e1d8552 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -188,6 +188,9 @@ function testBook() { $this->drupalLogout(); $this->drupalLogin($this->bookAuthor); + // Check that the "Add child page" link exists. + $this->checkBookNode($book, array($nodes[0], $nodes[3], $nodes[4]), FALSE, FALSE, $nodes[0], array()); + // Check the presence of expected cache tags. $this->drupalGet('node/add/book'); $this->assertCacheTag('config:book.settings'); @@ -288,6 +291,24 @@ function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = F $this->assertRaw(\Drupal::l($text, $url), 'Next page link found.'); } + if ($this->loggedInUser->hasPermission('add content to books')) { + $this->assertLink('Add child page', 0, 'The add child page link appears on the page'); + // Suppose we have int value for $node->id() = 10; + // Create the following URL: 'node/add/book?parent=10; + $url = \Drupal::url('node.add', array('node_type' => 'book'), array( + 'query' => array('parent' => $node->id()) + )); + + $this->assertLinkByHref($url, 0, 'The add child page link exists with the correct querystring.'); + } + + if ($this->loggedInUser->hasPermission('access printer-friendly version')) { + $this->assertLink('Printer-friendly version', 0, 'The Printer-friendly version link appears on the page.'); + // Create the following URL: 'node/add/book?parent=' . $node->id(); + $url = \Drupal::url('book.export', array('type' => 'html', 'node' => $node->id())); + $this->assertLinkByHref($url, 0, 'The Printer-friendly version link exists with the correct path.'); + } + // Compute the expected breadcrumb. $expected_breadcrumb = array(); $expected_breadcrumb[] = \Drupal::url(''); @@ -305,10 +326,12 @@ function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = F // Compare expected and got breadcrumbs. $this->assertIdentical($expected_breadcrumb, $got_breadcrumb, 'The breadcrumb is correctly displayed on the page.'); - // Check printer friendly version. - $this->drupalGet('book/export/html/' . $node->id()); - $this->assertText($node->label(), 'Printer friendly title found.'); - $this->assertRaw($node->body->processed, 'Printer friendly body found.'); + if ($this->loggedInUser->hasPermission('access printer-friendly version')) { + // Check printer friendly version. + $this->drupalGet('book/export/html/' . $node->id()); + $this->assertText($node->label(), 'Printer friendly title found.'); + $this->assertRaw($node->body->processed, 'Printer friendly body found.'); + } $number++; } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 896c4f8..08d2e48 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -878,12 +878,15 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo * default home page at path 'node', an RSS feed, a recent content block, etc.), * the process above is followed except that hook_node_access() is not called on * each node for performance reasons and for proper functioning of the pager - * system. When adding a node listing to your module, be sure to use an entity - * query, which will add a tag of "node_access". This will allow modules dealing - * with node access to ensure only nodes to which the user has access are - * retrieved, through the use of hook_query_TAG_alter(). See the - * @link entity_api Entity API topic @endlink for more information on entity - * queries. + * system.So for node listing we can use db_select() query with tag of + * "node_access" having a check for published/unpublished status of the nodes + * with node access. See the @link entity_api Entity API topic @endlink for more + * information on entity queries. This will make sure that your base query does + * not allow for the display of unpublished nodes to users who should not have + * access to the node. Conditions need to be added to check the published status + * of the node. Tagging a query with "node_access" does not automatically check + * the published/unpublished status of nodes, so your base query is responsible + * for ensuring that unpublished nodes are not displayed to inappropriate users. * * Note: Even a single module returning an AccessResultInterface object from * hook_node_access() whose isForbidden() method equals TRUE will block access diff --git a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php index 3720321..dec3651 100644 --- a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php +++ b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php @@ -83,7 +83,7 @@ public function testUninstallingModule() { } catch (ModuleUninstallValidatorException $e) { $this->pass($message); - $this->assertEqual($e->getMessage(), 'The following reasons prevents the modules from being uninstalled: There is data for the field extra_base_field on entity type Test entity'); + $this->assertEqual($e->getMessage(), 'The following reasons that prevents the modules from being uninstalled: There is data for the field extra_base_field on entity type Test entity'); } // Verify uninstalling entity_test is not possible when there is content for