2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
22 use TYPO3\CMS\Core\Tests\UnitTestCase;
65 public function addDataAddsTreeConfigurationForExtJs()
67 $GLOBALS[
'TCA'][
'foreignTable'] = [];
70 $database = $this->prophesize(DatabaseConnection::class);
71 $GLOBALS[
'TYPO3_DB'] = $database->reveal();
74 $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
75 $GLOBALS[
'BE_USER'] = $backendUserProphecy->reveal();
78 $treeDataProviderProphecy = $this->prophesize(DatabaseTreeDataProvider::class);
82 $tableConfigurationTreeProphecy = $this->prophesize(TableConfigurationTree::class);
84 $tableConfigurationTreeProphecy->setDataProvider(Argument::cetera())->shouldBeCalled();
85 $tableConfigurationTreeProphecy->setNodeRenderer(Argument::cetera())->shouldBeCalled();
86 $tableConfigurationTreeProphecy->render()->shouldBeCalled()->willReturn([
'fake',
'tree',
'data']);
89 'tableName' =>
'aTable',
98 'renderType' =>
'selectTree',
100 'childrenField' =>
'childrenField'
102 'foreign_table' =>
'foreignTable',
112 $expected[
'databaseRow'][
'aField'] = [
'1'];
113 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'treeData'] = [
114 'items' => [[
'fake',
'tree',
'data']],
115 'selectedNodes' => []
117 $this->assertEquals($expected, $this->subject->addData($input));