You are here

public function RemoveIdFieldTest::testEntitySubqueueNotRemoveIdField in Acquia Content Hub 8.2

Tests entitysubqueue not remove id field.

@covers ::shouldExclude

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Kernel/EventSubscriber/ExcludeContentField/RemoveIdFieldTest.php, line 100

Class

RemoveIdFieldTest
Tests remove id field serialization.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\ExcludeContentField

Code

public function testEntitySubqueueNotRemoveIdField() {
  $entity_queue = EntityQueue::create([
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomString(),
    'handler' => 'simple',
    'entity_settings' => [
      'target_type' => 'node',
    ],
  ]);
  $entity_queue
    ->save();
  $entity_subqueue = EntitySubqueue::load($entity_queue
    ->id());
  $remove_id_and_revision_field = new RemoveIdField();
  foreach ($entity_subqueue as $field_name => $field) {
    $event = new ExcludeEntityFieldEvent($entity_subqueue, $field_name, $field);
    $this
      ->assertFalse($remove_id_and_revision_field
      ->shouldExclude($event));
  }
}