public function MigrateBlockTest::assertEntity in Drupal 10
Same name in this branch
- 10 core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php \Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest::assertEntity()
- 10 core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php \Drupal\Tests\block\Kernel\Migrate\d7\MigrateBlockTest::assertEntity()
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php \Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest::assertEntity()
- 9 core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php \Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest::assertEntity()
Asserts various aspects of a block.
@internal
Parameters
string $id: The block ID.
array $visibility: The block visibility settings.
string $region: The display region.
string $theme: The theme.
int $weight: The block weight.
array $settings: (optional) The block settings.
bool $status: Whether the block is expected to be enabled or disabled.
1 call to MigrateBlockTest::assertEntity()
- MigrateBlockTest::testBlockMigration in core/
modules/ block/ tests/ src/ Kernel/ Migrate/ d6/ MigrateBlockTest.php - Tests the block migration.
File
- core/
modules/ block/ tests/ src/ Kernel/ Migrate/ d6/ MigrateBlockTest.php, line 80
Class
- MigrateBlockTest
- Tests migration of blocks to configuration entities.
Namespace
Drupal\Tests\block\Kernel\Migrate\d6Code
public function assertEntity(string $id, array $visibility, string $region, string $theme, int $weight, array $settings = NULL, bool $status = TRUE) : void {
$block = Block::load($id);
$this
->assertInstanceOf(Block::class, $block);
$this
->assertSame($visibility, $block
->getVisibility());
$this
->assertSame($region, $block
->getRegion());
$this
->assertSame($theme, $block
->getTheme());
$this
->assertSame($weight, $block
->getWeight());
$this
->assertSame($status, $block
->status());
if ($settings) {
$block_settings = $block
->get('settings');
$block_settings['id'] = current(explode(':', $block_settings['id']));
$this
->assertEquals($settings, $block_settings);
}
}