function ExplodeTest::testExplodeWithNonStrictAndNonCastable
Tests Explode exception handling when string-cast fails.
File
- 
              core/
modules/ migrate/ tests/ src/ Unit/ process/ ExplodeTest.php, line 96  
Class
- ExplodeTest
 - Tests the Explode process plugin.
 
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testExplodeWithNonStrictAndNonCastable() : void {
  $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.