You are here

public function MigrateBlockTest::testBlockMigration in Style Switcher 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Kernel/Migrate/d7/MigrateBlockTest.php \Drupal\Tests\styleswitcher\Kernel\Migrate\d7\MigrateBlockTest::testBlockMigration()

Tests the block migration.

File

tests/src/Kernel/Migrate/d7/MigrateBlockTest.php, line 45

Class

MigrateBlockTest
Tests migration of the Style Switcher block to a configuration entity.

Namespace

Drupal\Tests\styleswitcher\Kernel\Migrate\d7

Code

public function testBlockMigration() {
  $block = Block::load('bartik_styleswitcher_styleswitcher');
  $this
    ->assertTrue($block instanceof Block);

  /** @var \Drupal\block\BlockInterface $block */
  $this
    ->assertSame('styleswitcher_styleswitcher', $block
    ->getPluginId());
  $this
    ->assertSame('sidebar_first', $block
    ->getRegion());
  $this
    ->assertSame('bartik', $block
    ->getTheme());
  $this
    ->assertSame(TRUE, $block
    ->status());
  $config = $this
    ->config('block.block.bartik_styleswitcher_styleswitcher');
  $this
    ->assertSame('Switch Styles', $config
    ->get('settings.label'));
  $this
    ->assertSame('visible', $config
    ->get('settings.label_display'));

  // Assert that disabled blocks did not migrate.
  $non_existent_blocks = [
    'seven_styleswitcher_styleswitcher',
  ];
  $this
    ->assertTrue(empty(Block::loadMultiple($non_existent_blocks)));
}