function MigrateCommentFieldInstanceTest::assertEntity

Same name in this branch
  1. 11.x core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentFieldInstanceTest::assertEntity()
  2. 9 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
  3. 8.9.x core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentFieldInstanceTest::assertEntity()
  4. 8.9.x core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
  5. 10 core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentFieldInstanceTest::assertEntity()
  6. 10 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()

Asserts a comment field instance entity.

@internal

Parameters

string $bundle: The bundle ID.

string $field_name: The field name.

int $default_value: The field's default_value setting.

int $default_mode: The field's default_mode setting.

int $per_page: The field's per_page setting.

int $anonymous: The field's anonymous setting.

bool $form_location: The field's form_location setting.

int $preview: The field's preview setting.

1 call to MigrateCommentFieldInstanceTest::assertEntity()
MigrateCommentFieldInstanceTest::testMigration in core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php
Tests the migrated field instance values.

File

core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php, line 59

Class

MigrateCommentFieldInstanceTest
Tests the migration of comment field instances from Drupal 6.

Namespace

Drupal\Tests\comment\Kernel\Migrate\d6

Code

protected function assertEntity(string $bundle, string $field_name, int $default_value, int $default_mode, int $per_page, int $anonymous, bool $form_location, int $preview) : void {
    $entity = FieldConfig::load("node.{$bundle}.{$field_name}");
    $this->assertInstanceOf(FieldConfig::class, $entity);
    $this->assertSame('node', $entity->getTargetEntityTypeId());
    $this->assertSame('Comments', $entity->label());
    $this->assertTrue($entity->isRequired());
    $this->assertSame($bundle, $entity->getTargetBundle());
    $this->assertSame($field_name, $entity->getFieldStorageDefinition()
        ->getName());
    $this->assertSame($default_value, $entity->get('default_value')[0]['status']);
    $this->assertSame($default_mode, $entity->getSetting('default_mode'));
    $this->assertSame($per_page, $entity->getSetting('per_page'));
    $this->assertSame($anonymous, $entity->getSetting('anonymous'));
    $this->assertSame($form_location, $entity->getSetting('form_location'));
    $this->assertSame($preview, $entity->getSetting('preview'));
}

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