[TASK] Re-work/simplify copyright header in PHP files - Part 8
[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\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Extbase\Mvc\Response|\PHPUnit_Framework_MockObject_MockObject|\Tx_Phpunit_Interface_AccessibleObject
24 */
25 protected $mockResponse;
26
27 public function setUp() {
28 $this->mockResponse = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Response', array('dummy'));
29 }
30
31 /**
32 * @test
33 */
34 public function propertyContentInitiallyIsNull() {
35 $this->assertNull($this->mockResponse->_get('content'));
36 }
37
38 /**
39 * @test
40 */
41 public function setContentSetsContentCorrectly() {
42 $this->mockResponse->setContent('foo');
43 $this->assertSame('foo', $this->mockResponse->_get('content'));
44 }
45
46 /**
47 * @test
48 */
49 public function appendContentAppendsContentCorrectly() {
50 $this->mockResponse->_set('content', 'foo');
51 $this->mockResponse->appendContent('bar');
52 $this->assertSame('foobar', $this->mockResponse->_get('content'));
53 }
54
55 /**
56 * @test
57 */
58 public function getContentReturnsContentCorrectly() {
59 $this->mockResponse->_set('content', 'foo');
60 $this->assertSame('foo', $this->mockResponse->getContent());
61 }
62
63 /**
64 * @test
65 */
66 public function __toStringReturnsActualContent() {
67 $this->mockResponse->_set('content', 'foo');
68 $this->assertSame('foo', (string) $this->mockResponse);
69 }
70 }