public function DedupeEntityTest::testDedupe in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php \Drupal\Tests\migrate\Unit\process\DedupeEntityTest::testDedupe()
Tests entity based deduplication based on providerTestDedupe() values.
@dataProvider providerTestDedupe
File
- core/
modules/ migrate/ tests/ src/ Unit/ process/ DedupeEntityTest.php, line 63 - Contains \Drupal\Tests\migrate\Unit\process\DedupeEntityTest.
Class
- DedupeEntityTest
- @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\DedupeEntity @group migrate
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testDedupe($count, $postfix = '', $start = NULL, $length = NULL) {
$configuration = array(
'entity_type' => 'test_entity_type',
'field' => 'test_field',
);
if ($postfix) {
$configuration['postfix'] = $postfix;
}
$configuration['start'] = isset($start) ? $start : NULL;
$configuration['length'] = isset($length) ? $length : NULL;
$plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this
->getMigration(), $this->entityQueryFactory);
$this
->entityQueryExpects($count);
$value = $this
->randomMachineName(32);
$actual = $plugin
->transform($value, $this->migrateExecutable, $this->row, 'testproperty');
$expected = Unicode::substr($value, $start, $length);
$expected .= $count ? $postfix . $count : '';
$this
->assertSame($expected, $actual);
}