‪TYPO3CMS  10.4
RedirectResponseTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪RedirectResponseTest extends UnitTestCase
25 {
30  {
31  $subject = new ‪RedirectResponse('theRedirectUrl');
32  $expected = [
33  'location' => [
34  0 => 'theRedirectUrl',
35  ]
36  ];
37  self::assertSame($expected, $subject->getHeaders());
38  }
39 
44  {
45  $subject = new ‪RedirectResponse('theRedirectUrl');
46  $expected = [
47  0 => 'theRedirectUrl',
48  ];
49  self::assertSame($expected, $subject->getHeader('location'));
50  }
51 
56  {
57  $input = [
58  'camelCasedHeaderName' => 'aHeaderValue',
59  'lowercasedheadername' => 'anotherHeaderValue',
60  ];
61  $expected = [
62  'camelCasedHeaderName' => [
63  0 => 'aHeaderValue',
64  ],
65  'lowercasedheadername' => [
66  0 => 'anotherHeaderValue',
67  ],
68  'location' => [
69  0 => 'url'
70  ],
71  ];
72  $subject = new ‪RedirectResponse('url', 302, $input);
73  self::assertSame($expected, $subject->getHeaders());
74  }
75 
80  {
81  $input = [
82  'lowercasedheadername' => 'anotherHeaderValue',
83  ];
84  $expected = [
85  0 => 'anotherHeaderValue',
86  ];
87  $subject = new ‪RedirectResponse('url', 302, $input);
88  self::assertSame($expected, $subject->getHeader('lowercasedheadername'));
89  }
90 
95  {
96  $input = [
97  'camelCasedHeaderName' => 'aHeaderValue',
98  ];
99  $expected = [
100  0 => 'aHeaderValue',
101  ];
102  $subject = new ‪RedirectResponse('url', 302, $input);
103  self::assertSame($expected, $subject->getHeader('camelCasedHeaderName'));
104  }
105 }
‪TYPO3\CMS\Core\Tests\Unit\Http
Definition: ApplicationTypeTest.php:16
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest\getHeadersReturnsLocationUrlSetByConstructorArgument
‪getHeadersReturnsLocationUrlSetByConstructorArgument()
Definition: RedirectResponseTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest\getHeaderReturnsLocationUrlSetByConstructorArgument
‪getHeaderReturnsLocationUrlSetByConstructorArgument()
Definition: RedirectResponseTest.php:43
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest\getHeaderReturnsHeaderSetByConstructorArgument
‪getHeaderReturnsHeaderSetByConstructorArgument()
Definition: RedirectResponseTest.php:79
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest\getHeaderReturnsHeaderSetByConstructorArgumentLowerCased
‪getHeaderReturnsHeaderSetByConstructorArgumentLowerCased()
Definition: RedirectResponseTest.php:94
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest\getHeadersReturnsHeaderSetByConstructorArgument
‪getHeadersReturnsHeaderSetByConstructorArgument()
Definition: RedirectResponseTest.php:55
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:28
‪TYPO3\CMS\Core\Tests\Unit\Http\RedirectResponseTest
Definition: RedirectResponseTest.php:25