protected function MigrateImageStylesTest::assertEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/image/src/Tests/Migrate/d7/MigrateImageStylesTest.php \Drupal\image\Tests\Migrate\d7\MigrateImageStylesTest::assertEntity()
Asserts various aspects of an ImageStyle entity.
Parameters
string $id: The expected image style ID.
string $label: The expected image style label.
array $expected_effect_plugins: An array of expected plugins attached to the image style entity
array $expected_effect_config: An array of expected configuration for each effect in the image style
1 call to MigrateImageStylesTest::assertEntity()
- MigrateImageStylesTest::testImageStylesMigration in core/
modules/ image/ src/ Tests/ Migrate/ d7/ MigrateImageStylesTest.php - Test the image styles migration.
File
- core/
modules/ image/ src/ Tests/ Migrate/ d7/ MigrateImageStylesTest.php, line 57 - Contains \Drupal\image\Tests\Migrate\d7\MigrateImageStylesTest.
Class
- MigrateImageStylesTest
- Test image styles migration to config entities.
Namespace
Drupal\image\Tests\Migrate\d7Code
protected function assertEntity($id, $label, array $expected_effect_plugins, array $expected_effect_config) {
$style = ImageStyle::load($id);
$this
->assertTrue($style instanceof ImageStyleInterface);
/** @var \Drupal\image\ImageStyleInterface $style */
$this
->assertIdentical($id, $style
->id());
$this
->assertIdentical($label, $style
->label());
// Check the number of effects associated with the style.
$effects = $style
->getEffects();
$this
->assertIdentical(count($effects), count($expected_effect_plugins));
$index = 0;
foreach ($effects as $effect) {
$this
->assertTrue($effect instanceof ImageEffectBase);
$this
->assertIdentical($expected_effect_plugins[$index], $effect
->getPluginId());
$config = $effect
->getConfiguration();
$this
->assertIdentical($expected_effect_config[$index], $config['data']);
$index++;
}
}