updated core to 8.6.1 via composer
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\book\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\workflows\Entity\Workflow;
|
||||
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
|
||||
|
||||
/**
|
||||
* Tests Book and Content Moderation integration.
|
||||
@@ -13,6 +13,7 @@ use Drupal\workflows\Entity\Workflow;
|
||||
class BookContentModerationTest extends BrowserTestBase {
|
||||
|
||||
use BookTestTrait;
|
||||
use ContentModerationTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
@@ -30,7 +31,7 @@ class BookContentModerationTest extends BrowserTestBase {
|
||||
$this->drupalPlaceBlock('system_breadcrumb_block');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
$workflow = Workflow::load('editorial');
|
||||
$workflow = $this->createEditorialWorkflow();
|
||||
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'book');
|
||||
$workflow->save();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\book\Functional;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ trait BookTestTrait {
|
||||
/** @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()]);
|
||||
$text = new FormattableMarkup('<b>‹</b> @label', ['@label' => $previous->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Previous page link found.');
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ trait BookTestTrait {
|
||||
/** @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()]);
|
||||
$text = new FormattableMarkup('@label <b>›</b>', ['@label' => $next->label()]);
|
||||
$this->assertRaw(\Drupal::l($text, $url), 'Next page link found.');
|
||||
}
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
|
||||
}
|
||||
+18
-2
@@ -1,12 +1,14 @@
|
||||
<?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 {
|
||||
|
||||
@@ -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 New Issue
Block a user