2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
20 use TYPO3\CMS\Core\Tests\UnitTestCase;
42 $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
43 $GLOBALS[
'TYPO3_DB'] = $this->dbProphecy->reveal();
52 'tableName' =>
'tt_content',
60 $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
61 $this->dbProphecy->exec_SELECTgetSingleRow(
'*', $input[
'tableName'],
'uid=10')->willReturn([
'pid' => 123]);
62 $this->dbProphecy->exec_SELECTgetSingleRow(
'*',
'pages',
'uid=123')->willReturn($parentPageRow);
64 $result = $this->subject->addData($input);
66 $this->assertSame($parentPageRow, $result[
'parentPageRow']);
75 'tableName' =>
'tt_content',
83 $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
84 $this->dbProphecy->exec_SELECTgetSingleRow(
'*', $input[
'tableName'],
'uid=10')->willReturn($neigborRow);
85 $this->dbProphecy->exec_SELECTgetSingleRow(
'*',
'pages',
'uid=321')->willReturn(array());
87 $result = $this->subject->addData($input);
89 $this->assertSame($neigborRow, $result[
'neighborRow']);
98 'tableName' =>
'tt_content',
102 $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
103 $this->dbProphecy->exec_SELECTgetSingleRow(
'*', $input[
'tableName'],
'uid=10')->willReturn([
'pid' => 0]);
105 $result = $this->subject->addData($input);
107 $this->assertNull($result[
'parentPageRow']);
116 'tableName' =>
'tt_content',
124 $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
125 $this->dbProphecy->exec_SELECTgetSingleRow(
'*',
'pages',
'uid=123')->willReturn($parentPageRow);
127 $result = $this->subject->addData($input);
129 $this->assertSame($parentPageRow, $result[
'parentPageRow']);
138 'tableName' =>
'tt_content',
150 $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
151 $this->dbProphecy->exec_SELECTgetSingleRow(
'*',
'pages',
'uid=321')->willReturn($parentPageRow);
153 $result = $this->subject->addData($input);
155 $this->assertSame($parentPageRow, $result[
'parentPageRow']);