[TASK] Provide correct data for DatabaseLanguageRowsTest 70/44470/6
authorOliver Eglseder <oliver.eglseder@in2code.de>
Sun, 1 Nov 2015 14:51:43 +0000 (15:51 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 13 Nov 2015 20:00:11 +0000 (21:00 +0100)
The dummy data provided in DatabaseLanguageRowsTest
leads to some E_NOTICEs.

This patch aims to provide the minimal correct set of dummy
data needed to run the affected tests without any E_NOTICE

Resolves: #71236
Related: #70584
Releases: master
Change-Id: I159f71325bdd26482ac1bdfb8176ff707acbc036
Reviewed-on: https://review.typo3.org/44470
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseLanguageRowsTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php

index 0986aed..5a17be2 100755 (executable)
@@ -4524,7 +4524,7 @@ class BackendUtility
      */
     public static function versioningPlaceholderClause($table)
     {
-        if ($GLOBALS['TCA'][$table] && static::isTableWorkspaceEnabled($table)) {
+        if (static::isTableWorkspaceEnabled($table)) {
             $currentWorkspace = (int)static::getBackendUserAuthentication()->workspace;
             return ' AND (' . $table . '.t3ver_state <= ' . new VersionState(VersionState::DEFAULT_STATE) . ' OR ' . $table . '.t3ver_wsid = ' . $currentWorkspace . ')';
         }
index c473500..e10dd66 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
 use Prophecy\Prophecy\ObjectProphecy;
 use TYPO3\CMS\Backend\Form\Exception\DatabaseDefaultLanguageException;
 use TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseLanguageRows;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
 use TYPO3\CMS\Core\Tests\UnitTestCase;
@@ -37,11 +38,19 @@ class DatabaseLanguageRowsTest extends UnitTestCase
      */
     protected $dbProphecy;
 
+    /**
+     * @var BackendUserAuthentication | ObjectProphecy
+     */
+    protected $beUserProphecy;
+
     protected function setUp()
     {
         $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
         $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
 
+        $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class);
+        $GLOBALS['BE_USER'] = $this->beUserProphecy;
+
         $this->subject = new DatabaseLanguageRows();
     }
 
@@ -117,6 +126,7 @@ class DatabaseLanguageRowsTest extends UnitTestCase
 
         $defaultLanguageRow = [
             'uid' => 23,
+            'pid' => 123,
             'text' => 'default language text',
             'sys_language_uid' => 0,
         ];
@@ -161,6 +171,7 @@ class DatabaseLanguageRowsTest extends UnitTestCase
 
         $defaultLanguageRow = [
             'uid' => 23,
+            'pid' => 123,
             'text' => 'default language text',
             'sys_language_uid' => 0,
         ];
@@ -219,6 +230,7 @@ class DatabaseLanguageRowsTest extends UnitTestCase
             'translations' => [
                 3 => [
                     'uid' => 43,
+                    'pid' => 32,
                 ],
             ],
         ];
@@ -226,11 +238,13 @@ class DatabaseLanguageRowsTest extends UnitTestCase
         $GLOBALS['TCA']['tt_content'] = array('foo');
         $recordWsolResult = [
             'uid' => 43,
+            'pid' => 32,
             'text' => 'localized text in french',
         ];
 
         $defaultLanguageRow = [
             'uid' => 23,
+            'pid' => 32,
             'text' => 'default language text',
             'sys_language_uid' => 0,
         ];
@@ -251,6 +265,7 @@ class DatabaseLanguageRowsTest extends UnitTestCase
         $expected['additionalLanguageRows'] = [
             3 => [
                 'uid' => 43,
+                'pid' => 32,
                 'text' => 'localized text in french',
             ],
         ];
@@ -314,11 +329,13 @@ class DatabaseLanguageRowsTest extends UnitTestCase
         $GLOBALS['TCA']['tt_content'] = array('foo');
         $recordWsolResult = [
             'uid' => 43,
+            'pid' => 32,
             'text' => 'localized text in french',
         ];
 
         $defaultLanguageRow = [
             'uid' => 23,
+            'pid' => 32,
             'text' => 'default language text',
             'sys_language_uid' => 0,
         ];
@@ -340,6 +357,7 @@ class DatabaseLanguageRowsTest extends UnitTestCase
         $expected['additionalLanguageRows'] = [
             3 => [
                 'uid' => 43,
+                'pid' => 32,
                 'text' => 'localized text in french',
             ],
         ];
index 07f6862..72565d2 100644 (file)
@@ -39,6 +39,7 @@ class DatabasePageLanguageOverlayRowsTest extends UnitTestCase
     {
         $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
         $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
+        $GLOBALS['TCA']['pages_language_overlay'] = array();
 
         $this->subject = new DatabasePageLanguageOverlayRows();
     }
@@ -51,7 +52,7 @@ class DatabasePageLanguageOverlayRowsTest extends UnitTestCase
         $this->dbProphecy->exec_SELECTgetRows(Argument::cetera())->willReturn(null);
         $this->dbProphecy->sql_error(Argument::cetera())->willReturn(null);
         $this->setExpectedException(\UnexpectedValueException::class,  $this->anything(), 1440777705);
-        $this->subject->addData([]);
+        $this->subject->addData(['effectivePid' => 1]);
     }
 
     /**