public function RemoveParagraphParentIdTest::testRemoveParagraphParentId in Acquia Content Hub 8.2
Tests the removal of paragraph parent_id field.
@covers ::excludeContentField
Throws
\Drupal\Core\Entity\EntityStorageException
File
- tests/
src/ Kernel/ EventSubscriber/ ExcludeContentField/ RemoveParagraphParentIdTest.php, line 46
Class
- RemoveParagraphParentIdTest
- Tests remove paragraph parent_id field serialization.
Namespace
Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\ExcludeContentFieldCode
public function testRemoveParagraphParentId() {
$paragraph = Paragraph::create([
'title' => 'Paragraph',
'type' => 'text_paragraph',
'text' => 'Text Paragraph',
]);
$remove_id_and_revision_field = new RemoveParagraphParentId();
foreach ($paragraph as $field_name => $field) {
$event = new ExcludeEntityFieldEvent($paragraph, $field_name, $field);
$remove_id_and_revision_field
->excludeContentField($event);
if ($field_name === 'parent_id') {
$this
->assertTrue($event
->isExcluded());
$this
->assertTrue($event
->isPropagationStopped());
}
else {
$this
->assertFalse($event
->isExcluded());
$this
->assertFalse($event
->isPropagationStopped());
}
}
}