Skip to content

Commit

Permalink
tweak: check for v8
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Nov 13, 2021
1 parent 9ebae20 commit 653db0c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/phpunit/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ class DocumentTest extends TestCase {

public function testToStringEmpty() {
$sut = new Document();
self::assertEquals("", (string)$sut);
$string = (string)$sut;
if(PHP_MAJOR_VERSION >= 8) {
// To catch v8-specific EOL.
$string .= PHP_EOL;
}
self::assertEquals("", $string);
}

public function testToString() {
Expand Down Expand Up @@ -41,7 +46,8 @@ public function testDetach() {

public function testGetSizeEmpty() {
$sut = new Document();
self::assertEquals(0, $sut->getSize());
// Single EOL character in v8 onwards.
self::assertEquals(PHP_MAJOR_VERSION >= 8 ? 1 : 0, $sut->getSize());
}

public function testGetSize() {
Expand Down

0 comments on commit 653db0c

Please sign in to comment.