You are here

public function StrReplaceTest::testReplaceMigrateException in Migrate Plus 8.5

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/process/StrReplaceTest.php \Drupal\Tests\migrate_plus\Unit\process\StrReplaceTest::testReplaceMigrateException()

Test for MigrateException for "replace" configuration.

File

tests/src/Unit/process/StrReplaceTest.php, line 72

Class

StrReplaceTest
Tests the str replace process plugin.

Namespace

Drupal\Tests\migrate_plus\Unit\process

Code

public function testReplaceMigrateException() : void {
  $value = 'vero eos et accusam et justo vero';
  $configuration['search'] = 'et';
  $plugin = new StrReplace($configuration, 'str_replace', []);
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('"replace" must be configured.');
  $plugin
    ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
}