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:
parent
23ffed3665
commit
507b45a0ed
378 changed files with 11434 additions and 5542 deletions
|
@ -23,4 +23,4 @@ destination:
|
|||
migration_dependencies:
|
||||
required:
|
||||
- d7_shortcut_set
|
||||
- menu_links
|
||||
- d7_menu_links
|
||||
|
|
|
@ -311,7 +311,8 @@ function shortcut_preprocess_page_title(&$variables) {
|
|||
|
||||
// Replicate template_preprocess_html()'s processing to get the title in
|
||||
// string form, so we can set the default name for the shortcut.
|
||||
$name = render($variables['title']);
|
||||
// Strip HTML tags from the title.
|
||||
$name = trim(strip_tags(render($variables['title'])));
|
||||
$query = array(
|
||||
'link' => $link,
|
||||
'name' => $name,
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace Drupal\shortcut\Tests;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\shortcut\Entity\Shortcut;
|
||||
use Drupal\shortcut\Entity\ShortcutSet;
|
||||
|
@ -161,18 +163,12 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
|||
// Test the "Add to shortcuts" link for a page generated by views.
|
||||
$this->clickLink('Add to Default shortcuts');
|
||||
$this->assertText('Added a shortcut for People.');
|
||||
// Due to the structure of the markup in the link ::assertLink() doesn't
|
||||
// works here.
|
||||
$link = $this->xpath('//a[normalize-space()=:label]', array(':label' => 'Remove from Default shortcuts'));
|
||||
$this->assertTrue(!empty($link), 'Link Remove from Default shortcuts found.');
|
||||
$this->assertShortcutQuickLink('Remove from Default shortcuts');
|
||||
|
||||
// Test the "Remove from shortcuts" link for a page generated by views.
|
||||
$this->clickLink('Remove from Default shortcuts');
|
||||
$this->assertText('The shortcut People has been deleted.');
|
||||
// Due to the structure of the markup in the link ::assertLink() doesn't
|
||||
// works here.
|
||||
$link = $this->xpath('//a[normalize-space()=:label]', array(':label' => 'Add to Default shortcuts'));
|
||||
$this->assertTrue(!empty($link), 'Link Add to Default shortcuts found.');
|
||||
$this->assertShortcutQuickLink('Add to Default shortcuts');
|
||||
|
||||
// Test two pages which use same route name but different route parameters.
|
||||
$this->drupalGet('node/add/page');
|
||||
|
@ -186,6 +182,37 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
|||
// Add Shortcut for Article.
|
||||
$this->clickLink('Add to Default shortcuts');
|
||||
$this->assertText('Added a shortcut for Create Article.');
|
||||
|
||||
$this->config('system.theme')->set('default', 'seven')->save();
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$title = $this->node->getTitle();
|
||||
|
||||
// Test the "Add to shortcuts" link for node view route.
|
||||
$this->clickLink('Add to Default shortcuts');
|
||||
$this->assertText(new FormattableMarkup('Added a shortcut for @title.', ['@title' => $title]));
|
||||
$this->assertShortcutQuickLink('Remove from Default shortcuts');
|
||||
|
||||
// Test the "Remove from shortcuts" link for node view route.
|
||||
$this->clickLink('Remove from Default shortcuts');
|
||||
$this->assertText(new FormattableMarkup('The shortcut @title has been deleted.', ['@title' => $title]));
|
||||
$this->assertShortcutQuickLink('Add to Default shortcuts');
|
||||
|
||||
\Drupal::service('module_installer')->install(['block_content']);
|
||||
BlockContentType::create(array(
|
||||
'id' => 'basic',
|
||||
'label' => 'Basic block',
|
||||
'revision' => FALSE,
|
||||
))->save();
|
||||
// Test page with HTML tags in title.
|
||||
$this->drupalGet('admin/structure/block/block-content/manage/basic');
|
||||
$page_title = new FormattableMarkup('Edit %label custom block type', ['%label' => 'Basic block']);
|
||||
$this->assertRaw($page_title);
|
||||
// Add shortcut to this page.
|
||||
$this->clickLink('Add to Default shortcuts');
|
||||
$this->assertRaw(new FormattableMarkup('Added a shortcut for %title.', [
|
||||
'%title' => trim(strip_tags($page_title)),
|
||||
]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -404,4 +431,32 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
|||
$this->assertNoBlockAppears($block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes if a shortcut quick link with the specified label is found.
|
||||
*
|
||||
* An optional link index may be passed.
|
||||
*
|
||||
* @param string $label
|
||||
* Text between the anchor tags.
|
||||
* @param int $index
|
||||
* Link position counting from zero.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages: use format_string() to embed variables in the message text, not
|
||||
* t(). If left blank, a default message will be displayed.
|
||||
* @param string $group
|
||||
* (optional) The group this message is in, which is displayed in a column
|
||||
* in test output. Use 'Debug' to indicate this is debugging output. Do not
|
||||
* translate this string. Defaults to 'Other'; most tests do not override
|
||||
* this default.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the assertion succeeded, FALSE otherwise.
|
||||
*/
|
||||
protected function assertShortcutQuickLink($label, $index = 0, $message = '', $group = 'Other') {
|
||||
$links = $this->xpath('//a[normalize-space()=:label]', array(':label' => $label));
|
||||
$message = ($message ? $message : SafeMarkup::format('Shortcut quick link with label %label found.', array('%label' => $label)));
|
||||
return $this->assert(isset($links[$index]), $message, $group);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ class MigrateShortcutSetTest extends MigrateDrupal7TestBase {
|
|||
$this->installEntitySchema('menu_link_content');
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
$this->executeMigration('d7_shortcut_set');
|
||||
$this->executeMigration('menu');
|
||||
$this->executeMigration('menu_links');
|
||||
$this->executeMigration('d7_menu');
|
||||
$this->executeMigration('d7_menu_links');
|
||||
$this->executeMigration('d7_shortcut');
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ class MigrateShortcutSetUsersTest extends MigrateDrupal7TestBase {
|
|||
$this->executeMigration('d7_user_role');
|
||||
$this->executeMigration('d7_user');
|
||||
$this->executeMigration('d7_shortcut_set');
|
||||
$this->executeMigration('menu');
|
||||
$this->executeMigration('menu_links');
|
||||
$this->executeMigration('d7_menu');
|
||||
$this->executeMigration('d7_menu_links');
|
||||
$this->executeMigration('d7_shortcut');
|
||||
$this->executeMigration('d7_shortcut_set_users');
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ class MigrateShortcutTest extends MigrateDrupal7TestBase {
|
|||
$this->installEntitySchema('menu_link_content');
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
$this->executeMigration('d7_shortcut_set');
|
||||
$this->executeMigration('menu');
|
||||
$this->executeMigration('menu_links');
|
||||
$this->executeMigration('d7_menu');
|
||||
$this->executeMigration('d7_menu_links');
|
||||
$this->executeMigration('d7_shortcut');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests D7 ShortcutSet source plugin.
|
||||
*
|
||||
* @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutSetTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['shortcut', 'migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['shortcut_set'] = [
|
||||
[
|
||||
'set_name' => 'shortcut-set-2',
|
||||
'title' => 'Alternative shortcut set',
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results are identical to the source data.
|
||||
$tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set'];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests D7 ShortcutSetUsers source plugin.
|
||||
*
|
||||
* @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutSetUsersTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['shortcut', 'migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['shortcut_set_users'] = [
|
||||
[
|
||||
'uid' => '2',
|
||||
'set_name' => 'shortcut-set-2',
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results are identical to the source data.
|
||||
$tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set_users'];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests D7 Shortcut source plugin.
|
||||
*
|
||||
* @covers Drupal\shortcut\Plugin\migrate\source\d7\Shortcut
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['shortcut', 'migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['menu_links'] = [
|
||||
[
|
||||
'menu_name' => 'shortcut-set-2',
|
||||
'mlid' => '473',
|
||||
'plid' => '0',
|
||||
'link_path' => 'admin/people',
|
||||
'router_path' => 'admin/people',
|
||||
'link_title' => 'People',
|
||||
'options' => 'a:0:{}',
|
||||
'module' => 'menu',
|
||||
'hidden' => '0',
|
||||
'external' => '0',
|
||||
'has_children' => '0',
|
||||
'expanded' => '0',
|
||||
'weight' => '-50',
|
||||
'depth' => '1',
|
||||
'customized' => '0',
|
||||
'p1' => '473',
|
||||
'p2' => '0',
|
||||
'p3' => '0',
|
||||
'p4' => '0',
|
||||
'p5' => '0',
|
||||
'p6' => '0',
|
||||
'p7' => '0',
|
||||
'p8' => '0',
|
||||
'p9' => '0',
|
||||
'updated' => '0',
|
||||
]
|
||||
];
|
||||
|
||||
// The expected results.
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'mlid' => '473',
|
||||
'menu_name' => 'shortcut-set-2',
|
||||
'link_path' => 'admin/people',
|
||||
'link_title' => 'People',
|
||||
'weight' => '-50',
|
||||
],
|
||||
];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D7 ShortcutSet source plugin.
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutSetTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet';
|
||||
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'source' => [
|
||||
'plugin' => 'd7_shortcut_set',
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'set_name' => 'shortcut-set-2',
|
||||
'title' => 'Alternative shortcut set',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['shortcut_set'] = $this->expectedResults;
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D7 ShortcutSetUsers source plugin.
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutSetUsersTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers';
|
||||
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'source' => [
|
||||
'plugin' => 'd7_shortcut_set_users',
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'uid' => '2',
|
||||
'set_name' => 'shortcut-set-2',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['shortcut_set_users'] = $this->expectedResults;
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D7 Shortcut source plugin.
|
||||
*
|
||||
* @group shortcut
|
||||
*/
|
||||
class ShortcutTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\Shortcut';
|
||||
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'source' => [
|
||||
'plugin' => 'd7_shortcut',
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'mlid' => '473',
|
||||
'menu_name' => 'shortcut-set-2',
|
||||
'link_path' => 'admin/people',
|
||||
'link_title' => 'People',
|
||||
'weight' => '-50',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['menu_links'][] = [
|
||||
'menu_name' => 'shortcut-set-2',
|
||||
'mlid' => '473',
|
||||
'plid' => '0',
|
||||
'link_path' => 'admin/people',
|
||||
'router_path' => 'admin/people',
|
||||
'link_title' => 'People',
|
||||
'options' => 'a:0:{}',
|
||||
'module' => 'menu',
|
||||
'hidden' => '0',
|
||||
'external' => '0',
|
||||
'has_children' => '0',
|
||||
'expanded' => '0',
|
||||
'weight' => '-50',
|
||||
'depth' => '1',
|
||||
'customized' => '0',
|
||||
'p1' => '473',
|
||||
'p2' => '0',
|
||||
'p3' => '0',
|
||||
'p4' => '0',
|
||||
'p5' => '0',
|
||||
'p6' => '0',
|
||||
'p7' => '0',
|
||||
'p8' => '0',
|
||||
'p9' => '0',
|
||||
'updated' => '0',
|
||||
];
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue