function SubstrTest::testSubstrFail

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::testSubstrFail()
  2. 10 core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::testSubstrFail()
  3. 11.x core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::testSubstrFail()

Tests invalid input type.

File

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

Class

SubstrTest
Tests the substr plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testSubstrFail() {
    $configuration = [];
    $this->plugin = new Substr($configuration, 'map', []);
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('The input value must be a string.');
    $this->plugin
        ->transform([
        'Captain Janeway',
    ], $this->migrateExecutable, $this->row, 'destination_property');
}

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