You are here

public function DomStrReplaceTest::testTransformInvalidInput in Migrate Plus 8.5

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

@covers ::transform

File

tests/src/Unit/process/DomStrReplaceTest.php, line 85

Class

DomStrReplaceTest
Tests the dom_str_replace process plugin.

Namespace

Drupal\Tests\migrate_plus\Unit\process

Code

public function testTransformInvalidInput() : void {
  $configuration = [
    'xpath' => '//a',
    'mode' => 'attribute',
    'attribute_options' => [
      'name' => 'href',
    ],
    'search' => 'foo',
    'replace' => 'bar',
  ];
  $value = 'string';
  $this
    ->expectException(MigrateSkipRowException::class);
  $this
    ->expectExceptionMessage('The dom_str_replace plugin in the destinationproperty process pipeline requires a \\DOMDocument object. You can use the dom plugin to convert a string to \\DOMDocument.');
  (new DomStrReplace($configuration, 'dom_str_replace', []))
    ->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
}