public function findNextNodeByText(DiDomElement $element, $expression, $grep = false) { $childNodes = $element->getNode()->childNodes; $length = $childNodes->length; $stop = false; for ($i = 0; $i < $length; $i++) { $node = $childNodes->item($i); if ($stop && trim($node->textContent)) { $document = new DiDomDocument(); $document->appendChild($node); return $document; } else { if (!$grep && $expression == $node->textContent) { $stop = true; } else { if ($grep && preg_match($expression, $node->textContent)) { $stop = true; } } } } }
public function testSetMagicMethod() { $node = $this->createNode('input'); $element = new Element($node); $element->name = 'username'; $this->assertEquals('username', $element->getNode()->getAttribute('name')); }