public function register(Application $app) { parent::register($app); if (!isset($app['session.cookie.options'])) { $app['session.cookie.options'] = []; } $this->app = $app; $app['session.storage.handler'] = $app->share(function ($app) { $options = CookieSessionServiceProvider::mergeDefaultOptions(isset($app['session.cookie.options']) ? $app['session.cookie.options'] : []); return new CookieSessionHandler($options['name'], $options['lifetime'], $options['path'], $options['domain'], $options['secure'], $options['httponly']); }); $app['session.storage.native'] = $app->share(function ($app) { return new PhpBridgeSessionStorage($app['session.storage.handler']); }); $app['session'] = $app->share(function ($app) { if (!isset($app['session.storage'])) { if ($app['session.test']) { $app['session.storage'] = $app['session.storage.test']; } else { $app['session.storage'] = $app['session.storage.native']; } } $options = CookieSessionServiceProvider::mergeDefaultOptions(isset($app['session.cookie.options']) ? $app['session.cookie.options'] : []); $session = new CookieSession($app['session.storage']); $session->setName($options['name']); return $session; }); }
public function testCookieSessionMigrationOnlyReturnsTrue() { $session = new CookieSession(); $this->assertTrue($session->migrate()); }