function SubstrTest::testSubstr

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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);
}

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