MigrateBlockContentStubTest.php in Drupal 9
File
core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentStubTest.php
View source
<?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;
class MigrateBlockContentStubTest extends MigrateDrupalTestBase {
use StubTestTrait;
protected static $modules = [
'block_content',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('block_content');
}
public function testStubFailure() {
$this
->expectException(MigrateException::class);
$this
->expectExceptionMessage('Stubbing failed, no bundles available for entity type: block_content');
$this
->createEntityStub('block_content');
}
public function testStubSuccess() {
BlockContentType::create([
'id' => 'test_block_content_type',
'label' => 'Test block content type',
])
->save();
$this
->performStubTest('block_content');
}
}