public function testSessionRestore()
 {
     $session = UnitTestingSession::singleton();
     $session->TestValue = "abc123";
     $session->storeSession();
     Container::current()->clearSingleton(UnitTestingSession::class);
     $session = UnitTestingSession::singleton();
     $this->assertEquals("abc123", $session->TestValue);
 }
Exemple #2
0
 public function testSessionGetsProvider()
 {
     Container::current()->registerClass(SessionProvider::class, UnitTestingSessionProvider::class);
     $session = UnitTestingSession::singleton();
     $this->assertInstanceOf(UnitTestingSessionProvider::class, $session->testGetSessionProvider());
     Container::current()->registerClass(SessionProvider::class, PhpSessionProvider::class);
     // Although we have changed the default provider, we already instantiated the session so the provider will not
     // have changed
     $this->assertInstanceOf(UnitTestingSessionProvider::class, $session->testGetSessionProvider());
 }