‪TYPO3CMS  ‪main
DatabaseTreeDataProviderTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
25 final class ‪DatabaseTreeDataProviderTest extends UnitTestCase
26 {
27  #[Test]
29  {
30  $subject = $this->getAccessibleMock(DatabaseTreeDataProvider::class, ['getRelatedRecords', 'getStartingPoints', 'getChildrenOf'], [], '', false);
31  $subject->method('getStartingPoints')->willReturn([0]);
32  $treeData = new ‪TreeNode();
33  $subject->_set('treeData', $treeData);
34  $subject->_set('levelMaximum', 0);
35  $subject->expects(self::never())->method('getChildrenOf');
36  $subject->_call('loadTreeData');
37  }
38 
39  #[Test]
41  {
42  $subject = $this->getAccessibleMock(DatabaseTreeDataProvider::class, ['getRelatedRecords', 'getStartingPoints', 'getChildrenOf'], [], '', false);
43  $subject->method('getStartingPoints')->willReturn([0]);
44  $treeData = new ‪TreeNode();
45  $subject->_set('treeData', $treeData);
46  $subject->_set('levelMaximum', 1);
47  $subject->expects(self::once())->method('getChildrenOf')->with($treeData, 1);
48  $subject->_call('loadTreeData');
49  }
50 }
‪TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration
Definition: DatabaseTreeDataProviderTest.php:18
‪TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider
Definition: DatabaseTreeDataProvider.php:39
‪TYPO3\CMS\Backend\Tree\TreeNode
Definition: TreeNode.php:25
‪TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\DatabaseTreeDataProviderTest\loadTreeDataLevelMaximumSetToOneWorks
‪loadTreeDataLevelMaximumSetToOneWorks()
Definition: DatabaseTreeDataProviderTest.php:40
‪TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\DatabaseTreeDataProviderTest
Definition: DatabaseTreeDataProviderTest.php:26
‪TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\DatabaseTreeDataProviderTest\loadTreeDataLevelMaximumSetToZeroWorks
‪loadTreeDataLevelMaximumSetToZeroWorks()
Definition: DatabaseTreeDataProviderTest.php:28