composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -0,0 +1,29 @@
<?php
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a context-aware block that uses a not-passed, non-required context.
*
* @Block(
* id = "test_context_aware_no_valid_context_options",
* admin_label = @Translation("Test context-aware block - no valid context options"),
* context_definitions = {
* "email" = @ContextDefinition("email", required = FALSE)
* }
* )
*/
class TestContextAwareNoValidContextOptionsBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
return [
'#markup' => 'Rendered block with no valid context options',
];
}
}

View file

@ -3,6 +3,8 @@
namespace Drupal\Tests\block\Functional;
use Drupal\Component\Utility\Html;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
use Drupal\Tests\BrowserTestBase;
/**
@ -239,6 +241,13 @@ class BlockUiTest extends BrowserTestBase {
$this->assertText('User context found.');
$this->assertRaw($expected_text);
// Test context mapping form element is not visible if there are no valid
// context options for the block (the test_context_aware_no_valid_context_options
// block has one context defined which is not available for it on the
// Block Layout interface).
$this->drupalGet('admin/structure/block/add/test_context_aware_no_valid_context_options/classy');
$this->assertSession()->fieldNotExists('edit-settings-context-mapping-email');
// Test context mapping allows empty selection for optional contexts.
$this->drupalGet('admin/structure/block/manage/testcontextawareblock');
$edit = [
@ -281,6 +290,24 @@ class BlockUiTest extends BrowserTestBase {
* Tests the block placement indicator.
*/
public function testBlockPlacementIndicator() {
// Test the block placement indicator with using the domain as URL language
// indicator. This causes destination query parameters to be absolute URLs.
\Drupal::service('module_installer')->install(['language', 'locale']);
$this->container = \Drupal::getContainer();
ConfigurableLanguage::createFromLangcode('it')->save();
$config = $this->config('language.types');
$config->set('negotiation.language_interface.enabled', [
LanguageNegotiationUrl::METHOD_ID => -10,
]);
$config->save();
$config = $this->config('language.negotiation');
$config->set('url.source', LanguageNegotiationUrl::CONFIG_DOMAIN);
$config->set('url.domains', [
'en' => \Drupal::request()->getHost(),
'it' => 'it.example.com',
]);
$config->save();
// Select the 'Powered by Drupal' block to be placed.
$block = [];
$block['id'] = strtolower($this->randomMachineName());
@ -289,11 +316,30 @@ class BlockUiTest extends BrowserTestBase {
// After adding a block, it will indicate which block was just added.
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
$this->assertUrl('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id']));
$this->assertSession()->addressEquals('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id']));
// Resaving the block page will remove the block indicator.
// Resaving the block page will remove the block placement indicator.
$this->drupalPostForm(NULL, [], t('Save blocks'));
$this->assertUrl('admin/structure/block/list/classy');
$this->assertSession()->addressEquals('admin/structure/block/list/classy');
// Place another block and test the remove functionality works with the
// block placement indicator. Click the first 'Place block' link to bring up
// the list of blocks to place in the first available region.
$this->clickLink('Place block');
// Select the first available block.
$this->clickLink('Place block');
$block = [];
$block['id'] = strtolower($this->randomMachineName());
$block['theme'] = 'classy';
$this->submitForm([], 'Save block');
$this->assertSession()->addressEquals('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id']));
// Removing a block will remove the block placement indicator.
$this->clickLink('Remove');
$this->submitForm([], 'Remove');
// @todo https://www.drupal.org/project/drupal/issues/2980527 this should be
// 'admin/structure/block/list/classy' but there is a bug.
$this->assertSession()->addressEquals('admin/structure/block');
}
/**

View file

@ -0,0 +1,69 @@
<?php
namespace Drupal\Tests\block\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Tests migration of i18n block translations.
*
* @group migrate_drupal_7
*/
class MigrateBlockContentTranslationTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'node',
'text',
'aggregator',
'book',
'block',
'comment',
'forum',
'views',
'block_content',
'config_translation',
'content_translation',
'language',
'statistics',
'taxonomy',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['block']);
$this->installConfig(['block_content']);
$this->installEntitySchema('block_content');
$this->executeMigrations([
'language',
'd7_filter_format',
'block_content_type',
'block_content_body_field',
'd7_custom_block',
'd7_user_role',
'd7_block',
'd7_block_translation',
]);
block_rebuild();
}
/**
* Tests the migration of block title translation.
*/
public function testBlockContentTranslation() {
/** @var \Drupal\language\ConfigurableLanguageManagerInterface $language_manager */
$language_manager = $this->container->get('language_manager');
$config = $language_manager->getLanguageConfigOverride('fr', 'block.block.bartik_user_login');
$this->assertSame('fr - User login title', $config->get('settings.label'));
}
}

View file

@ -112,10 +112,10 @@ class MigrateBlockTest extends MigrateDrupal7TestBase {
public function testBlockMigration() {
$this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'bartik', 0, '', '0');
$this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'sidebar_first', 'bartik', -1, '', '0');
$this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'sidebar_first', 'bartik', 0, '', '0');
$this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'sidebar_first', 'bartik', 0, 'User login title', 'visible');
$this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer_fifth', 'bartik', 10, '', '0');
$this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'seven', 0, '', '0');
$this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'seven', 10, '', '0');
$this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'seven', 10, 'User login title', 'visible');
// The d7_custom_block migration should have migrated a block containing a
// mildly amusing limerick. We'll need its UUID to determine

View file

@ -0,0 +1,147 @@
<?php
namespace Drupal\Tests\block\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests i18n block source plugin.
*
* @covers \Drupal\block\Plugin\migrate\source\d7\BlockTranslation
*
* @group content_translation
*/
class BlockTranslationTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['block', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
// The source data.
$tests[0]['source_data']['block'] = [
[
'bid' => 1,
'module' => 'system',
'delta' => 'main',
'theme' => 'bartik',
'status' => 1,
'weight' => 0,
'region' => 'content',
'custom' => '0',
'visibility' => 0,
'pages' => '',
'title' => '',
'cache' => -1,
'i18n_mode' => 0,
],
[
'bid' => 2,
'module' => 'system',
'delta' => 'navigation',
'theme' => 'bartik',
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
'custom' => '0',
'visibility' => 0,
'pages' => '',
'title' => 'Navigation',
'cache' => -1,
'i18n_mode' => 1,
],
];
$tests[0]['source_data']['block_role'] = [
[
'module' => 'block',
'delta' => 1,
'rid' => 2,
],
[
'module' => 'block',
'delta' => 2,
'rid' => 2,
],
[
'module' => 'block',
'delta' => 2,
'rid' => 100,
],
];
$tests[0]['source_data']['i18n_string'] = [
[
'lid' => 1,
'textgroup' => 'block',
'context' => '1',
'objectid' => 'navigation',
'type' => 'system',
'property' => 'title',
'objectindex' => 0,
'format' => '',
],
];
$tests[0]['source_data']['locales_target'] = [
[
'lid' => 1,
'translation' => 'fr - Navigation',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
];
$tests[0]['source_data']['role'] = [
[
'rid' => 2,
'name' => 'authenticated user',
],
];
$tests[0]['source_data']['system'] = [
[
'filename' => 'modules/system/system.module',
'name' => 'system',
'type' => 'module',
'owner' => '',
'status' => '1',
'throttle' => '0',
'bootstrap' => '0',
'schema_version' => '7055',
'weight' => '0',
'info' => 'a:0:{}',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'bid' => 2,
'module' => 'system',
'delta' => 'navigation',
'theme' => 'bartik',
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
'custom' => '0',
'visibility' => 0,
'pages' => '',
'title' => 'Navigation',
'cache' => -1,
'i18n_mode' => 1,
'lid' => 1,
'translation' => 'fr - Navigation',
'language' => 'fr',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
];
return $tests;
}
}