function DedupeEntityTest::testDedupeEntityInvalidLength

Tests that invalid length option throws an exception.

File

core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php, line 102

Class

DedupeEntityTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\DedupeEntity @group migrate @group legacy

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testDedupeEntityInvalidLength() {
    $configuration = [
        'entity_type' => 'test_entity_type',
        'field' => 'test_field',
        'length' => 'foobar',
    ];
    $plugin = new DedupeEntity($configuration, 'dedupe_entity', [], $this->getMigration(), $this->entityTypeManager);
    $this->expectException('Drupal\\migrate\\MigrateException');
    $this->expectExceptionMessage('The character length configuration key should be an integer. Omit this key to capture the entire string.');
    $plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.