Open Monograph Press  3.3.0
NullSessionHandlerTest.php
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 
14 use PHPUnit\Framework\TestCase;
18 
27 class NullSessionHandlerTest extends TestCase
28 {
29  public function testSaveHandlers()
30  {
31  $storage = $this->getStorage();
32  $this->assertEquals('user', ini_get('session.save_handler'));
33  }
34 
35  public function testSession()
36  {
37  session_id('nullsessionstorage');
38  $storage = $this->getStorage();
39  $session = new Session($storage);
40  $this->assertNull($session->get('something'));
41  $session->set('something', 'unique');
42  $this->assertEquals('unique', $session->get('something'));
43  }
44 
45  public function testNothingIsPersisted()
46  {
47  session_id('nullsessionstorage');
48  $storage = $this->getStorage();
49  $session = new Session($storage);
50  $session->start();
51  $this->assertEquals('nullsessionstorage', $session->getId());
52  $this->assertNull($session->get('something'));
53  }
54 
55  public function getStorage()
56  {
57  return new NativeSessionStorage(array(), new NullSessionHandler());
58  }
59 }
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testSession
testSession()
Definition: NullSessionHandlerTest.php:35
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\getStorage
getStorage()
Definition: NullSessionHandlerTest.php:55
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest
Definition: NullSessionHandlerTest.php:27
Symfony\Component\HttpFoundation\Session\Session\$storage
$storage
Definition: lib/vendor/symfony/http-foundation/Session/Session.php:37
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testNothingIsPersisted
testNothingIsPersisted()
Definition: NullSessionHandlerTest.php:45
Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage
Definition: lib/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:25
Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler
Definition: lib/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php:21
Symfony\Component\HttpFoundation\Session\Session
Definition: lib/vendor/symfony/http-foundation/Session/Session.php:27
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler
Definition: MemcachedSessionHandlerTest.php:12
Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testSaveHandlers
testSaveHandlers()
Definition: NullSessionHandlerTest.php:29