Skip to content

Commit 67ad74e

Browse files
committed
Update ParserStateTest.php
1 parent 49cf6e7 commit 67ad74e

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/Unit/Parsing/ParserStateTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,28 @@ public function consumeWhiteSpaceStopsAtNonWhitespace(string $nonWhitespace, str
303303

304304
self::assertTrue($subject->comes($nonWhitespace));
305305
}
306+
307+
/**
308+
* @test
309+
*/
310+
public function constructorThrowsForTextThatIsNotValidUtf8(): void
311+
{
312+
$this->expectException(\RuntimeException::class);
313+
$this->expectExceptionMessage('Unexpected error');
314+
315+
new ParserState("\xFF body{}", Settings::create());
316+
}
317+
318+
/**
319+
* @test
320+
*/
321+
public function consumeWhiteSpaceThrowsForTextThatIsNotValidUtf8WithoutMultibyteSupport(): void
322+
{
323+
$subject = new ParserState("\xFF body{}", Settings::create()->withMultibyteSupport(false));
324+
325+
$this->expectException(\RuntimeException::class);
326+
$this->expectExceptionMessage('Unexpected error');
327+
328+
$subject->consumeWhiteSpace();
329+
}
306330
}

0 commit comments

Comments
 (0)