I'm trying to use Sessions in my application. However, I fail to get them to work in a very simple phpunit test. Take the following test:
<?php
namespace Tests\App;
class SessionTest extends \PHPUnit_Framework_TestCase
{
public function testSession()
{
$session = new \Phalcon\Session\Adapter\Files(array('uniqueId' => 'my-private-app'));
$session->start();
$session->set('foo', 'bar');
$this->assertEquals('bar', $session->get('foo'));
}
}
Which results in:
There was 1 failure:
1) Tests\App\SessionTest::testSession Failed asserting that null matches expected 'bar'.
Am I missing something here? According to the docs, that's exactly how the simple session should be working.
Using var_dump on the session object right after $session->start() also reveals that the session object believes not be started:
class Phalcon\Session\Adapter\Files#226 (3) {
protected $_uniqueId =>
string(14) "my-private-app"
protected $_started =>
bool(false)
protected $_options =>
array(1) {
'uniqueId' =>
string(14) "my-private-app"
}
}
Shouldn't there be some kind of catchable feedback that the session, apparently, has trouble starting? I'm using Phalcon 1.0.1 at the moment. Thanks in advance for any suggestion!