Skip to content

Commit 8b5a0fb

Browse files
committed
Add HTMLQuerySelectorAll & HTMLQuerySelector scalar functions
1 parent 2007f0d commit 8b5a0fb

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/core/etl/tests/Flow/ETL/Tests/Unit/Function/HTMLQuerySelectorAllTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ public function test_getting_null_for_older_versions() : void
4242
#[RequiresPhp('>= 8.4')]
4343
public function test_getting_null_when_nothing_found() : void
4444
{
45-
$html = new HTMLDocument('<!DOCTYPE html><html><head></head><body><div><span>foobar</span></div></body></html>');
46-
4745
$result = ref('value')->htmlQuerySelectorAll('body div p')->eval(row(flow_context(config())->entryFactory()->create('value', $this->html)));
4846

4947
self::assertNull($result);
5048
}
49+
50+
public function test_invalid_value() : void
51+
{
52+
$result = ref('value')->htmlQuerySelectorAll('body div span')->eval(row(flow_context(config())->entryFactory()->create('value', '')));
53+
54+
self::assertNull($result);
55+
}
5156
}

src/core/etl/tests/Flow/ETL/Tests/Unit/Function/HTMLQuerySelectorTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,11 @@ public function test_getting_null_when_nothing_found() : void
4545

4646
self::assertNull($result);
4747
}
48+
49+
public function test_invalid_value() : void
50+
{
51+
$result = ref('value')->htmlQuerySelector('body div span')->eval(row(flow_context(config())->entryFactory()->create('value', '')));
52+
53+
self::assertNull($result);
54+
}
4855
}

0 commit comments

Comments
 (0)