public function TestImporter::testDuplicateExisting in Feeds Paragraphs 8
@covers ::duplicateExisting
File
- tests/
src/ Unit/ TestImporter.php, line 350
Class
- TestImporter
- @group Feeds Paragraphs @coversDefaultClass \Drupal\feeds_para_mapper\Importer
Namespace
Drupal\Tests\feeds_para_mapper\UnitCode
public function testDuplicateExisting() {
$this->entityHelper->values = array();
$method = $this
->getMethod(Importer::class, 'duplicateExisting');
$paragraph = $this->entityHelper->paragraphs[2];
$paragraph
->isNew()
->willReturn(false);
$parObject = $paragraph
->reveal();
$result = $method
->invokeArgs($this->importer, array(
$parObject,
));
$paragraph
->isNew()
->shouldHaveBeenCalled();
$paragraph
->getParentEntity()
->shouldHaveBeenCalled();
$paragraph
->getType()
->shouldHaveBeenCalled();
$paragraph
->getParentEntity()
->shouldHaveBeenCalled();
$paragraph
->get('parent_field_name')
->shouldHaveBeenCalled();
self::assertInstanceOf(Paragraph::class, $result);
}