|
14 | 14 | use PHPUnit\Framework\Attributes\CoversClass; |
15 | 15 | use PHPUnit\Framework\Attributes\DataProvider; |
16 | 16 | use PHPUnit\Framework\Attributes\Group; |
17 | | -use PHPUnit\Framework\Attributes\PreserveGlobalState; |
18 | | -use PHPUnit\Framework\Attributes\RequiresPhpExtension; |
19 | | -use PHPUnit\Framework\Attributes\RunInSeparateProcess; |
20 | 17 | use stdClass; |
21 | 18 |
|
22 | 19 | use function _pgettext; |
23 | 20 | use function hash; |
24 | | -use function header; |
25 | 21 | use function putenv; |
26 | 22 | use function serialize; |
27 | 23 | use function str_repeat; |
@@ -660,50 +656,31 @@ public static function providerForTestPopulateRequestWithEncryptedQueryParamsWit |
660 | 656 | return [[[], []], [['eq' => []], []], [['eq' => ''], []], [['eq' => 'invalid'], []]]; |
661 | 657 | } |
662 | 658 |
|
663 | | - #[PreserveGlobalState(false)] |
664 | | - #[Group('ext-xdebug')] |
665 | | - #[RequiresPhpExtension('xdebug')] |
666 | | - #[RunInSeparateProcess] |
667 | | - public function testDownloadHeader(): void |
| 659 | + public function testGetDownloadHeaders(): void |
668 | 660 | { |
669 | | - header('Cache-Control: private, max-age=10800'); |
| 661 | + $headersList = Core::getDownloadHeaders('test.sql', 'text/x-sql', 100, false); |
670 | 662 |
|
671 | | - Core::downloadHeader('test.sql', 'text/x-sql', 100, false); |
672 | | - |
673 | | - // phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName |
674 | | - $headersList = \xdebug_get_headers(); |
675 | | - // phpcs:enable |
676 | | - |
677 | | - self::assertContains('Cache-Control: private, max-age=10800', $headersList); |
678 | | - self::assertContains('Content-Description: File Transfer', $headersList); |
679 | | - self::assertContains('Content-Disposition: attachment; filename="test.sql"', $headersList); |
680 | | - self::assertContains('Content-type: text/x-sql;charset=UTF-8', $headersList); |
681 | | - self::assertContains('Content-Transfer-Encoding: binary', $headersList); |
682 | | - self::assertContains('Content-Length: 100', $headersList); |
683 | | - self::assertNotContains('Content-Encoding: gzip', $headersList); |
| 663 | + $expected = [ |
| 664 | + 'Content-Description' => 'File Transfer', |
| 665 | + 'Content-Disposition' => 'attachment; filename="test.sql"', |
| 666 | + 'Content-Type' => 'text/x-sql', |
| 667 | + 'Content-Transfer-Encoding' => 'binary', |
| 668 | + 'Content-Length' => '100', |
| 669 | + ]; |
| 670 | + self::assertSame($expected, $headersList); |
684 | 671 | } |
685 | 672 |
|
686 | | - #[PreserveGlobalState(false)] |
687 | | - #[Group('ext-xdebug')] |
688 | | - #[RequiresPhpExtension('xdebug')] |
689 | | - #[RunInSeparateProcess] |
690 | | - public function testDownloadHeader2(): void |
| 673 | + public function testGetDownloadHeaders2(): void |
691 | 674 | { |
692 | | - header('Cache-Control: private, max-age=10800'); |
| 675 | + $headersList = Core::getDownloadHeaders('test.sql.gz', 'application/x-gzip', 0, false); |
693 | 676 |
|
694 | | - Core::downloadHeader('test.sql.gz', 'application/x-gzip', 0, false); |
695 | | - |
696 | | - // phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName |
697 | | - $headersList = \xdebug_get_headers(); |
698 | | - // phpcs:enable |
699 | | - |
700 | | - self::assertContains('Cache-Control: private, max-age=10800', $headersList); |
701 | | - self::assertContains('Content-Description: File Transfer', $headersList); |
702 | | - self::assertContains('Content-Disposition: attachment; filename="test.sql.gz"', $headersList); |
703 | | - self::assertContains('Content-Type: application/x-gzip', $headersList); |
704 | | - self::assertNotContains('Content-Encoding: gzip', $headersList); |
705 | | - self::assertContains('Content-Transfer-Encoding: binary', $headersList); |
706 | | - self::assertNotContains('Content-Length: 0', $headersList); |
| 677 | + $expected = [ |
| 678 | + 'Content-Description' => 'File Transfer', |
| 679 | + 'Content-Disposition' => 'attachment; filename="test.sql.gz"', |
| 680 | + 'Content-Type' => 'application/x-gzip', |
| 681 | + 'Content-Transfer-Encoding' => 'binary', |
| 682 | + ]; |
| 683 | + self::assertSame($expected, $headersList); |
707 | 684 | } |
708 | 685 |
|
709 | 686 | public function testGetEnv(): void |
|
0 commit comments