Issue #2208325 by mcjim, anksy: Incorrect error message when changing the outline of a book page.

8.0.x
Alex Pott 2014-04-07 09:38:20 +01:00
parent 797c8de16b
commit 16fb258c95
2 changed files with 21 additions and 0 deletions

View File

@ -818,6 +818,7 @@ class BookManager implements BookManagerInterface {
foreach ($affected_bids as $bid) { foreach ($affected_bids as $bid) {
\Drupal::cache('data')->deleteTags(array('bid' => $bid)); \Drupal::cache('data')->deleteTags(array('bid' => $bid));
} }
return $link;
} }
/** /**

View File

@ -585,4 +585,24 @@ class BookTest extends WebTestBase {
$this->assertOptionSelected('edit-book-bid', $node->id()); $this->assertOptionSelected('edit-book-bid', $node->id());
} }
/**
* Tests that saveBookLink() returns something.
*/
public function testSaveBookLink() {
$book_manager = \Drupal::service('book.manager');
// Mock a link for a new book.
$link = array('nid' => 1, 'has_children' => 0, 'original_bid' => 0, 'parent_depth_limit' => 8, 'pid' => 0, 'weight' => 0, 'bid' => 1);
$new = TRUE;
// Save the link.
$return = $book_manager->saveBookLink($link, $new);
// Add the link defaults to $link so we have something to compare to the return from saveBookLink().
$link += $book_manager->getLinkDefaults($link['nid']);
// Test the return from saveBookLink.
$this->assertEqual($return, $link);
}
} }