You are here

public function DomHelperTraitTest::providerTestSetNodeContent in Embed 8

Return value

array

See also

::testSetNodeContent()

File

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

Class

DomHelperTraitTest
Tests \Drupal\embed\DomHelperTrait.

Namespace

Drupal\Tests\embed\Unit

Code

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