function MigrateViewModesTest::assertEntity

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest::assertEntity()
  2. 8.9.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateViewModesTest::assertEntity()
  3. 11.x 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 45

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.