[TASK] Speed up functional tests using database snapshots 66/58066/10
authorOliver Hader <oliver@typo3.org>
Tue, 28 Aug 2018 22:04:48 +0000 (00:04 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 29 Aug 2018 14:44:38 +0000 (16:44 +0200)
Resolves: #86019
Releases: master
Change-Id: Ia9951730c1d1eb8b1238b92907bfa243b9518c7d
Reviewed-on: https://review.typo3.org/58066
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
composer.json
composer.lock
typo3/sysext/core/composer.json
typo3/sysext/frontend/Tests/Functional/SiteHandling/LinkGeneratorTest.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/PlainRequestTest.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php

index bfe188f..e2e1107 100644 (file)
@@ -69,7 +69,7 @@
                "fiunchinho/phpunit-randomizer": "^4.0",
                "friendsofphp/php-cs-fixer": "^2.12.2",
                "typo3/cms-styleguide": "~9.2.0",
-               "typo3/testing-framework": "~4.6.1"
+               "typo3/testing-framework": "~4.7.1"
        },
        "suggest": {
                "ext-gd": "GDlib/Freetype is required for building images with text (GIFBUILDER) and can also be used to scale images",
index 8967ad1..b6a625e 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "77ef91b6d63374021099cbe4a8506993",
+    "content-hash": "bfda1455cb3e384b6cb53ffcb627c6f6",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "typo3/testing-framework",
-            "version": "4.6.1",
+            "version": "4.7.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "a87a37860536625873b9c829174d64b210b5fa9d"
+                "reference": "aac9e26c9c942a2becc4b363641ad32463a22e70"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/a87a37860536625873b9c829174d64b210b5fa9d",
-                "reference": "a87a37860536625873b9c829174d64b210b5fa9d",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/aac9e26c9c942a2becc4b363641ad32463a22e70",
+                "reference": "aac9e26c9c942a2becc4b363641ad32463a22e70",
                 "shasum": ""
             },
             "require": {
                 "tests",
                 "typo3"
             ],
-            "time": "2018-08-23T10:29:57+00:00"
+            "time": "2018-08-29T13:58:43+00:00"
         },
         {
             "name": "webmozart/assert",
index 7285690..ad73aef 100644 (file)
@@ -51,7 +51,7 @@
                "fiunchinho/phpunit-randomizer": "^4.0",
                "friendsofphp/php-cs-fixer": "^2.12.2",
                "typo3/cms-styleguide": "~9.2.0",
-               "typo3/testing-framework": "~4.6.1"
+               "typo3/testing-framework": "~4.7.1"
        },
        "suggest": {
                "ext-fileinfo": "Used for proper file type detection in the file abstraction layer",
index 39ef48c..20f7092 100644 (file)
@@ -41,6 +41,18 @@ class LinkGeneratorTest extends AbstractTestCase
      */
     private $internalRequestContext;
 
+    public static function setUpBeforeClass()
+    {
+        parent::setUpBeforeClass();
+        static::initializeDatabaseSnapshot();
+    }
+
+    public static function tearDownAfterClass()
+    {
+        static::destroyDatabaseSnapshot();
+        parent::tearDownAfterClass();
+    }
+
     protected function setUp()
     {
         parent::setUp();
@@ -49,6 +61,39 @@ class LinkGeneratorTest extends AbstractTestCase
         $this->internalRequestContext = (new InternalRequestContext())
             ->withGlobalSettings(['TYPO3_CONF_VARS' => static::TYPO3_CONF_VARS]);
 
+        $this->withDatabaseSnapshot(function () {
+            $this->setUpDatabase();
+        });
+
+        $this->writeSiteConfiguration(
+            'acme-com',
+            $this->buildSiteConfiguration(1000, 'https://acme.com/'),
+            [
+                $this->buildDefaultLanguageConfiguration('EN', 'https://acme.us/'),
+                $this->buildLanguageConfiguration('FR', 'https://acme.fr/', ['EN']),
+                $this->buildLanguageConfiguration('FR-CA', 'https://acme.ca/', ['FR', 'EN']),
+            ]
+        );
+        $this->writeSiteConfiguration(
+            'products-acme-com',
+            $this->buildSiteConfiguration(1300, 'https://products.acme.com/')
+        );
+        $this->writeSiteConfiguration(
+            'blog-acme-com',
+            $this->buildSiteConfiguration(2000, 'https://blog.acme.com/')
+        );
+        $this->writeSiteConfiguration(
+            'john-blog-acme-com',
+            $this->buildSiteConfiguration(2110, 'https://blog.acme.com/john/')
+        );
+        $this->writeSiteConfiguration(
+            'jane-blog-acme-com',
+            $this->buildSiteConfiguration(2120, 'https://blog.acme.com/jane/')
+        );
+    }
+
+    protected function setUpDatabase()
+    {
         $backendUser = $this->setUpBackendUserFromFixture(1);
         Bootstrap::initializeLanguageObject();
 
@@ -80,32 +125,6 @@ class LinkGeneratorTest extends AbstractTestCase
                 'sitetitle' => $this->siteTitle,
             ]
         );
-
-        $this->writeSiteConfiguration(
-            'acme-com',
-            $this->buildSiteConfiguration(1000, 'https://acme.com/'),
-            [
-                $this->buildDefaultLanguageConfiguration('EN', 'https://acme.us/'),
-                $this->buildLanguageConfiguration('FR', 'https://acme.fr/', ['EN']),
-                $this->buildLanguageConfiguration('FR-CA', 'https://acme.ca/', ['FR', 'EN']),
-            ]
-        );
-        $this->writeSiteConfiguration(
-            'products-acme-com',
-            $this->buildSiteConfiguration(1300, 'https://products.acme.com/')
-        );
-        $this->writeSiteConfiguration(
-            'blog-acme-com',
-            $this->buildSiteConfiguration(2000, 'https://blog.acme.com/')
-        );
-        $this->writeSiteConfiguration(
-            'john-blog-acme-com',
-            $this->buildSiteConfiguration(2110, 'https://blog.acme.com/john/')
-        );
-        $this->writeSiteConfiguration(
-            'jane-blog-acme-com',
-            $this->buildSiteConfiguration(2120, 'https://blog.acme.com/jane/')
-        );
     }
 
     protected function tearDown()
index 89a0199..6db23da 100644 (file)
@@ -38,6 +38,18 @@ class PlainRequestTest extends AbstractTestCase
      */
     private $internalRequestContext;
 
+    public static function setUpBeforeClass()
+    {
+        parent::setUpBeforeClass();
+        static::initializeDatabaseSnapshot();
+    }
+
+    public static function tearDownAfterClass()
+    {
+        static::destroyDatabaseSnapshot();
+        parent::tearDownAfterClass();
+    }
+
     protected function setUp()
     {
         parent::setUp();
@@ -46,6 +58,13 @@ class PlainRequestTest extends AbstractTestCase
         $this->internalRequestContext = (new InternalRequestContext())
             ->withGlobalSettings(['TYPO3_CONF_VARS' => static::TYPO3_CONF_VARS]);
 
+        $this->withDatabaseSnapshot(function () {
+            $this->setUpDatabase();
+        });
+    }
+
+    protected function setUpDatabase()
+    {
         $backendUser = $this->setUpBackendUserFromFixture(1);
         Bootstrap::initializeLanguageObject();
 
index 1a21b9d..e486246 100644 (file)
@@ -38,6 +38,18 @@ class SiteRequestTest extends AbstractTestCase
      */
     private $internalRequestContext;
 
+    public static function setUpBeforeClass()
+    {
+        parent::setUpBeforeClass();
+        static::initializeDatabaseSnapshot();
+    }
+
+    public static function tearDownAfterClass()
+    {
+        static::destroyDatabaseSnapshot();
+        parent::tearDownAfterClass();
+    }
+
     protected function setUp()
     {
         parent::setUp();
@@ -46,6 +58,13 @@ class SiteRequestTest extends AbstractTestCase
         $this->internalRequestContext = (new InternalRequestContext())
             ->withGlobalSettings(['TYPO3_CONF_VARS' => static::TYPO3_CONF_VARS]);
 
+        $this->withDatabaseSnapshot(function () {
+            $this->setUpDatabase();
+        });
+    }
+
+    protected function setUpDatabase()
+    {
         $backendUser = $this->setUpBackendUserFromFixture(1);
         Bootstrap::initializeLanguageObject();