Skip to content

Commit

Permalink
fix Content-Range unit test in windows error
Browse files Browse the repository at this point in the history
  • Loading branch information
songlipeng2003 committed Dec 2, 2022
1 parent d5f5fbd commit 330b094
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/XSendfile/XSendfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ public function testFile()

$this->assertNotEmpty($headers_list);
$this->assertContains("Content-type: text/plain;charset=UTF-8", $headers_list);
$this->assertEquals("hello\n", $output);
if (PHP_OS_FAMILY === "Windows") {
$this->assertEquals("hello\r\n", $output);
} else {
$this->assertEquals("hello\n", $output);
}
}

/**
Expand All @@ -224,7 +228,12 @@ public function testHttpRange()

$this->assertNotEmpty($headers_list);
$this->assertContains("Content-Length: 2", $headers_list);
$this->assertContains("Content-Range: bytes 1-2/6", $headers_list);
if (PHP_OS_FAMILY === "Windows") {
$this->assertContains("Content-Range: bytes 1-2/7", $headers_list);
} else {
$this->assertContains("Content-Range: bytes 1-2/6", $headers_list);
}

$this->assertEquals('el', $output);
}
}

0 comments on commit 330b094

Please sign in to comment.