You are here

public function DomStrReplaceTest::testTransformInvalidInput in Migrate Plus 8.4

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

@covers ::transform

File

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

Class

DomStrReplaceTest
Tests the dom_str_replace process plugin.

Namespace

Drupal\Tests\migrate_plus\Unit\process

Code

public function testTransformInvalidInput() {
  $configuration = [
    'expression' => '//a',
    'mode' => 'attribute',
    'attribute_options' => [
      'name' => 'href',
    ],
    'search' => 'foo',
    'replace' => 'bar',
  ];
  $value = 'string';
  $this
    ->setExpectedException(MigrateSkipRowException::class, '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');
}