TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
CaseContentObjectTest.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
4
namespace
TYPO3\CMS\Frontend\Tests\Unit\ContentObject
;
5
6
/*
7
* This file is part of the TYPO3 CMS project.
8
*
9
* It is free software; you can redistribute it and/or modify it under
10
* the terms of the GNU General Public License, either version 2
11
* of the License, or any later version.
12
*
13
* For the full copyright and license information, please read the
14
* LICENSE.txt file that was distributed with this source code.
15
*
16
* The TYPO3 project - inspiring people to share!
17
*/
18
19
use
TYPO3\CMS\Frontend\ContentObject\CaseContentObject
;
20
use
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
;
21
use
TYPO3\CMS\Frontend\ContentObject\TextContentObject
;
22
use
TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
;
23
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24
28
class
CaseContentObjectTest
extends
UnitTestCase
29
{
33
protected
$resetSingletonInstances
=
true
;
34
38
protected
$subject
;
39
43
protected
function
setUp
():
void
44
{
46
$tsfe = $this->getMockBuilder(TypoScriptFrontendController::class)
47
->setMethods([
'dummy'
])
48
->disableOriginalConstructor()
49
->getMock();
50
51
$contentObjectRenderer =
new
ContentObjectRenderer
($tsfe);
52
$contentObjectRenderer->setContentObjectClassMap([
53
'CASE'
=> CaseContentObject::class,
54
'TEXT'
=> TextContentObject::class,
55
]);
56
$this->subject =
new
CaseContentObject
($contentObjectRenderer);
57
}
58
62
public
function
renderReturnsEmptyStringIfNoKeyMatchesAndIfNoDefaultObjectIsSet
():
void
63
{
64
$conf = [
65
'key'
=>
'not existing'
66
];
67
$this->assertSame(
''
, $this->subject->render($conf));
68
}
69
73
public
function
renderReturnsContentFromDefaultObjectIfKeyDoesNotExist
():
void
74
{
75
$conf = [
76
'key'
=>
'not existing'
,
77
'default'
=>
'TEXT'
,
78
'default.'
=> [
79
'value'
=>
'expected value'
80
],
81
];
82
$this->assertSame(
'expected value'
, $this->subject->render($conf));
83
}
84
}
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest\$resetSingletonInstances
bool $resetSingletonInstances
Definition:
CaseContentObjectTest.php:32
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest\setUp
setUp()
Definition:
CaseContentObjectTest.php:41
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest\$subject
CaseContentObject PHPUnit_Framework_MockObject_MockObject $subject
Definition:
CaseContentObjectTest.php:36
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest\renderReturnsContentFromDefaultObjectIfKeyDoesNotExist
renderReturnsContentFromDefaultObjectIfKeyDoesNotExist()
Definition:
CaseContentObjectTest.php:71
TYPO3\CMS\Frontend\Tests\Unit\ContentObject
Definition:
CaseContentObjectTest.php:4
TYPO3\CMS\Frontend\ContentObject\CaseContentObject
Definition:
CaseContentObject.php:21
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest
Definition:
CaseContentObjectTest.php:29
TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition:
TypoScriptFrontendController.php:97
TYPO3\CMS\Frontend\Tests\Unit\ContentObject\CaseContentObjectTest\renderReturnsEmptyStringIfNoKeyMatchesAndIfNoDefaultObjectIsSet
renderReturnsEmptyStringIfNoKeyMatchesAndIfNoDefaultObjectIsSet()
Definition:
CaseContentObjectTest.php:60
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition:
ContentObjectRenderer.php:91
TYPO3\CMS\Frontend\ContentObject\TextContentObject
Definition:
TextContentObject.php:21
doxygen
typo3
sysext
frontend
Tests
Unit
ContentObject
CaseContentObjectTest.php
Generated on Tue Oct 5 2021 01:57:47 for TYPO3CMS by
1.8.18