3 namespace Drupal\Tests\block_content\Kernel\Migrate;
5 use Drupal\block_content\Entity\BlockContentType;
6 use Drupal\migrate\MigrateException;
7 use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
8 use Drupal\migrate_drupal\Tests\StubTestTrait;
11 * Test stub creation for block_content entities.
13 * @group block_content
15 class MigrateBlockContentStubTest extends MigrateDrupalTestBase {
22 public static $modules = ['block_content'];
27 protected function setUp() {
29 $this->installEntitySchema('block_content');
33 * Tests creation of block content stubs with no block_content_type available.
35 public function testStubFailure() {
36 $message = 'Expected MigrateException thrown when no bundles exist.';
38 $this->createStub('block_content');
39 $this->fail($message);
41 catch (MigrateException $e) {
42 $this->pass($message);
43 $this->assertEqual('Stubbing failed, no bundles available for entity type: block_content', $e->getMessage());
48 * Tests creation of block content stubs when there is a block_content_type.
50 public function testStubSuccess() {
51 BlockContentType::create([
52 'id' => 'test_block_content_type',
53 'label' => 'Test block content type',
55 $this->performStubTest('block_content');