You are here

public function SubstrTest::testStartIsString in Drupal 10

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

Tests that the start parameter is an integer.

File

core/modules/migrate/tests/src/Unit/process/SubstrTest.php, line 73

Class

SubstrTest
Tests the substr plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testStartIsString() {
  $configuration['start'] = '2';
  $this->plugin = new Substr($configuration, 'map', []);
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
  $this->plugin
    ->transform([
    'foo',
  ], $this->migrateExecutable, $this->row, 'destination_property');
}