TYPO3 CMS  TYPO3_7-6
DatabasePageLanguageOverlayRowsTest.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 
22 
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  $GLOBALS['TCA']['pages_language_overlay'] = [];
43 
44  $this->subject = new DatabasePageLanguageOverlayRows();
45  }
46 
51  {
52  $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
53  $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
54  $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1440777705);
55  $this->subject->addData(['effectivePid' => 1]);
56  }
57 
62  {
63  $input = [
64  'effectivePid' => '23',
65  ];
66  $expected = $input;
67  $expected['pageLanguageOverlayRows'] = [
68  0 => [
69  'uid' => '1',
70  'pid' => '42',
71  'sys_language_uid' => '2',
72  ],
73  ];
74  $this->dbProphecy->exec_SELECTgetRows('*', 'pages_language_overlay', 'pid=23')
75  ->shouldBeCalled()
76  ->willReturn($expected['pageLanguageOverlayRows']);
77  $this->assertSame($expected, $this->subject->addData($input));
78  }
79 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']