Skip to content

Commit

Permalink
Unit test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bkdotcom committed Sep 18, 2023
1 parent c788ed5 commit fde934f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/CssXpath/CssSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,17 @@ public function testSelectStatic($selector, $count, $inner = null)

$found = CssSelect::select($html, $selector, true);
self::assertSame($count, \is_array($found) ? \count($found) : $found->length);
self::assertContainsOnlyInstancesOf('DOMElement', $found);
if ($selector === 'bo $ us') {
self::assertTrue(\is_array($found));
} else {
self::assertInstanceOf('DOMNodeList', $found);
}

if ($inner !== null) {
$innerHTML = '';
foreach ($found[0]->childNodes as $child) {
$innerHTML .= $found[0]->ownerDocument->saveHTML($child);
$item = $found->item(0);
foreach ($item->childNodes as $child) {
$innerHTML .= $item->ownerDocument->saveHTML($child);
}
self::assertSame($inner, $innerHTML);
}
Expand Down Expand Up @@ -154,7 +159,11 @@ public function testSelectInstance($selector, $count, $inner = null)

$found = $cssSelect->select($selector, true);
self::assertSame($count, \is_array($found) ? \count($found) : $found->length);
self::assertContainsOnlyInstancesOf('DOMElement', $found);
if ($selector === 'bo $ us') {
self::assertTrue(\is_array($found));
} else {
self::assertInstanceOf('DOMNodeList', $found);
}
}

public function testSelectFromEmpty()
Expand Down

0 comments on commit fde934f

Please sign in to comment.