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/NodeListTest.php
<?php
namespace Gt\Dom\Test;

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

class NodeListTest extends TestCase {
	public function testNodeListFunctionsReturnGtObjects() {
		$objectsThatShouldBeNodeList = [];
		$document = new HTMLDocument(Helper::HTML_MORE);

		$objectsThatShouldBeNodeList["tag-name"] = $document->getElementsByTagName("p");

		foreach($objectsThatShouldBeNodeList as $key => $object) {
			$this->assertInstanceOf(
				NodeList::class,
				$object,
				"$key instance of " . gettype($object));
		}
	}

	public function testNodeListIndexOutOfBounds() {
		$document = new HTMLDocument(Helper::HTML_MORE);
		$paragraphList = $document->getElementsByTagName("p");
		$count = count($paragraphList);

		for($i = 0; $i < $count; $i++) {
			self::assertInstanceOf(
				Element::class,
				$paragraphList[$i]
			);
		}

		self::assertNull($paragraphList[$count]);
	}

	public function testCountDoesNotBreakIterator() {
		$document = new HTMLDocument(Helper::HTML_SECTIONS_WITHIN_FORM);
		$form = $document->getElementById("example-form");
		$sectionList = $form->querySelectorAll("section");
		$count = count($sectionList);
		$actualCount = 0;

		foreach($sectionList as $i => $section) {
			$actualCount ++;
			$section->setAttribute(
				"data-section-count",
				count($sectionList)
			);
		}

		self::assertGreaterThan(1, $actualCount);
		self::assertEquals($count, $actualCount);
	}
}

Spamworldpro Mini