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