You are here

public function SubstrTest::testSubstr in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::testSubstr()
  2. 10 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 29

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);
}