[TASK] Doctrine: Migrate ALL Functional tests of ext:backend 62/49362/2
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Wed, 3 Aug 2016 18:11:30 +0000 (20:11 +0200)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Wed, 3 Aug 2016 18:44:41 +0000 (20:44 +0200)
Releases: master
Resolves: #77393
Change-Id: I82fe1e8dc60d6e319f2a16003dc8aa845aeddf01
Reviewed-on: https://review.typo3.org/49362
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php

index 50b4127..502829d 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Tests\Functional\Controller\Page;
 
 use TYPO3\CMS\Backend\Controller\Page\LocalizationController;
 use TYPO3\CMS\Core\Core\Bootstrap;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Tests\FunctionalTestCase;
 
@@ -64,25 +65,36 @@ class LocalizationControllerTest extends FunctionalTestCase
 
         $expectedResults = [
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '1',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 1,
                 'header' => '[Translate to Dansk:] Test content 1',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '2',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 2,
                 'header' => '[Translate to Dansk:] Test content 2',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '3',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 3,
                 'header' => '[Translate to Dansk:] Test content 3',
             ],
         ];
-        $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 1');
+        $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tt_content');
+        $queryBuilder->getRestrictions()->removeAll();
+        $results = $queryBuilder
+            ->select('pid', 'sys_language_uid', 'l18n_parent', 'header')
+            ->from('tt_content')
+            ->where(
+                $queryBuilder->expr()->andX(
+                    $queryBuilder->expr()->eq('pid', 1),
+                    $queryBuilder->expr()->eq('sys_language_uid', 1)
+                )
+            )->execute()
+            ->fetchAll();
         $this->assertSame($expectedResults, $results);
     }
 
@@ -104,25 +116,36 @@ class LocalizationControllerTest extends FunctionalTestCase
 
         $expectedResults = [
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '1',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 1,
                 'header' => 'Test indhold 1 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '2',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 2,
                 'header' => 'Test indhold 2 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '3',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 3,
                 'header' => 'Test indhold 3 (copy 1)',
             ],
         ];
-        $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 2');
+        $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tt_content');
+        $queryBuilder->getRestrictions()->removeAll();
+        $results = $queryBuilder
+            ->select('pid', 'sys_language_uid', 'l18n_parent', 'header')
+            ->from('tt_content')
+            ->where(
+                $queryBuilder->expr()->andX(
+                    $queryBuilder->expr()->eq('pid', 1),
+                    $queryBuilder->expr()->eq('sys_language_uid', 2)
+                )
+            )->execute()
+            ->fetchAll();
         $this->assertSame($expectedResults, $results);
     }
 
@@ -142,25 +165,36 @@ class LocalizationControllerTest extends FunctionalTestCase
 
         $expectedResults = [
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test content 1 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test content 2 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test content 3 (copy 1)',
             ],
         ];
-        $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 2');
+        $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tt_content');
+        $queryBuilder->getRestrictions()->removeAll();
+        $results = $queryBuilder
+            ->select('pid', 'sys_language_uid', 'l18n_parent', 'header')
+            ->from('tt_content')
+            ->where(
+                $queryBuilder->expr()->andX(
+                    $queryBuilder->expr()->eq('pid', 1),
+                    $queryBuilder->expr()->eq('sys_language_uid', 2)
+                )
+            )->execute()
+            ->fetchAll();
         $this->assertSame($expectedResults, $results);
     }
 
@@ -182,25 +216,36 @@ class LocalizationControllerTest extends FunctionalTestCase
 
         $expectedResults = [
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test indhold 1 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test indhold 2 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '2',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 2,
+                'l18n_parent' => 0,
                 'header' => 'Test indhold 3 (copy 1)',
             ],
         ];
-        $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 2');
+        $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tt_content');
+        $queryBuilder->getRestrictions()->removeAll();
+        $results = $queryBuilder
+            ->select('pid', 'sys_language_uid', 'l18n_parent', 'header')
+            ->from('tt_content')
+            ->where(
+                $queryBuilder->expr()->andX(
+                    $queryBuilder->expr()->eq('pid', 1),
+                    $queryBuilder->expr()->eq('sys_language_uid', 2)
+                )
+            )->execute()
+            ->fetchAll();
         $this->assertSame($expectedResults, $results);
     }
 
@@ -246,31 +291,43 @@ class LocalizationControllerTest extends FunctionalTestCase
 
         $expectedResults = [
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 0,
                 'header' => 'Test content 1 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 0,
                 'header' => 'Test content 2 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 0,
                 'header' => 'Test content 2.5 (copy 1)',
             ],
             [
-                'pid' => '1',
-                'sys_language_uid' => '1',
-                'l18n_parent' => '0',
+                'pid' => 1,
+                'sys_language_uid' => 1,
+                'l18n_parent' => 0,
                 'header' => 'Test content 3 (copy 1)',
             ],
         ];
-        $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 1', '', 'sorting ASC');
+        $queryBuilder = (new ConnectionPool())->getQueryBuilderForTable('tt_content');
+        $queryBuilder->getRestrictions()->removeAll();
+        $results = $queryBuilder
+            ->select('pid', 'sys_language_uid', 'l18n_parent', 'header')
+            ->from('tt_content')
+            ->where(
+                $queryBuilder->expr()->andX(
+                    $queryBuilder->expr()->eq('pid', 1),
+                    $queryBuilder->expr()->eq('sys_language_uid', 1)
+                )
+            )->orderBy('sorting', 'ASC')
+            ->execute()
+            ->fetchAll();
         $this->assertSame($expectedResults, $results);
     }
 }