Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Kernel\Migrate;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\FieldConfigInterface;
|
||||
use Drupal\field\FieldStorageConfigInterface;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Attaches a body field to the custom block type.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
|
||||
|
||||
static $modules = array('block', 'block_content', 'filter', 'text');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['block_content']);
|
||||
$this->installEntitySchema('block_content');
|
||||
$this->executeMigrations([
|
||||
'block_content_type',
|
||||
'block_content_body_field',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the block content body field migration.
|
||||
*/
|
||||
public function testBlockContentBodyFieldMigration() {
|
||||
/** @var \Drupal\field\FieldStorageConfigInterface $storage */
|
||||
$storage = FieldStorageConfig::load('block_content.body');
|
||||
$this->assertTrue($storage instanceof FieldStorageConfigInterface);
|
||||
$this->assertIdentical('block_content', $storage->getTargetEntityTypeId());
|
||||
$this->assertIdentical(['basic'], array_values($storage->getBundles()));
|
||||
$this->assertIdentical('body', $storage->getName());
|
||||
|
||||
/** @var \Drupal\field\FieldConfigInterface $field */
|
||||
$field = FieldConfig::load('block_content.basic.body');
|
||||
$this->assertTrue($field instanceof FieldConfigInterface);
|
||||
$this->assertIdentical('block_content', $field->getTargetEntityTypeId());
|
||||
$this->assertIdentical('basic', $field->getTargetBundle());
|
||||
$this->assertIdentical('body', $field->getName());
|
||||
$this->assertIdentical('Body', $field->getLabel());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Kernel\Migrate;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\migrate\MigrateException;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
|
||||
use Drupal\migrate_drupal\Tests\StubTestTrait;
|
||||
|
||||
/**
|
||||
* Test stub creation for block_content entities.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class MigrateBlockContentStubTest extends MigrateDrupalTestBase {
|
||||
|
||||
use StubTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['block_content'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('block_content');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of block content stubs with no block_content_type available.
|
||||
*/
|
||||
public function testStubFailure() {
|
||||
$message = 'Expected MigrateException thrown when no bundles exist.';
|
||||
try {
|
||||
$this->createStub('block_content');
|
||||
$this->fail($message);
|
||||
}
|
||||
catch (MigrateException $e) {
|
||||
$this->pass($message);
|
||||
$this->assertEqual('Stubbing failed, no bundles available for entity type: block_content', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of block content stubs when there is a block_content_type.
|
||||
*/
|
||||
public function testStubSuccess() {
|
||||
BlockContentType::create([
|
||||
'id' => 'test_block_content_type',
|
||||
'label' => 'Test block content type',
|
||||
])->save();
|
||||
$this->performStubTest('block_content');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Kernel\Migrate;
|
||||
|
||||
use Drupal\block_content\BlockContentTypeInterface;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of the basic block content type.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class MigrateBlockContentTypeTest extends MigrateDrupal7TestBase {
|
||||
|
||||
static $modules = array('block', 'block_content', 'filter', 'text');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['block_content']);
|
||||
$this->installEntitySchema('block_content');
|
||||
$this->executeMigration('block_content_type');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the block content type migration.
|
||||
*/
|
||||
public function testBlockContentTypeMigration() {
|
||||
/** @var \Drupal\block_content\BlockContentTypeInterface $entity */
|
||||
$entity = BlockContentType::load('basic');
|
||||
$this->assertTrue($entity instanceof BlockContentTypeInterface);
|
||||
$this->assertIdentical('Basic', $entity->label());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade custom blocks.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateBlockContentTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['block', 'block_content'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['block_content']);
|
||||
$this->installEntitySchema('block_content');
|
||||
|
||||
$this->executeMigrations([
|
||||
'd6_filter_format',
|
||||
'block_content_type',
|
||||
'block_content_body_field',
|
||||
'd6_custom_block',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 custom block to Drupal 8 migration.
|
||||
*/
|
||||
public function testBlockMigration() {
|
||||
/** @var BlockContent $block */
|
||||
$block = BlockContent::load(1);
|
||||
$this->assertIdentical('My block 1', $block->label());
|
||||
$this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
|
||||
$this->assertIdentical('en', $block->language()->getId());
|
||||
$this->assertIdentical('<h3>My first custom block body</h3>', $block->body->value);
|
||||
$this->assertIdentical('full_html', $block->body->format);
|
||||
|
||||
$block = BlockContent::load(2);
|
||||
$this->assertIdentical('My block 2', $block->label());
|
||||
$this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
|
||||
$this->assertIdentical('en', $block->language()->getId());
|
||||
$this->assertIdentical('<h3>My second custom block body</h3>', $block->body->value);
|
||||
$this->assertIdentical('full_html', $block->body->format);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\block_content\BlockContentInterface;
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of custom blocks.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class MigrateCustomBlockTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array(
|
||||
'block_content',
|
||||
'filter',
|
||||
'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(static::$modules);
|
||||
$this->installEntitySchema('block_content');
|
||||
|
||||
$this->executeMigrations([
|
||||
'd7_filter_format',
|
||||
'block_content_type',
|
||||
'block_content_body_field',
|
||||
'd7_custom_block',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of custom blocks from Drupal 7 to Drupal 8.
|
||||
*/
|
||||
public function testCustomBlockMigration() {
|
||||
$block = BlockContent::load(1);
|
||||
$this->assertTrue($block instanceof BlockContentInterface);
|
||||
/** @var \Drupal\block_content\BlockContentInterface $block */
|
||||
$this->assertIdentical('Limerick', $block->label());
|
||||
|
||||
$expected_body = "A fellow jumped off a high wall\r\nAnd had a most terrible fall\r\nHe went back to bed\r\nWith a bump on his head\r\nThat's why you don't jump off a wall";
|
||||
$this->assertIdentical($expected_body, $block->body->value);
|
||||
$this->assertIdentical('filtered_html', $block->body->format);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\block_content\Unit\Menu\BlockContentLocalTasksTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\block_content\Unit\Menu;
|
||||
|
||||
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\block_content\Unit\Plugin\migrate\source\d6\BoxTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\block_content\Unit\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\block_content\Unit\Plugin\migrate\source\d7\BlockCustomTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\block_content\Unit\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\block_content\Plugin\migrate\source\d7\BlockCustom;
|
||||
|
|
Reference in a new issue