You are here

public function DomHelperTraitTest::providerTestReplaceNodeContent in Embed 8

Return value

array

See also

::testReplaceNodeContent()

File

tests/src/Unit/DomHelperTraitTest.php, line 102

Class

DomHelperTraitTest
Tests \Drupal\embed\DomHelperTrait.

Namespace

Drupal\Tests\embed\Unit

Code

public function providerTestReplaceNodeContent() {
  return [
    'empty' => [
      '',
      '<outer></outer>',
    ],
    'single node without children' => [
      '<div></div>',
      '<outer><div></div></outer>',
    ],
    'single node with children' => [
      '<div><replacement replaced="true" /></div>',
      '<outer><div><replacement replaced="true"></replacement></div></outer>',
    ],
    'multiple nodes' => [
      '<p>first</p><p>second</p>',
      '<outer><p>first</p><p>second</p></outer>',
    ],
    'multiple nodes, with a text node, comment node and element node' => [
      'Second <!-- comment --> <p>third</p>',
      '<outer>Second <!-- comment --> <p>third</p></outer>',
    ],
  ];
}