File tree Expand file tree Collapse file tree 8 files changed +33
-38
lines changed
Expand file tree Collapse file tree 8 files changed +33
-38
lines changed Original file line number Diff line number Diff line change 4848 vendor/bin/phpstan analyse -vvv
4949
5050 - name : PHPUnit
51- run : vendor/bin/phpunit --verbose
51+ run : vendor/bin/phpunit
5252
5353 - name : Upload coverage results to Coveralls
5454 env :
6666 strategy :
6767 fail-fast : true
6868
69- name : PHP 8.2 - Last
69+ name : PHP Latest
7070
7171 steps :
7272 - name : Checkout
7575 - name : Setup PHP
7676 uses : shivammathur/setup-php@v2
7777 with :
78- php-version : 8.2
78+ php-version : latest
7979 tools : composer
8080 coverage : xdebug
8181
8484 composer update
8585
8686 - name : PHPUnit
87- run : vendor/bin/phpunit --verbose
87+ run : vendor/bin/phpunit
Original file line number Diff line number Diff line change 44raw-tests /
55vendor /
66.php-cs-fixer.cache
7+ .phpunit.cache
78.phpunit.result.cache
89composer.lock
910composer.phar
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ test:php:
3030 - build/docs/
3131 coverage : ' /^\s*Lines:\s*\d+.\d+\%/'
3232
33- test:php-last :
34- image : registry.gitlab.com/aplus-framework/images/base:3
33+ test:php-latest :
34+ image : registry.gitlab.com/aplus-framework/images/base:latest
3535 stage : test
3636 timeout : 10 minutes
3737 cache :
Original file line number Diff line number Diff line change 5151 "jetbrains/phpstorm-attributes" : " ^1.0" ,
5252 "phpmd/phpmd" : " ^2.13" ,
5353 "phpstan/phpstan" : " ^1.9" ,
54- "phpunit/phpunit" : " ^9 .5"
54+ "phpunit/phpunit" : " ^10 .5"
5555 },
5656 "minimum-stability" : " dev" ,
5757 "prefer-stable" : true ,
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ services:
77 volumes :
88 - .:/package
99 tty : true
10- package-last :
11- image : registry.gitlab.com/aplus-framework/images/package:3
12- container_name : package-http-last
10+ package-latest :
11+ image : registry.gitlab.com/aplus-framework/images/package:latest
12+ container_name : package-http-latest
1313 working_dir : /package
1414 volumes :
1515 - .:/package
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" backupGlobals =" false"
3- bootstrap =" vendor/autoload.php" colors =" true" convertErrorsToExceptions =" true"
4- convertNoticesToExceptions =" true" convertWarningsToExceptions =" true" stopOnError =" false"
5- stopOnFailure =" false" stopOnIncomplete =" false" stopOnSkipped =" false"
6- xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.3/phpunit.xsd" >
7- <coverage processUncoveredFiles =" true" >
8- <include >
9- <directory suffix =" .php" >src</directory >
10- </include >
3+ bootstrap =" vendor/autoload.php" colors =" true" stopOnError =" false" stopOnFailure =" false"
4+ stopOnIncomplete =" false" stopOnSkipped =" false"
5+ xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/10.5/phpunit.xsd"
6+ cacheDirectory =" .phpunit.cache" >
7+ <coverage >
118 <report >
129 <clover outputFile =" build/coverage/clover.xml" />
1310 <html outputDirectory =" build/coverage" />
2219 <const name =" TESTING" value =" true" />
2320 <env name =" XDEBUG_MODE" value =" coverage" />
2421 </php >
22+ <source >
23+ <include >
24+ <directory suffix =" .php" >src</directory >
25+ </include >
26+ </source >
2527</phpunit >
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class Response extends Message implements ResponseInterface
3131
3232 protected int $ cacheSeconds = 0 ;
3333 protected bool $ isSent = false ;
34+ protected bool $ headersSent = false ;
3435 protected Request $ request ;
3536 /**
3637 * HTTP Response Status Code.
@@ -467,7 +468,7 @@ protected function sendCookies() : void
467468 */
468469 protected function sendHeaders () : void
469470 {
470- if (\headers_sent ()) {
471+ if ($ this -> headersSent || \headers_sent ()) {
471472 throw new LogicException ('Headers are already sent ' );
472473 }
473474 if ($ this ->getHeader (Header::DATE ) === null ) {
@@ -484,6 +485,7 @@ protected function sendHeaders() : void
484485 foreach ($ this ->getHeaderLines () as $ line ) {
485486 \header ($ line );
486487 }
488+ $ this ->headersSent = true ;
487489 }
488490
489491 /**
Original file line number Diff line number Diff line change @@ -294,9 +294,16 @@ public function testHeader() : void
294294
295295 public function testHeadersAreAlreadySent () : void
296296 {
297+ $ response = new class (new RequestMock (['domain.tld ' ])) extends Response {
298+ public function sendHeaders () : void
299+ {
300+ parent ::sendHeaders ();
301+ }
302+ };
303+ $ response ->sendHeaders ();
297304 $ this ->expectException (\LogicException::class);
298305 $ this ->expectExceptionMessage ('Headers are already sent ' );
299- $ this -> response ->send ();
306+ $ response ->sendHeaders ();
300307 }
301308
302309 public function testInvalidStatusCode () : void
@@ -616,27 +623,10 @@ public function testContentTypeAutoSetIfBodyIsNotEmpty() : void
616623 }
617624
618625 /**
619- * @dataProvider
620- *
621- * @return array<array<string>>
622- */
623- public function serverSoftwareProvider () : array
624- {
625- return [
626- ['Apache/2.4.52 ' ],
627- ['lighttpd/1.4.63 ' ],
628- ['nginx/1.18.0 ' ],
629- ];
630- }
631-
632- /**
633- * @dataProvider serverSoftwareProvider
634- *
635626 * @runInSeparateProcess
636627 */
637- public function testContentTypeEmptyOnServer (string $ software ) : void
628+ public function testContentTypeEmptyOnServer () : void
638629 {
639- $ _SERVER ['SERVER_SOFTWARE ' ] = $ software ;
640630 $ this ->response ->setBody ('' );
641631 \ob_start ();
642632 $ this ->response ->send ();
You can’t perform that action at this time.
0 commit comments