Hi everybody,
I like to use the awesome codeception framework to perform acceptance test for my application. But I think I currently couldn't find the clue to deal with session.
I have the following setup:
routes.php
Route::get('/', function()
{
session_start();
$session = $_SESSION;
session_write_close();
if(array_key_exists('user', $session))
return 'success';
return 'fail';
});
acceptance.suite.yml:
class_name: AcceptanceTester
modules:
enabled: [WebDriver]
config:
WebDriver:
url: 'http://localhost/bart/testing/public/'
browser: phantomjs
capabilities:
webStorageEnabled: true
SessionCest.php
<?php
use \AcceptanceTester;
class SessionCest
{
public function _before(AcceptanceTester $I)
{
$_SESSION = [
'active' => 1,
'user' => 'bart',
'expire' => time() + 600,
'role' => -1
];
}
public function _after(AcceptanceTester $I)
{
}
public function tryToTest(AcceptanceTester $I)
{
$I->amOnPage('/');
$I->see('success');
}
}
The problem is, that I always get "fail" instead of "success" - no matter what I change. So I would like to know, whether there is any way to set session variables before the suite runs?
Thanks and best regards!