You are here

public function ExplodeTest::testExplodeWithNonStrictAndNonCastable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/ExplodeTest.php \Drupal\Tests\migrate\Unit\process\ExplodeTest::testExplodeWithNonStrictAndNonCastable()
  2. 9 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);
}