File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 21
21
use PHPUnit \Framework \TestCase ;
22
22
use Templado \Engine \Example \ViewModel ;
23
23
use Throwable ;
24
+ use function libxml_use_internal_errors ;
24
25
25
26
#[CoversClass(Document::class)]
26
27
#[UsesClass(Id::class)]
@@ -50,6 +51,14 @@ public function testCanBeConstructedFromString(): void {
50
51
);
51
52
}
52
53
54
+ public function testUsageEnablesLibxmlInternalErrorHandler (): void {
55
+ libxml_use_internal_errors (false );
56
+
57
+ Document::fromString ('<?xml version="1.0" ?><root /> ' );
58
+
59
+ $ this ->assertTrue (libxml_use_internal_errors ());
60
+ }
61
+
53
62
public function testCanBeConstructFromDomDocument (): void {
54
63
$ dom = new DOMDocument ();
55
64
$ dom ->loadXML ('<?xml version="1.0" ?><root /> ' );
@@ -93,7 +102,6 @@ public function testExistingLibxmlErrorStateGetsClearedOnConstruct(): void {
93
102
libxml_use_internal_errors (true );
94
103
$ dummy = new DOMDocument ();
95
104
$ dummy ->loadXML ('parsing-this-will-cause-libxml-errors ' );
96
- libxml_use_internal_errors (false );
97
105
98
106
$ this ->assertInstanceOf (
99
107
Document::class,
You can’t perform that action at this time.
0 commit comments