public function BookTest::testSaveBookLink in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::testSaveBookLink()
- 10 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::testSaveBookLink()
Tests that saveBookLink() returns something.
File
- core/
modules/ book/ tests/ src/ Functional/ BookTest.php, line 486
Class
- BookTest
- Create a book, add pages, and test book interface.
Namespace
Drupal\Tests\book\FunctionalCode
public function testSaveBookLink() {
$book_manager = \Drupal::service('book.manager');
// Mock a link for a new book.
$link = [
'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);
}