protected function ContentEntityTest::assertIds in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityTest::assertIds()
Helper to assert IDs structure.
Parameters
\Drupal\migrate\Plugin\MigrateSourceInterface $source: The source plugin.
array $configuration: The source plugin configuration (Nope, no getter available).
5 calls to ContentEntityTest::assertIds()
- ContentEntityTest::testFileSource in core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php 
- Tests file source plugin.
- ContentEntityTest::testMediaSource in core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php 
- Tests media source plugin.
- ContentEntityTest::testNodeSource in core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php 
- Tests node source plugin.
- ContentEntityTest::testTermSource in core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php 
- Tests term source plugin.
- ContentEntityTest::testUserSource in core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php 
- Tests user source plugin.
File
- core/modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ migrate/ source/ ContentEntityTest.php, line 244 
Class
- ContentEntityTest
- Tests the entity content source plugin.
Namespace
Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\sourceCode
protected function assertIds(MigrateSourceInterface $source, array $configuration) {
  $ids = $source
    ->getIds();
  list(, $entity_type_id) = explode(PluginBase::DERIVATIVE_SEPARATOR, $source
    ->getPluginId());
  $entity_type = \Drupal::entityTypeManager()
    ->getDefinition($entity_type_id);
  $this
    ->assertArrayHasKey($entity_type
    ->getKey('id'), $ids);
  $ids_count_expected = 1;
  if ($entity_type
    ->isTranslatable()) {
    $ids_count_expected++;
    $this
      ->assertArrayHasKey($entity_type
      ->getKey('langcode'), $ids);
  }
  if ($entity_type
    ->isRevisionable() && $configuration['add_revision_id']) {
    $ids_count_expected++;
    $this
      ->assertArrayHasKey($entity_type
      ->getKey('revision'), $ids);
  }
  $this
    ->assertCount($ids_count_expected, $ids);
}