[TASK] Add admin and editor actor for acceptance tests 27/47627/5
authorSascha Egerer <sascha@sascha-egerer.de>
Tue, 12 Apr 2016 15:20:23 +0000 (17:20 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 12 Apr 2016 16:20:59 +0000 (18:20 +0200)
An admin and an editor actor has been added for the
acceptance test suite. These actors are able to reuse
a session that is imported in the fixture.
Reusing the session does speed up the tests as to login
process must not be done on every test.

Change-Id: Ie20972c8b968ee8e986df0e0ee91460aa6dde68a
Resolves: #75550
Releases: master
Reviewed-on: https://review.typo3.org/47627
Reviewed-by: Dirk Jüttner <dirk.juettner@gmail.com>
Tested-by: Dirk Jüttner <dirk.juettner@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Acceptance/Fixtures/be_sessions.xml [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php [new file with mode: 0644]
typo3/sysext/core/Tests/AcceptanceCoreEnvironment.php

diff --git a/typo3/sysext/core/Tests/Acceptance/Fixtures/be_sessions.xml b/typo3/sysext/core/Tests/Acceptance/Fixtures/be_sessions.xml
new file mode 100644 (file)
index 0000000..f4f3e73
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<dataset>
+       <be_sessions>
+               <ses_id>886526ce72b86870739cc41991144ec1</ses_id>
+               <ses_name>be_typo_user</ses_name>
+               <ses_iplock>[DISABLED]</ses_iplock>
+               <ses_hashlock>222419149</ses_hashlock>
+               <ses_userid>1</ses_userid>
+               <ses_tstamp>1777777777</ses_tstamp>
+               <ses_data></ses_data>
+               <ses_backuserid>0</ses_backuserid>
+       </be_sessions>
+       <be_sessions>
+               <ses_id>ff83dfd81e20b34c27d3e97771a4525a</ses_id>
+               <ses_name>be_typo_user</ses_name>
+               <ses_iplock>[DISABLED]</ses_iplock>
+               <ses_hashlock>222419149</ses_hashlock>
+               <ses_userid>2</ses_userid>
+               <ses_tstamp>1777777777</ses_tstamp>
+               <ses_data></ses_data>
+               <ses_backuserid>0</ses_backuserid>
+       </be_sessions>
+</dataset>
diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Admin.php
new file mode 100644 (file)
index 0000000..1b3d3d4
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * A backend user with admin access
+ */
+class Admin extends \AcceptanceTester
+{
+    /**
+     * @var string Assigned session cookie
+     */
+    protected $sessionCookie = '886526ce72b86870739cc41991144ec1';
+
+    /**
+     * Use the existing database session from the fixture by setting the backend user cookie
+     */
+    public function useExistingSession()
+    {
+        $I = $this;
+        $I->amOnPage('/typo3/index.php');
+        $I->setCookie('be_typo_user', $this->sessionCookie, array('path' => '/typo3temp/var/tests/acceptance/'));
+        $I->setCookie('be_lastLoginProvider', '1433416747', array('path' => '/typo3temp/var/tests/acceptance/'));
+        // reload the page to have a logged in backend
+        $I->amOnPage('/typo3/index.php');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php b/typo3/sysext/core/Tests/Acceptance/Step/Backend/Editor.php
new file mode 100644 (file)
index 0000000..6cb487d
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * A backend editor
+ */
+class Editor extends \AcceptanceTester
+{
+    /**
+     * @var string Assigned session cookie
+     */
+    protected $sessionCookie = 'ff83dfd81e20b34c27d3e97771a4525a';
+
+    /**
+     * Use the existing database session from the fixture by setting the backend user cookie
+     */
+    public function useExistingSession()
+    {
+        $I = $this;
+        $I->amOnPage('/typo3/index.php');
+        $I->setCookie('be_typo_user', $this->sessionCookie, array('path' => '/typo3temp/var/tests/acceptance/'));
+        $I->setCookie('be_lastLoginProvider', '1433416747', array('path' => '/typo3temp/var/tests/acceptance/'));
+        // reload the page to have a logged in backend
+        $I->amOnPage('/typo3/index.php');
+    }
+}
index c34d935..b0bbd3a 100644 (file)
@@ -131,6 +131,7 @@ class AcceptanceCoreEnvironment extends Extension
      */
     protected $xmlDatabaseFixtures = [
         'typo3/sysext/core/Tests/Acceptance/Fixtures/be_users.xml',
+        'typo3/sysext/core/Tests/Acceptance/Fixtures/be_sessions.xml',
         'typo3/sysext/core/Tests/Acceptance/Fixtures/be_groups.xml',
     ];
 
@@ -191,6 +192,7 @@ class AcceptanceCoreEnvironment extends Extension
         // Set some hard coded base settings for the instance. Those could be overruled by
         // $this->configurationToUseInTestInstance if needed again.
         $localConfiguration['BE']['debug'] = true;
+        $localConfiguration['BE']['lockHashKeyWords'] = '';
         $localConfiguration['BE']['installToolPassword'] = '$P$notnotnotnotnotnot.validvalidva';
         $localConfiguration['SYS']['isInitialInstallationInProgress'] = false;
         $localConfiguration['SYS']['isInitialDatabaseImportDone'] = true;