File tree Expand file tree Collapse file tree 9 files changed +34
-39
lines changed
Expand file tree Collapse file tree 9 files changed +34
-39
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ indent_style = space
88insert_final_newline = true
99trim_trailing_whitespace = true
1010
11- [* .{md, rst} ]
11+ [* .{md,rst} ]
1212trim_trailing_whitespace = false
1313
1414[* .yml ]
Original file line number Diff line number Diff line change 4848 vendor/bin/phpstan analyse --xdebug -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.
@@ -377,7 +378,7 @@ protected function sendCookies() : void
377378 */
378379 protected function sendHeaders () : void
379380 {
380- if (\headers_sent ()) {
381+ if ($ this -> headersSent || \headers_sent ()) {
381382 throw new LogicException ('Headers are already sent ' );
382383 }
383384 if ($ this ->getHeader (Header::DATE ) === null ) {
@@ -393,6 +394,7 @@ protected function sendHeaders() : void
393394 foreach ($ this ->getHeaderLines () as $ line ) {
394395 \header ($ line );
395396 }
397+ $ this ->headersSent = true ;
396398 }
397399
398400 /**
Original file line number Diff line number Diff line change @@ -293,9 +293,16 @@ public function testHeader() : void
293293
294294 public function testHeadersAreAlreadySent () : void
295295 {
296+ $ response = new class (new RequestMock (['domain.tld ' ])) extends Response {
297+ public function sendHeaders () : void
298+ {
299+ parent ::sendHeaders ();
300+ }
301+ };
302+ $ response ->sendHeaders ();
296303 $ this ->expectException (\LogicException::class);
297304 $ this ->expectExceptionMessage ('Headers are already sent ' );
298- $ this -> response ->send ();
305+ $ response ->sendHeaders ();
299306 }
300307
301308 public function testInvalidStatusCode () : void
@@ -548,27 +555,10 @@ public function testContentTypeAutoSetIfBodyIsNotEmpty() : void
548555 }
549556
550557 /**
551- * @dataProvider
552- *
553- * @return array<array<string>>
554- */
555- public function serverSoftwareProvider () : array
556- {
557- return [
558- ['Apache/2.4.52 ' ],
559- ['lighttpd/1.4.63 ' ],
560- ['nginx/1.18.0 ' ],
561- ];
562- }
563-
564- /**
565- * @dataProvider serverSoftwareProvider
566- *
567558 * @runInSeparateProcess
568559 */
569- public function testContentTypeEmptyOnServer (string $ software ) : void
560+ public function testContentTypeEmptyOnServer () : void
570561 {
571- $ _SERVER ['SERVER_SOFTWARE ' ] = $ software ;
572562 $ this ->response ->setBody ('' );
573563 \ob_start ();
574564 $ this ->response ->send ();
You can’t perform that action at this time.
0 commit comments