TYPO3 CMS  TYPO3_8-7
CaseContentObjectTest.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  */
22 
26 class CaseContentObjectTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
27 {
31  protected $subject = null;
32 
36  protected function setUp()
37  {
39  $tsfe = $this->getMockBuilder(TypoScriptFrontendController::class)
40  ->setMethods(['dummy'])
41  ->disableOriginalConstructor()
42  ->getMock();
43  $tsfe->tmpl = $this->getMockBuilder(TemplateService::class)
44  ->setMethods(['dummy'])
45  ->getMock();
46  $tsfe->config = [];
47  $tsfe->page = [];
48  $tsfe->sys_page = $this->getMockBuilder(PageRepository::class)
49  ->setMethods(['getRawRecord'])
50  ->getMock();
51  $GLOBALS['TSFE'] = $tsfe;
52 
53  $contentObjectRenderer = new ContentObjectRenderer();
54  $contentObjectRenderer->setContentObjectClassMap([
55  'CASE' => CaseContentObject::class,
56  'TEXT' => TextContentObject::class,
57  ]);
58  $this->subject = new CaseContentObject($contentObjectRenderer);
59  }
60 
65  {
66  $conf = [
67  'key' => 'not existing'
68  ];
69  $this->assertSame('', $this->subject->render($conf));
70  }
71 
76  {
77  $conf = [
78  'key' => 'not existing',
79  'default' => 'TEXT',
80  'default.' => [
81  'value' => 'expected value'
82  ],
83  ];
84  $this->assertSame('expected value', $this->subject->render($conf));
85  }
86 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']