TYPO3 CMS  TYPO3_8-7
AbstractSectionTest.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  */
16 
20 
24 class AbstractSectionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
25 {
26 
31  {
32  $mockAbstractSection = $this->getAccessibleMockForAbstractClass(
33  AbstractSection::class,
34  [],
35  '',
36  false,
37  true,
38  true,
39  [
40  'getRootForm',
41  ]
42  );
43 
44  $mockFormDefinition = $this->getAccessibleMock(FormDefinition::class, [
45  'getTypeDefinitions',
46  'getRenderingOptions'
47  ], [], '', false);
48 
49  $mockFormDefinition
50  ->expects($this->any())
51  ->method('getTypeDefinitions')
52  ->willReturn([]);
53 
54  $mockFormDefinition
55  ->expects($this->any())
56  ->method('getRenderingOptions')
57  ->willReturn(['skipUnknownElements' => false]);
58 
59  $mockAbstractSection
60  ->expects($this->any())
61  ->method('getRootForm')
62  ->willReturn($mockFormDefinition);
63 
64  $this->expectException(TypeDefinitionNotFoundException::class);
65  $this->expectExceptionCode(1382364019);
66 
67  $mockAbstractSection->_call('createElement', '', '');
68  }
69 }