Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -17,6 +17,6 @@
|
|||
function book_test_page_attachments(array &$page) {
|
||||
$page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
|
||||
if (\Drupal::state()->get('book_test.debug_book_navigation_cache_context', FALSE)) {
|
||||
drupal_set_message(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
|
||||
\Drupal::messenger()->addStatus(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ package: Testing
|
|||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- book
|
||||
- views
|
||||
- drupal:book
|
||||
- drupal:views
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
|
||||
|
||||
/**
|
||||
* Tests Book and Content Moderation integration.
|
||||
*
|
||||
* @group book
|
||||
*/
|
||||
class BookContentModerationTest extends BrowserTestBase {
|
||||
|
||||
use BookTestTrait;
|
||||
use ContentModerationTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['book', 'block', 'book_test', 'content_moderation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('system_breadcrumb_block');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
$workflow = $this->createEditorialWorkflow();
|
||||
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'book');
|
||||
$workflow->save();
|
||||
|
||||
// We need a user with additional content moderation permissions.
|
||||
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books', 'access printer-friendly version', 'view any unpublished content', 'use editorial transition create_new_draft', 'use editorial transition publish']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that book drafts can not modify the book outline.
|
||||
*/
|
||||
public function testBookWithPendingRevisions() {
|
||||
// Create two books.
|
||||
$book_1_nodes = $this->createBook(['moderation_state[0][state]' => 'published']);
|
||||
$book_1 = $this->book;
|
||||
|
||||
$this->createBook(['moderation_state[0][state]' => 'published']);
|
||||
$book_2 = $this->book;
|
||||
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
|
||||
// Check that book pages display along with the correct outlines.
|
||||
$this->book = $book_1;
|
||||
$this->checkBookNode($book_1, [$book_1_nodes[0], $book_1_nodes[3], $book_1_nodes[4]], FALSE, FALSE, $book_1_nodes[0], []);
|
||||
$this->checkBookNode($book_1_nodes[0], [$book_1_nodes[1], $book_1_nodes[2]], $book_1, $book_1, $book_1_nodes[1], [$book_1]);
|
||||
|
||||
// Create a new book page without actually attaching it to a book and create
|
||||
// a draft.
|
||||
$edit = [
|
||||
'title[0][value]' => $this->randomString(),
|
||||
'moderation_state[0][state]' => 'published',
|
||||
];
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertTrue($node);
|
||||
|
||||
$edit = [
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
|
||||
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
|
||||
|
||||
// Create a book draft with no changes, then publish it.
|
||||
$edit = [
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, t('Save'));
|
||||
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
|
||||
$edit = [
|
||||
'moderation_state[0][state]' => 'published',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
// Try to move Node 2 to a different parent.
|
||||
$edit = [
|
||||
'book[pid]' => $book_1_nodes[3]->id(),
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
|
||||
|
||||
// Check that the book outline did not change.
|
||||
$this->book = $book_1;
|
||||
$this->checkBookNode($book_1, [$book_1_nodes[0], $book_1_nodes[3], $book_1_nodes[4]], FALSE, FALSE, $book_1_nodes[0], []);
|
||||
$this->checkBookNode($book_1_nodes[0], [$book_1_nodes[1], $book_1_nodes[2]], $book_1, $book_1, $book_1_nodes[1], [$book_1]);
|
||||
|
||||
// Try to move Node 2 to a different book.
|
||||
$edit = [
|
||||
'book[bid]' => $book_2->id(),
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
|
||||
|
||||
// Check that the book outline did not change.
|
||||
$this->book = $book_1;
|
||||
$this->checkBookNode($book_1, [$book_1_nodes[0], $book_1_nodes[3], $book_1_nodes[4]], FALSE, FALSE, $book_1_nodes[0], []);
|
||||
$this->checkBookNode($book_1_nodes[0], [$book_1_nodes[1], $book_1_nodes[2]], $book_1, $book_1, $book_1_nodes[1], [$book_1]);
|
||||
|
||||
// Try to change the weight of Node 2.
|
||||
$edit = [
|
||||
'book[weight]' => 2,
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.');
|
||||
|
||||
// Check that the book outline did not change.
|
||||
$this->book = $book_1;
|
||||
$this->checkBookNode($book_1, [$book_1_nodes[0], $book_1_nodes[3], $book_1_nodes[4]], FALSE, FALSE, $book_1_nodes[0], []);
|
||||
$this->checkBookNode($book_1_nodes[0], [$book_1_nodes[1], $book_1_nodes[2]], $book_1, $book_1, $book_1_nodes[1], [$book_1]);
|
||||
|
||||
// Save a new draft revision for the node without any changes and check that
|
||||
// the error message is not displayed.
|
||||
$edit = [
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
$this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.');
|
||||
}
|
||||
|
||||
}
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\book\Functional;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\user\RoleInterface;
|
||||
|
||||
|
@ -15,6 +13,8 @@ use Drupal\user\RoleInterface;
|
|||
*/
|
||||
class BookTest extends BrowserTestBase {
|
||||
|
||||
use BookTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
|
@ -22,20 +22,6 @@ class BookTest extends BrowserTestBase {
|
|||
*/
|
||||
public static $modules = ['book', 'block', 'node_access_test', 'book_test'];
|
||||
|
||||
/**
|
||||
* A book node.
|
||||
*
|
||||
* @var \Drupal\node\NodeInterface
|
||||
*/
|
||||
protected $book;
|
||||
|
||||
/**
|
||||
* A user with permission to create and edit books.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $bookAuthor;
|
||||
|
||||
/**
|
||||
* A user with permission to view a book and access printer-friendly version.
|
||||
*
|
||||
|
@ -75,39 +61,6 @@ class BookTest extends BrowserTestBase {
|
|||
$this->adminUser = $this->drupalCreateUser(['create new books', 'create book content', 'edit any book content', 'delete any book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types', 'administer site configuration']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new book with a page hierarchy.
|
||||
*
|
||||
* @return \Drupal\node\NodeInterface[]
|
||||
*/
|
||||
public function createBook() {
|
||||
// Create new book.
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
|
||||
$this->book = $this->createBookNode('new');
|
||||
$book = $this->book;
|
||||
|
||||
/*
|
||||
* Add page hierarchy to book.
|
||||
* Book
|
||||
* |- Node 0
|
||||
* |- Node 1
|
||||
* |- Node 2
|
||||
* |- Node 3
|
||||
* |- Node 4
|
||||
*/
|
||||
$nodes = [];
|
||||
$nodes[] = $this->createBookNode($book->id()); // Node 0.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[0]->book['nid']); // Node 1.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[0]->book['nid']); // Node 2.
|
||||
$nodes[] = $this->createBookNode($book->id()); // Node 3.
|
||||
$nodes[] = $this->createBookNode($book->id()); // Node 4.
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the book navigation cache context.
|
||||
*
|
||||
|
@ -199,7 +152,8 @@ class BookTest extends BrowserTestBase {
|
|||
* |- Node 5
|
||||
* |- Node 4
|
||||
*/
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[3]->book['nid']); // Node 5.
|
||||
// Node 5.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[3]->book['nid']);
|
||||
$this->drupalLogout();
|
||||
$this->drupalLogin($this->webUser);
|
||||
// Verify the new outline - make sure we don't get stale cached data.
|
||||
|
@ -223,153 +177,12 @@ class BookTest extends BrowserTestBase {
|
|||
$this->checkBookNode($other_book, [$node], FALSE, FALSE, $node, []);
|
||||
$this->checkBookNode($node, NULL, $other_book, $other_book, FALSE, [$other_book]);
|
||||
|
||||
// Test that we can save a book programatically.
|
||||
// Test that we can save a book programmatically.
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
$book = $this->createBookNode('new');
|
||||
$book->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the outline of sub-pages; previous, up, and next.
|
||||
*
|
||||
* Also checks the printer friendly version of the outline.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityInterface $node
|
||||
* Node to check.
|
||||
* @param $nodes
|
||||
* Nodes that should be in outline.
|
||||
* @param $previous
|
||||
* (optional) Previous link node. Defaults to FALSE.
|
||||
* @param $up
|
||||
* (optional) Up link node. Defaults to FALSE.
|
||||
* @param $next
|
||||
* (optional) Next link node. Defaults to FALSE.
|
||||
* @param array $breadcrumb
|
||||
* The nodes that should be displayed in the breadcrumb.
|
||||
*/
|
||||
public function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to checkBookNode().
|
||||
static $number = 0;
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
|
||||
// Check outline structure.
|
||||
if ($nodes !== NULL) {
|
||||
$this->assertPattern($this->generateOutlinePattern($nodes), format_string('Node @number outline confirmed.', ['@number' => $number]));
|
||||
}
|
||||
else {
|
||||
$this->pass(format_string('Node %number does not have outline.', ['%number' => $number]));
|
||||
}
|
||||
|
||||
// Check previous, up, and next links.
|
||||
if ($previous) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $previous->urlInfo();
|
||||
$url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]);
|
||||
$text = SafeMarkup::format('<b>‹</b> @label', ['@label' => $previous->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Previous page link found.');
|
||||
}
|
||||
|
||||
if ($up) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $up->urlInfo();
|
||||
$url->setOptions(['attributes' => ['title' => t('Go to parent page')]]);
|
||||
$this->assertRaw(\Drupal::l('Up', $url), 'Up page link found.');
|
||||
}
|
||||
|
||||
if ($next) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $next->urlInfo();
|
||||
$url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]);
|
||||
$text = SafeMarkup::format('@label <b>›</b>', ['@label' => $next->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Next page link found.');
|
||||
}
|
||||
|
||||
// Compute the expected breadcrumb.
|
||||
$expected_breadcrumb = [];
|
||||
$expected_breadcrumb[] = \Drupal::url('<front>');
|
||||
foreach ($breadcrumb as $a_node) {
|
||||
$expected_breadcrumb[] = $a_node->url();
|
||||
}
|
||||
|
||||
// Fetch links in the current breadcrumb.
|
||||
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
|
||||
$got_breadcrumb = [];
|
||||
foreach ($links as $link) {
|
||||
$got_breadcrumb[] = $link->getAttribute('href');
|
||||
}
|
||||
|
||||
// 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.');
|
||||
|
||||
$number++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a regular expression to check for the sub-nodes in the outline.
|
||||
*
|
||||
* @param array $nodes
|
||||
* An array of nodes to check in outline.
|
||||
*
|
||||
* @return string
|
||||
* A regular expression that locates sub-nodes of the outline.
|
||||
*/
|
||||
public function generateOutlinePattern($nodes) {
|
||||
$outline = '';
|
||||
foreach ($nodes as $node) {
|
||||
$outline .= '(node\/' . $node->id() . ')(.*?)(' . $node->label() . ')(.*?)';
|
||||
}
|
||||
|
||||
return '/<nav id="book-navigation-' . $this->book->id() . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a book node.
|
||||
*
|
||||
* @param int|string $book_nid
|
||||
* A book node ID or set to 'new' to create a new book.
|
||||
* @param int|null $parent
|
||||
* (optional) Parent book reference ID. Defaults to NULL.
|
||||
*
|
||||
* @return \Drupal\node\NodeInterface
|
||||
* The created node.
|
||||
*/
|
||||
public function createBookNode($book_nid, $parent = NULL) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to createBookNode().
|
||||
static $number = 0; // Used to ensure that when sorted nodes stay in same order.
|
||||
|
||||
$edit = [];
|
||||
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - SimpleTest test node ' . $this->randomMachineName(10);
|
||||
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
|
||||
$edit['book[bid]'] = $book_nid;
|
||||
|
||||
if ($parent !== NULL) {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)'));
|
||||
|
||||
$edit['book[pid]'] = $parent;
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
// Make sure the parent was flagged as having children.
|
||||
$parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
|
||||
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
|
||||
}
|
||||
else {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Save'));
|
||||
}
|
||||
|
||||
// Check to make sure the book node was created.
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertNotNull(($node === FALSE ? NULL : $node), 'Book node found in database.');
|
||||
$number++;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests book export ("printer-friendly version") functionality.
|
||||
*/
|
||||
|
@ -469,7 +282,7 @@ class BookTest extends BrowserTestBase {
|
|||
$nodes[$child] = $this->createBookNode($book->id(), $nodes[$parent]->id());
|
||||
}
|
||||
$this->drupalGet($nodes[0]->toUrl('edit-form'));
|
||||
// Snice Node 0 has children 2 levels deep, nodes 10 and 11 should not
|
||||
// Since Node 0 has children 2 levels deep, nodes 10 and 11 should not
|
||||
// appear in the selector.
|
||||
$this->assertNoOption('edit-book-pid', $nodes[10]->id());
|
||||
$this->assertNoOption('edit-book-pid', $nodes[11]->id());
|
||||
|
@ -741,8 +554,8 @@ class BookTest extends BrowserTestBase {
|
|||
$this->drupalPlaceBlock('book_navigation', ['block_mode' => 'book pages']);
|
||||
|
||||
// Unpublish book node.
|
||||
$edit = [];
|
||||
$this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, t('Save and unpublish'));
|
||||
$edit = ['status[value]' => FALSE];
|
||||
$this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, t('Save'));
|
||||
|
||||
// Test node page.
|
||||
$this->drupalGet('node/' . $this->book->id());
|
||||
|
|
215
web/core/modules/book/tests/src/Functional/BookTestTrait.php
Normal file
215
web/core/modules/book/tests/src/Functional/BookTestTrait.php
Normal file
|
@ -0,0 +1,215 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Functional;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* Provides common functionality for Book test classes.
|
||||
*/
|
||||
trait BookTestTrait {
|
||||
|
||||
/**
|
||||
* A book node.
|
||||
*
|
||||
* @var \Drupal\node\NodeInterface
|
||||
*/
|
||||
protected $book;
|
||||
|
||||
/**
|
||||
* A user with permission to create and edit books.
|
||||
*
|
||||
* @var \Drupal\Core\Session\AccountInterface
|
||||
*/
|
||||
protected $bookAuthor;
|
||||
|
||||
/**
|
||||
* Creates a new book with a page hierarchy.
|
||||
*
|
||||
* @param array $edit
|
||||
* (optional) Field data in an associative array. Changes the current input
|
||||
* fields (where possible) to the values indicated. Defaults to an empty
|
||||
* array.
|
||||
*
|
||||
* @return \Drupal\node\NodeInterface[]
|
||||
*/
|
||||
public function createBook($edit = []) {
|
||||
// Create new book.
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
|
||||
$this->book = $this->createBookNode('new', NULL, $edit);
|
||||
$book = $this->book;
|
||||
|
||||
/*
|
||||
* Add page hierarchy to book.
|
||||
* Book
|
||||
* |- Node 0
|
||||
* |- Node 1
|
||||
* |- Node 2
|
||||
* |- Node 3
|
||||
* |- Node 4
|
||||
*/
|
||||
$nodes = [];
|
||||
// Node 0.
|
||||
$nodes[] = $this->createBookNode($book->id(), NULL, $edit);
|
||||
// Node 1.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[0]->book['nid'], $edit);
|
||||
// Node 2.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[0]->book['nid'], $edit);
|
||||
// Node 3.
|
||||
$nodes[] = $this->createBookNode($book->id(), NULL, $edit);
|
||||
// Node 4.
|
||||
$nodes[] = $this->createBookNode($book->id(), NULL, $edit);
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the outline of sub-pages; previous, up, and next.
|
||||
*
|
||||
* Also checks the printer friendly version of the outline.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityInterface $node
|
||||
* Node to check.
|
||||
* @param $nodes
|
||||
* Nodes that should be in outline.
|
||||
* @param $previous
|
||||
* Previous link node.
|
||||
* @param $up
|
||||
* Up link node.
|
||||
* @param $next
|
||||
* Next link node.
|
||||
* @param array $breadcrumb
|
||||
* The nodes that should be displayed in the breadcrumb.
|
||||
*/
|
||||
public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $next, array $breadcrumb) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to checkBookNode().
|
||||
static $number = 0;
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
|
||||
// Check outline structure.
|
||||
if ($nodes !== NULL) {
|
||||
$this->assertPattern($this->generateOutlinePattern($nodes), format_string('Node @number outline confirmed.', ['@number' => $number]));
|
||||
}
|
||||
else {
|
||||
$this->pass(format_string('Node %number does not have outline.', ['%number' => $number]));
|
||||
}
|
||||
|
||||
// Check previous, up, and next links.
|
||||
if ($previous) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $previous->urlInfo();
|
||||
$url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]);
|
||||
$text = new FormattableMarkup('<b>‹</b> @label', ['@label' => $previous->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Previous page link found.');
|
||||
}
|
||||
|
||||
if ($up) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $up->urlInfo();
|
||||
$url->setOptions(['attributes' => ['title' => t('Go to parent page')]]);
|
||||
$this->assertRaw(\Drupal::l('Up', $url), 'Up page link found.');
|
||||
}
|
||||
|
||||
if ($next) {
|
||||
/** @var \Drupal\Core\Url $url */
|
||||
$url = $next->urlInfo();
|
||||
$url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]);
|
||||
$text = new FormattableMarkup('@label <b>›</b>', ['@label' => $next->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Next page link found.');
|
||||
}
|
||||
|
||||
// Compute the expected breadcrumb.
|
||||
$expected_breadcrumb = [];
|
||||
$expected_breadcrumb[] = \Drupal::url('<front>');
|
||||
foreach ($breadcrumb as $a_node) {
|
||||
$expected_breadcrumb[] = $a_node->url();
|
||||
}
|
||||
|
||||
// Fetch links in the current breadcrumb.
|
||||
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
|
||||
$got_breadcrumb = [];
|
||||
foreach ($links as $link) {
|
||||
$got_breadcrumb[] = $link->getAttribute('href');
|
||||
}
|
||||
|
||||
// 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.');
|
||||
|
||||
$number++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a regular expression to check for the sub-nodes in the outline.
|
||||
*
|
||||
* @param array $nodes
|
||||
* An array of nodes to check in outline.
|
||||
*
|
||||
* @return string
|
||||
* A regular expression that locates sub-nodes of the outline.
|
||||
*/
|
||||
public function generateOutlinePattern($nodes) {
|
||||
$outline = '';
|
||||
foreach ($nodes as $node) {
|
||||
$outline .= '(node\/' . $node->id() . ')(.*?)(' . $node->label() . ')(.*?)';
|
||||
}
|
||||
|
||||
return '/<nav id="book-navigation-' . $this->book->id() . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a book node.
|
||||
*
|
||||
* @param int|string $book_nid
|
||||
* A book node ID or set to 'new' to create a new book.
|
||||
* @param int|null $parent
|
||||
* (optional) Parent book reference ID. Defaults to NULL.
|
||||
* @param array $edit
|
||||
* (optional) Field data in an associative array. Changes the current input
|
||||
* fields (where possible) to the values indicated. Defaults to an empty
|
||||
* array.
|
||||
*
|
||||
* @return \Drupal\node\NodeInterface
|
||||
* The created node.
|
||||
*/
|
||||
public function createBookNode($book_nid, $parent = NULL, $edit = []) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to createBookNode().
|
||||
// Used to ensure that when sorted nodes stay in same order.
|
||||
static $number = 0;
|
||||
|
||||
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - SimpleTest test node ' . $this->randomMachineName(10);
|
||||
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
|
||||
$edit['book[bid]'] = $book_nid;
|
||||
|
||||
if ($parent !== NULL) {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)'));
|
||||
|
||||
$edit['book[pid]'] = $parent;
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
// Make sure the parent was flagged as having children.
|
||||
$parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
|
||||
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
|
||||
}
|
||||
else {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Save'));
|
||||
}
|
||||
|
||||
// Check to make sure the book node was created.
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertNotNull(($node === FALSE ? NULL : $node), 'Book node found in database.');
|
||||
$number++;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Functional\Views;
|
||||
|
||||
use Drupal\Tests\views\Functional\ViewTestBase;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
|
||||
/**
|
||||
* Tests entity reference relationship data.
|
||||
*
|
||||
* @group book
|
||||
*
|
||||
* @see book_views_data()
|
||||
*/
|
||||
class BookRelationshipTest extends ViewTestBase {
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = ['test_book_view'];
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['book_test_views', 'book', 'views'];
|
||||
|
||||
/**
|
||||
* A book node.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $book;
|
||||
|
||||
/**
|
||||
* A user with permission to create and edit books.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $bookAuthor;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
// Create users.
|
||||
$this->bookAuthor = $this->drupalCreateUser(
|
||||
[
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit own book content',
|
||||
'add content to books',
|
||||
]
|
||||
);
|
||||
ViewTestData::createTestViews(get_class($this), ['book_test_views']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new book with a page hierarchy.
|
||||
*/
|
||||
protected function createBook() {
|
||||
// Create new book.
|
||||
$this->drupalLogin($this->bookAuthor);
|
||||
|
||||
$this->book = $this->createBookNode('new');
|
||||
$book = $this->book;
|
||||
|
||||
$nodes = [];
|
||||
// Node 0.
|
||||
$nodes[] = $this->createBookNode($book->id());
|
||||
// Node 1.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[0]->book['nid']);
|
||||
// Node 2.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[1]->book['nid']);
|
||||
// Node 3.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[2]->book['nid']);
|
||||
// Node 4.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[3]->book['nid']);
|
||||
// Node 5.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[4]->book['nid']);
|
||||
// Node 6.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[5]->book['nid']);
|
||||
// Node 7.
|
||||
$nodes[] = $this->createBookNode($book->id(), $nodes[6]->book['nid']);
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a book node.
|
||||
*
|
||||
* @param int|string $book_nid
|
||||
* A book node ID or set to 'new' to create a new book.
|
||||
* @param int|null $parent
|
||||
* (optional) Parent book reference ID. Defaults to NULL.
|
||||
*
|
||||
* @return \Drupal\node\NodeInterface
|
||||
* The book node.
|
||||
*/
|
||||
protected function createBookNode($book_nid, $parent = NULL) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// since it uniquely identifies each call to createBookNode().
|
||||
// Used to ensure that when sorted nodes stay in same order.
|
||||
static $number = 0;
|
||||
|
||||
$edit = [];
|
||||
$edit['title[0][value]'] = $number . ' - SimpleTest test node ' . $this->randomMachineName(10);
|
||||
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
|
||||
$edit['book[bid]'] = $book_nid;
|
||||
|
||||
if ($parent !== NULL) {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)'));
|
||||
|
||||
$edit['book[pid]'] = $parent;
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
// Make sure the parent was flagged as having children.
|
||||
$parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
|
||||
$this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
|
||||
}
|
||||
else {
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Save'));
|
||||
}
|
||||
|
||||
// Check to make sure the book node was created.
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertNotNull(($node === FALSE ? NULL : $node), 'Book node found in database.');
|
||||
$number++;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests using the views relationship.
|
||||
*/
|
||||
public function testRelationship() {
|
||||
|
||||
// Create new book.
|
||||
// @var \Drupal\node\NodeInterface[] $nodes
|
||||
$nodes = $this->createBook();
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$this->drupalGet('test-book/' . $nodes[$i]->id());
|
||||
|
||||
for ($j = 0; $j < $i; $j++) {
|
||||
$this->assertLink($nodes[$j]->label());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace Drupal\Tests\book\FunctionalJavascript;
|
|||
|
||||
use Behat\Mink\Exception\ExpectationException;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ use Drupal\node\Entity\Node;
|
|||
*
|
||||
* @group book
|
||||
*/
|
||||
class BookJavascriptTest extends JavascriptTestBase {
|
||||
class BookJavascriptTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Kernel;
|
||||
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests that the Book module handles pending revisions correctly.
|
||||
*
|
||||
* @group book
|
||||
*/
|
||||
class BookPendingRevisionTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['system', 'user', 'field', 'filter', 'text', 'node', 'book'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('user');
|
||||
$this->installEntitySchema('node');
|
||||
$this->installSchema('book', ['book']);
|
||||
$this->installSchema('node', ['node_access']);
|
||||
$this->installConfig(['node', 'book', 'field']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests pending revision handling for books.
|
||||
*/
|
||||
public function testBookWithPendingRevisions() {
|
||||
$content_type = NodeType::create([
|
||||
'type' => $this->randomMachineName(),
|
||||
'name' => $this->randomString(),
|
||||
]);
|
||||
$content_type->save();
|
||||
$book_config = $this->config('book.settings');
|
||||
$allowed_types = $book_config->get('allowed_types');
|
||||
$allowed_types[] = $content_type->id();
|
||||
$book_config->set('allowed_types', $allowed_types)->save();
|
||||
|
||||
// Create two top-level books a child.
|
||||
$book_1 = Node::create(['title' => $this->randomString(), 'type' => $content_type->id()]);
|
||||
$book_1->book['bid'] = 'new';
|
||||
$book_1->save();
|
||||
$book_1_child = Node::create(['title' => $this->randomString(), 'type' => $content_type->id()]);
|
||||
$book_1_child->book['bid'] = $book_1->id();
|
||||
$book_1_child->book['pid'] = $book_1->id();
|
||||
$book_1_child->save();
|
||||
|
||||
$book_2 = Node::create(['title' => $this->randomString(), 'type' => $content_type->id()]);
|
||||
$book_2->book['bid'] = 'new';
|
||||
$book_2->save();
|
||||
|
||||
$child = Node::create(['title' => $this->randomString(), 'type' => $content_type->id()]);
|
||||
$child->book['bid'] = $book_1->id();
|
||||
$child->book['pid'] = $book_1->id();
|
||||
$child->save();
|
||||
|
||||
// Try to move the child to a different book while saving it as a pending
|
||||
// revision.
|
||||
/** @var \Drupal\book\BookManagerInterface $book_manager */
|
||||
$book_manager = $this->container->get('book.manager');
|
||||
|
||||
// Check that the API doesn't allow us to change the book outline for
|
||||
// pending revisions.
|
||||
$child->book['bid'] = $book_2->id();
|
||||
$child->setNewRevision(TRUE);
|
||||
$child->isDefaultRevision(FALSE);
|
||||
|
||||
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
|
||||
|
||||
// Check that the API doesn't allow us to change the book parent for
|
||||
// pending revisions.
|
||||
$child = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
|
||||
$child->book['pid'] = $book_1_child->id();
|
||||
$child->setNewRevision(TRUE);
|
||||
$child->isDefaultRevision(FALSE);
|
||||
|
||||
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
|
||||
|
||||
// Check that the API doesn't allow us to change the book weight for
|
||||
// pending revisions.
|
||||
$child = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
|
||||
$child->book['weight'] = 2;
|
||||
$child->setNewRevision(TRUE);
|
||||
$child->isDefaultRevision(FALSE);
|
||||
|
||||
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
|
||||
}
|
||||
|
||||
}
|
|
@ -76,7 +76,7 @@ class BookUninstallTest extends KernelTestBase {
|
|||
|
||||
$book_node->delete();
|
||||
// No nodes exist therefore the book module is not required.
|
||||
$module_data = _system_rebuild_module_data();
|
||||
$module_data = \Drupal::service('extension.list.module')->reset()->getList();
|
||||
$this->assertFalse(isset($module_data['book']->info['required']), 'The book module is not required.');
|
||||
|
||||
$node = Node::create(['title' => $this->randomString(), 'type' => $content_type->id()]);
|
||||
|
|
|
@ -20,17 +20,29 @@ class MigrateBookConfigsTest extends MigrateDrupal6TestBase {
|
|||
public static $modules = ['book'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Data provider for testBookSettings().
|
||||
*
|
||||
* @return array
|
||||
* The data for each test scenario.
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_book_settings');
|
||||
public function providerBookSettings() {
|
||||
return [
|
||||
// d6_book_settings was renamed to book_settings, but use the old alias to
|
||||
// prove that it works.
|
||||
// @see book_migration_plugins_alter()
|
||||
['d6_book_settings'],
|
||||
['book_settings'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of book variables to book.settings.yml.
|
||||
*
|
||||
* @dataProvider providerBookSettings
|
||||
*/
|
||||
public function testBookSettings() {
|
||||
public function testBookSettings($migration_id) {
|
||||
$this->executeMigration($migration_id);
|
||||
|
||||
$config = $this->config('book.settings');
|
||||
$this->assertIdentical('book', $config->get('child_type'));
|
||||
$this->assertSame('book pages', $config->get('block.navigation.mode'));
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Tests the migration of Book settings.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateBookConfigsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['book', 'node'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('book_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of book variables to book.settings.yml.
|
||||
*/
|
||||
public function testBookSettings() {
|
||||
$config = $this->config('book.settings');
|
||||
$this->assertSame('book', $config->get('child_type'));
|
||||
$this->assertSame('all pages', $config->get('block.navigation.mode'));
|
||||
$this->assertSame(['book'], $config->get('allowed_types'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'book.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
* Tests migration of book structures from Drupal 7.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateBookTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = [
|
||||
'book',
|
||||
'menu_ui',
|
||||
'node',
|
||||
'taxonomy',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('node');
|
||||
$this->installEntitySchema('taxonomy_term');
|
||||
$this->installConfig(['node']);
|
||||
$this->installSchema('book', ['book']);
|
||||
$this->installSchema('node', ['node_access']);
|
||||
$this->executeMigrations([
|
||||
'd7_user_role',
|
||||
'd7_user',
|
||||
'd7_node_type',
|
||||
'd7_node',
|
||||
'd7_book',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 7 book structure to Drupal 8 migration.
|
||||
*/
|
||||
public function testBook() {
|
||||
$nodes = Node::loadMultiple([1, 2, 4, 6]);
|
||||
$this->assertSame('8', $nodes[1]->book['bid']);
|
||||
$this->assertSame('6', $nodes[1]->book['pid']);
|
||||
|
||||
$this->assertSame('4', $nodes[2]->book['bid']);
|
||||
$this->assertSame('6', $nodes[2]->book['pid']);
|
||||
|
||||
$this->assertSame('4', $nodes[4]->book['bid']);
|
||||
$this->assertSame('0', $nodes[4]->book['pid']);
|
||||
|
||||
$this->assertSame('4', $nodes[6]->book['bid']);
|
||||
$this->assertSame('4', $nodes[6]->book['pid']);
|
||||
|
||||
$tree = \Drupal::service('book.manager')->bookTreeAllData(4);
|
||||
$this->assertSame('4', $tree['49990 is - The thing about Firefly 4']['link']['nid']);
|
||||
$this->assertSame('6', $tree['49990 is - The thing about Firefly 4']['below']['50000 Comments are closed :-( 6']['link']['nid']);
|
||||
$this->assertSame('2', $tree['49990 is - The thing about Firefly 4']['below']['50000 Comments are closed :-( 6']['below']['50000 The thing about Deep Space 9 2']['link']['nid']);
|
||||
$this->assertSame([], $tree['49990 is - The thing about Firefly 4']['below']['50000 Comments are closed :-( 6']['below']['50000 The thing about Deep Space 9 2']['below']);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\book\Kernel\Plugin\migrate\source\d6;
|
||||
namespace Drupal\Tests\book\Kernel\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
use Drupal\book\Plugin\migrate\source\d6\Book as D6Book;
|
||||
|
||||
/**
|
||||
* @covers \Drupal\book\Plugin\migrate\source\d6\Book
|
||||
* @covers \Drupal\book\Plugin\migrate\source\Book
|
||||
* @group book
|
||||
* @group legacy
|
||||
*/
|
||||
class BookTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['book', 'migrate_drupal'];
|
||||
public static $modules = ['book', 'migrate_drupal', 'node'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -81,4 +83,18 @@ class BookTest extends MigrateSqlSourceTestBase {
|
|||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Book is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.x. Use \Drupal\book\Plugin\migrate\source\Book instead. See https://www.drupal.org/node/2947487 for more information.
|
||||
*/
|
||||
public function testDeprecatedPlugin() {
|
||||
new D6Book(
|
||||
[],
|
||||
'd6_book',
|
||||
[],
|
||||
$this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal(),
|
||||
$this->prophesize('Drupal\Core\State\StateInterface')->reveal(),
|
||||
$this->prophesize('Drupal\Core\Entity\EntityManagerInterface')->reveal()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue