protected function MigrateCommentFieldInstanceTest::assertEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\comment\Tests\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
Asserts a comment field entity.
Parameters
string $id: The entity ID.
string $field_name: The field name.
string $bundle: The bundle ID.
int $default_mode: The field's default_mode setting.
int $per_page: The field's per_page setting.
bool $anonymous: The field's anonymous setting.
int $form_location: The field's form_location setting.
bool $preview: The field's preview setting.
1 call to MigrateCommentFieldInstanceTest::assertEntity()
- MigrateCommentFieldInstanceTest::testMigration in core/
modules/ comment/ src/ Tests/ Migrate/ d7/ MigrateCommentFieldInstanceTest.php - Tests the migrated fields.
File
- core/
modules/ comment/ src/ Tests/ Migrate/ d7/ MigrateCommentFieldInstanceTest.php, line 59 - Contains \Drupal\comment\Tests\Migrate\d7\MigrateCommentFieldInstanceTest.
Class
- MigrateCommentFieldInstanceTest
- Tests creation of comment reference fields for each comment type defined in Drupal 7.
Namespace
Drupal\comment\Tests\Migrate\d7Code
protected function assertEntity($id, $field_name, $bundle, $default_mode, $per_page, $anonymous, $form_location, $preview) {
$entity = FieldConfig::load($id);
$this
->assertTrue($entity instanceof FieldConfigInterface);
/** @var \Drupal\field\FieldConfigInterface $entity */
$this
->assertIdentical('node', $entity
->getTargetEntityTypeId());
$this
->assertIdentical('Comments', $entity
->label());
$this
->assertTrue($entity
->isRequired());
$this
->assertIdentical($field_name, $entity
->getFieldStorageDefinition()
->getName());
$this
->assertIdentical($bundle, $entity
->getTargetBundle());
$this
->assertTrue($entity
->get('default_value')[0]['status']);
$this
->assertEqual($default_mode, $entity
->getSetting('default_mode'));
$this
->assertIdentical($per_page, $entity
->getSetting('per_page'));
$this
->assertEqual($anonymous, $entity
->getSetting('anonymous'));
// This assertion fails because 1 !== TRUE. It's extremely strange that
// the form_location setting is returning a boolean, but this appears to
// be a problem with the entity, not with the migration.
// $this->asserIdentical($form_location, $entity->getSetting('form_location'));
$this
->assertEqual($preview, $entity
->getSetting('preview'));
}