TYPO3  7.6
DatabasePageLanguageOverlayRowsTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
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 
17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
21 use TYPO3\CMS\Core\Tests\UnitTestCase;
22 
26 class DatabasePageLanguageOverlayRowsTest extends UnitTestCase
27 {
31  protected $subject;
32 
36  protected $dbProphecy;
37 
38  protected function setUp()
39  {
40  $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
41  $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
42 
43  $this->subject = new DatabasePageLanguageOverlayRows();
44  }
45 
50  {
51  $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
52  $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
53  $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1440777705);
54  $this->subject->addData([]);
55  }
56 
61  {
62  $input = [
63  'effectivePid' => '23',
64  ];
65  $expected = $input;
66  $expected['pageLanguageOverlayRows'] = [
67  0 => [
68  'uid' => '1',
69  'pid' => '42',
70  'sys_language_uid' => '2',
71  ],
72  ];
73  $this->dbProphecy->exec_SELECTgetRows('*', 'pages_language_overlay', 'pid=23')
74  ->shouldBeCalled()
75  ->willReturn($expected['pageLanguageOverlayRows']);
76  $this->assertSame($expected, $this->subject->addData($input));
77  }
78 }