public function TestImporter::testUpdateParagraphs in Feeds Paragraphs 8
@covers ::updateParagraphs
File
- tests/
src/ Unit/ TestImporter.php, line 270
Class
- TestImporter
- @group Feeds Paragraphs @coversDefaultClass \Drupal\feeds_para_mapper\Importer
Namespace
Drupal\Tests\feeds_para_mapper\UnitCode
public function testUpdateParagraphs() {
$this->entityHelper->values = array();
$method = $this
->getMethod(Importer::class, 'updateParagraphs');
$values = array(
array(
array(
'value' => 'a',
),
),
array(
array(
'value' => 'b',
),
),
array(
array(
'value' => 'c',
),
),
);
$paragraphs = $this->entityHelper->paragraphs;
$lastPar = end($paragraphs);
$args = array(
array(
$lastPar
->reveal(),
),
$values,
);
$result = $method
->invokeArgs($this->importer, $args);
self::assertCount(1, $result);
for ($i = 0; $i < count($result); $i++) {
self::assertArrayEquals($values[$i], $result[$i]['value']);
self::assertInstanceOf(Paragraph::class, $result[$i]['paragraph']);
self::assertArrayHasKey('state', $result[$i]);
}
}