Update to Drupal 8.2.2. For more information, see https://www.drupal.org/project/drupal/releases/8.2.2

This commit is contained in:
Pantheon Automation 2016-11-02 11:43:31 -07:00 committed by Greg Anderson
parent 23ffed3665
commit 507b45a0ed
378 changed files with 11434 additions and 5542 deletions

View file

@ -156,9 +156,12 @@ class BookNavigationBlock extends BlockBase implements ContainerFactoryPluginInt
}
}
elseif ($current_bid) {
// Only display this block when the user is browsing a book.
$query = \Drupal::entityQuery('node');
$nid = $query->condition('nid', $node->book['bid'], '=')->execute();
// Only display this block when the user is browsing a book and do
// not show unpublished books.
$nid = \Drupal::entityQuery('node')
->condition('nid', $node->book['bid'], '=')
->condition('status', NODE_PUBLISHED)
->execute();
// Only show the block if the user has view access for the top-level node.
if ($nid) {

View file

@ -570,34 +570,6 @@ class BookTest extends WebTestBase {
$this->assertEqual($child->id(), $second->book['bid'], '3rd-level child node is now second level when top-level node is deleted.');
}
/**
* Tests re-ordering of books.
*/
public function testBookOrdering() {
// Create new book.
$this->createBook();
$book = $this->book;
$this->drupalLogin($this->adminUser);
$node1 = $this->createBookNode($book->id());
$node2 = $this->createBookNode($book->id());
$pid = $node1->book['nid'];
// Head to admin screen and attempt to re-order.
$this->drupalGet('admin/structure/book/' . $book->id());
$edit = array(
"table[book-admin-{$node1->id()}][weight]" => 1,
"table[book-admin-{$node2->id()}][weight]" => 2,
// Put node 2 under node 1.
"table[book-admin-{$node2->id()}][pid]" => $pid,
);
$this->drupalPostForm(NULL, $edit, t('Save book pages'));
// Verify weight was updated.
$this->assertFieldByName("table[book-admin-{$node1->id()}][weight]", 1);
$this->assertFieldByName("table[book-admin-{$node2->id()}][weight]", 2);
$this->assertFieldByName("table[book-admin-{$node2->id()}][pid]", $pid);
}
/**
* Tests outline of a book.
*/
@ -752,4 +724,29 @@ class BookTest extends WebTestBase {
$this->assertEqual($book_node->book['bid'], $this->book->id());
}
/**
* Tests the book navigation block when book is unpublished.
*
* There was a fatal error with "Show block only on book pages" block mode.
*/
public function testBookNavigationBlockOnUnpublishedBook() {
// Create a new book.
$this->createBook();
// Create administrator user.
$administratorUser = $this->drupalCreateUser(['administer blocks', 'administer nodes', 'bypass node access']);
$this->drupalLogin($administratorUser);
// Enable the block with "Show block only on book pages" mode.
$this->drupalPlaceBlock('book_navigation', ['block_mode' => 'book pages']);
// Unpublish book node.
$edit = [];
$this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, t('Save and unpublish'));
// Test node page.
$this->drupalGet('node/' . $this->book->id());
$this->assertText($this->book->label(), 'Unpublished book with "Show block only on book pages" book navigation settings.');
}
}