TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AcceptanceTester.php
Go to the documentation of this file.
1 <?php
2 
3 
19 class AcceptanceTester extends \Codeception\Actor
20 {
21  use _generated\AcceptanceTesterActions;
22 
29  protected $sessionCookie = '';
30 
34  public function useExistingSession()
35  {
36  $I = $this;
37  $I->amOnPage('/typo3/index.php');
38 
39  // @todo: There is a bug in PhantomJS / firefox (?) where adding a cookie fails.
40  // This bug will be fixed in the next PhantomJS version but i also found
41  // this workaround. First reset / delete the cookie and than set it and catch
42  // the webdriver exception as the cookie has been set successful.
43  try {
44  $I->resetCookie('be_typo_user');
45  $I->setCookie('be_typo_user', $this->sessionCookie);
46  } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) {
47  }
48  try {
49  $I->resetCookie('be_lastLoginProvider');
50  $I->setCookie('be_lastLoginProvider', '1433416747');
51  } catch (\Facebook\WebDriver\Exception\UnableToSetCookieException $e) {
52  }
53 
54  // reload the page to have a logged in backend
55  $I->amOnPage('/typo3/index.php');
56  }
57 }