function MigrateFilterFormatTest::assertEntity
Asserts various aspects of a filter format entity.
@internal
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 77
Class
- MigrateFilterFormatTest
- Upgrade variables to filter.formats.*.yml.
Namespace
Drupal\Tests\filter\Kernel\Migrate\d7Code
protected function assertEntity(string $id, string $label, array $enabled_filters, int $weight, bool $status) : void {
/** @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]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.