From 330b0942e5b3b1770449aa07d64d8b017e4f0b15 Mon Sep 17 00:00:00 2001 From: Thinking Song <123wuming_123@163.com> Date: Fri, 2 Dec 2022 15:15:08 +0800 Subject: [PATCH] fix Content-Range unit test in windows error --- test/XSendfile/XSendfileTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/XSendfile/XSendfileTest.php b/test/XSendfile/XSendfileTest.php index dea49e1..07540da 100644 --- a/test/XSendfile/XSendfileTest.php +++ b/test/XSendfile/XSendfileTest.php @@ -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); + } } /** @@ -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); } }