You are here

public function MakeUniqueEntityFieldTest::testMakeUniqueEntityFieldEntityInvalidLength in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php \Drupal\Tests\migrate\Unit\process\MakeUniqueEntityFieldTest::testMakeUniqueEntityFieldEntityInvalidLength()
  2. 10 core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php \Drupal\Tests\migrate\Unit\process\MakeUniqueEntityFieldTest::testMakeUniqueEntityFieldEntityInvalidLength()

Tests that invalid length option throws an exception.

File

core/modules/migrate/tests/src/Unit/process/MakeUniqueEntityFieldTest.php, line 104

Class

MakeUniqueEntityFieldTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MakeUniqueEntityField @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMakeUniqueEntityFieldEntityInvalidLength() {
  $configuration = [
    'entity_type' => 'test_entity_type',
    'field' => 'test_field',
    'length' => 'foobar',
  ];
  $plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $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');
}