Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
update dependency, test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arius86 committed Nov 12, 2015
1 parent 738dfcf commit 13ef7e6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"vegas-cmf/core" : "v2.0.x-dev"
},
"require-dev": {
"phalcon/devtools": "2.*",
"phpunit/phpunit": "4.3.*",
"satooshi/php-coveralls": "dev-master"
},
Expand Down
58 changes: 58 additions & 0 deletions tests/FakeSessionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace Vegas\Tests;

use Phalcon\Session\AdapterInterface;

class FakeSessionAdapter implements \Phalcon\Session\AdapterInterface
{
private static $sessionStorage = array();
Expand All @@ -22,6 +24,8 @@ class FakeSessionAdapter implements \Phalcon\Session\AdapterInterface

private static $id = null;

private static $name = null;

/**
* Starts session, optionally using an adapter
*
Expand All @@ -39,6 +43,10 @@ public function start($options = array())
self::$id = uniqid();
self::$started = true;

if (isset($options['name'])) {
$this->setName($options['name']);
}

session_id(self::$id);

return self::$started;
Expand Down Expand Up @@ -163,4 +171,54 @@ public function __unset($name)
{
$this->remove($name);
}

/**
* Set session name
*
* @param string $name
*/
public function setName($name)
{
self::$name = $name;
}

/**
* Get session name
*
* @return string
*/
public function getName()
{
self::$name;
}

/**
* \Phalcon\Session construtor
*
* @param array $options
*/
public function __construct($options = null)
{
self::$options = $options;
if (isset($options['name'])) {
$this->setName($options['name']);
}
}

/**
* Regenerate session's id
*
* @param bool $deleteOldSession
* @return AdapterInterface
*/
public function regenerateId($deleteOldSession = true)
{
if ($deleteOldSession) {
$this->destroy();
}

$this->start();

return $this;
}
}

0 comments on commit 13ef7e6

Please sign in to comment.