[TASK] Acceptance tests: Reset be_user uc after test 24/47824/3
authorSusanne Moog <typo3@susannemoog.de>
Wed, 20 Apr 2016 17:34:55 +0000 (19:34 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 20 Apr 2016 20:57:32 +0000 (22:57 +0200)
Since reduce possible side effects between tests the
typo3 codeception module resets be_user uc of the
admin user after each test.

Change-Id: I8ae0af84b7a10e3760737c1f5c5fd3ec5790a2be
Resolves: #75826
Releases: master
Reviewed-on: https://review.typo3.org/47824
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/AcceptanceCoreEnvironment.php

index 8e7bdff..ebe8ae3 100644 (file)
@@ -19,6 +19,8 @@ use Codeception\Events;
 use Codeception\Extension;
 use TYPO3\CMS\Core\Cache\Backend\NullBackend;
 use TYPO3\CMS\Core\Core\Bootstrap;
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Styleguide\TcaDataGenerator\Generator;
 
 /**
@@ -140,6 +142,7 @@ class AcceptanceCoreEnvironment extends Extension
      */
     public static $events = [
         Events::SUITE_BEFORE => 'bootstrapTypo3Environment',
+        Events::TEST_AFTER => 'cleanupTypo3Environment'
     ];
 
     /**
@@ -251,4 +254,18 @@ class AcceptanceCoreEnvironment extends Extension
         $styleguideGenerator = new Generator();
         $styleguideGenerator->create();
     }
+
+    /**
+     * Method executed after each test
+     *
+     * @return void
+     */
+    public function cleanupTypo3Environment()
+    {
+        // Reset uc db field of be_user "admin" to null to reduce
+        // possible side effects between single tests.
+        GeneralUtility::makeInstance(ConnectionPool::class)
+            ->getConnectionForTable('be_users')
+            ->update('be_users', ['uc' => null], ['uid' => 1]);
+    }
 }