You are here

protected function MigrateFilterFormatTest::assertEntity in Drupal 9

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

Asserts various aspects of a filter format entity.

Parameters

string $id: The format ID.

string $label: The expected label of the format.

array $enabled_filters: The expected filters in the format, keyed by ID with weight as values.

int $weight: The weight of the filter.

bool $status: The status of the filter.

1 call to MigrateFilterFormatTest::assertEntity()
MigrateFilterFormatTest::testFilterFormat in core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php
Tests the Drupal 7 filter format to Drupal 8 migration.

File

core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php, line 71

Class

MigrateFilterFormatTest
Upgrade variables to filter.formats.*.yml.

Namespace

Drupal\Tests\filter\Kernel\Migrate\d7

Code

protected function assertEntity($id, $label, array $enabled_filters, $weight, $status) {

  /** @var \Drupal\filter\FilterFormatInterface $entity */
  $entity = FilterFormat::load($id);
  $this
    ->assertInstanceOf(FilterFormatInterface::class, $entity);
  $this
    ->assertSame($label, $entity
    ->label());

  // get('filters') will return enabled filters only, not all of them.
  $this
    ->assertSame(array_keys($enabled_filters), array_keys($entity
    ->get('filters')));
  $this
    ->assertSame($weight, $entity
    ->get('weight'));
  $this
    ->assertSame($status, $entity
    ->status());
  foreach ($entity
    ->get('filters') as $filter_id => $filter) {
    $this
      ->assertSame($filter['weight'], $enabled_filters[$filter_id]);
  }
}