99c0cd7e096bf56254e7c5588f938eee7d98e3dc
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Step / Backend / Admin.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Step\Backend;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * A backend user with admin access
19 */
20 class Admin extends \AcceptanceTester
21 {
22 /**
23 * @var string Assigned session cookie
24 */
25 protected $sessionCookie = '886526ce72b86870739cc41991144ec1';
26
27 /**
28 * Use the existing database session from the fixture by setting the backend user cookie
29 */
30 public function useExistingSession()
31 {
32 $I = $this;
33 $I->amOnPage('/typo3/index.php');
34
35 // @todo: There is a bug in PhantomJS where adding a cookie fails.
36 // This bug will be fixed in the next PhantomJS version but i also found
37 // this workaround. First reset / delete the cookie and than set it and catch
38 // the webdriver exception as the cookie has been set successful.
39 try {
40 $I->resetCookie('be_typo_user');
41 $I->setCookie('be_typo_user', $this->sessionCookie);
42 } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) {
43 }
44 try {
45 $I->resetCookie('be_lastLoginProvider');
46 $I->setCookie('be_lastLoginProvider', '1433416747');
47 } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) {
48 }
49
50 // reload the page to have a logged in backend
51 $I->amOnPage('/typo3/index.php');
52 }
53 }