‪TYPO3CMS  10.4
ResponseFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseFactoryInterface;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪ResponseFactoryTest extends UnitTestCase
28 {
33  {
34  $factory = new ‪ResponseFactory();
35  self::assertInstanceOf(ResponseFactoryInterface::class, $factory);
36  }
37 
42  {
43  $factory = new ‪ResponseFactory();
44  $response = $factory->createResponse();
45  self::assertSame(200, $response->getStatusCode());
46  }
47 
52  {
53  $factory = new ‪ResponseFactory();
54  $response = $factory->createResponse(201);
55  self::assertSame(201, $response->getStatusCode());
56  }
57 
62  {
63  $factory = new ‪ResponseFactory();
64  $response = $factory->createResponse(301);
65  self::assertSame('Moved Permanently', $response->getReasonPhrase());
66  }
67 
72  {
73  $factory = new ‪ResponseFactory();
74  $response = $factory->createResponse(201, 'custom message');
75  self::assertSame('custom message', $response->getReasonPhrase());
76  }
77 }
‪TYPO3\CMS\Core\Tests\Unit\Http
Definition: ApplicationTypeTest.php:16
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest\testResponseHasStatusCode200ByDefault
‪testResponseHasStatusCode200ByDefault()
Definition: ResponseFactoryTest.php:41
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest\testResponseHasDefaultReasonPhrase
‪testResponseHasDefaultReasonPhrase()
Definition: ResponseFactoryTest.php:61
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest\testResponseHasStatusCodeSet
‪testResponseHasStatusCodeSet()
Definition: ResponseFactoryTest.php:51
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest\implementsPsr17FactoryInterface
‪implementsPsr17FactoryInterface()
Definition: ResponseFactoryTest.php:32
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest\testResponseHasCustomReasonPhrase
‪testResponseHasCustomReasonPhrase()
Definition: ResponseFactoryTest.php:71
‪TYPO3\CMS\Core\Http\ResponseFactory
Definition: ResponseFactory.php:27
‪TYPO3\CMS\Core\Tests\Unit\Http\ResponseFactoryTest
Definition: ResponseFactoryTest.php:28