/**
  * {@inheritdoc}
  */
 public function register()
 {
     $this->container->registerSingleton(['mako\\session\\Session', 'session'], function ($container) {
         $config = $container->get('config')->get('session');
         $session = new Session($container->get('request'), $container->get('response'), $this->getSessionStore($container, $config));
         $session->setDataTTL($config['ttl']['data']);
         $session->setCookieTTL($config['ttl']['cookie']);
         $session->setCookieName($config['session_name']);
         $session->setCookieOptions($config['cookie_options']);
         $session->start();
         return $session;
     });
 }
Пример #2
0
 /**
  *
  */
 public function testDestroy()
 {
     $response = $this->getResponseSetCookie();
     $response->shouldReceive('deleteCookie')->once()->with('mako_session', ['path' => '/', 'domain' => '', 'secure' => false, 'httponly' => false]);
     $store = $this->getStore();
     $store->shouldReceive('read')->once()->with('foo123')->andReturn([]);
     $store->shouldReceive('delete')->once()->with('foo123');
     $session = new Session($this->getRequestWithCookie(), $response, $store);
     $session->start();
     $session->destroy();
 }