function ExplodeTest::testExplodeWithNonStrictAndNonCastable

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

Tests that explode raises an exception when the value cannot be casted to string.

File

core/modules/migrate/tests/src/Unit/process/ExplodeTest.php, line 95

Class

ExplodeTest
Tests the Explode process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testExplodeWithNonStrictAndNonCastable() {
    $plugin = new Explode([
        'delimiter' => '|',
        'strict' => FALSE,
    ], 'map', []);
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('cannot be casted to a string');
    $processed = $plugin->transform([
        'foo',
    ], $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame([
        'foo',
    ], $processed);
}

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