You are here

public function SubstrTest::testSubstr 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::testSubstr()
  2. 9 core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::testSubstr()

Tests Substr plugin based on providerTestSubstr() values.

@dataProvider providerTestSubstr

File

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

Class

SubstrTest
Tests the substr plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testSubstr($start = NULL, $length = NULL, $expected = NULL) {
  $configuration['start'] = $start;
  $configuration['length'] = $length;
  $this->plugin = new Substr($configuration, 'map', []);
  $value = $this->plugin
    ->transform('Captain Janeway', $this->migrateExecutable, $this->row, 'destination_property');
  $this
    ->assertSame($expected, $value);
}