[BUGFIX] Add missing namespace parts
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Mvc / ResponseTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc;
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
17 /**
18 * Test case
19 */
20 class ResponseTest extends \TYPO3\Components\TestingFramework\Core\Unit\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Extbase\Mvc\Response|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\Components\TestingFramework\Core\AccessibleObjectInterface
24 */
25 protected $mockResponse;
26
27 protected function setUp()
28 {
29 $this->mockResponse = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Response::class, ['dummy']);
30 }
31
32 /**
33 * @test
34 */
35 public function propertyContentInitiallyIsNull()
36 {
37 $this->assertNull($this->mockResponse->_get('content'));
38 }
39
40 /**
41 * @test
42 */
43 public function setContentSetsContentCorrectly()
44 {
45 $this->mockResponse->setContent('foo');
46 $this->assertSame('foo', $this->mockResponse->_get('content'));
47 }
48
49 /**
50 * @test
51 */
52 public function appendContentAppendsContentCorrectly()
53 {
54 $this->mockResponse->_set('content', 'foo');
55 $this->mockResponse->appendContent('bar');
56 $this->assertSame('foobar', $this->mockResponse->_get('content'));
57 }
58
59 /**
60 * @test
61 */
62 public function getContentReturnsContentCorrectly()
63 {
64 $this->mockResponse->_set('content', 'foo');
65 $this->assertSame('foo', $this->mockResponse->getContent());
66 }
67
68 /**
69 * @test
70 */
71 public function __toStringReturnsActualContent()
72 {
73 $this->mockResponse->_set('content', 'foo');
74 $this->assertSame('foo', (string)$this->mockResponse);
75 }
76 }