You are here

protected function MigrateViewModesTest::assertEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest::assertEntity()
  2. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest::assertEntity()

Asserts various aspects of a view mode entity.

@internal

Parameters

string $id: The entity ID.

string $label: The expected label of the view mode.

string $entity_type: The expected entity type ID which owns the view mode.

1 call to MigrateViewModesTest::assertEntity()
MigrateViewModesTest::testMigration in core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php
Tests migration of D7 view mode variables to D8 config entities.

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php, line 40

Class

MigrateViewModesTest
Tests migration of D7 view modes.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

protected function assertEntity(string $id, string $label, string $entity_type) : void {

  /** @var \Drupal\Core\Entity\EntityViewModeInterface $view_mode */
  $view_mode = EntityViewMode::load($id);
  $this
    ->assertInstanceOf(EntityViewModeInterface::class, $view_mode);
  $this
    ->assertSame($label, $view_mode
    ->label());
  $this
    ->assertSame($entity_type, $view_mode
    ->getTargetType());
}