Esempio n. 1
0
 public function testSessionGetsProvider()
 {
     Session::setDefaultSessionProviderClassName("Rhubarb\\Crown\\Tests\\Sessions\\UnitTestingSessionProvider");
     $session = new UnitTestingSession();
     $this->assertInstanceOf("Rhubarb\\Crown\\Tests\\Sessions\\UnitTestingSessionProvider", $session->testGetSessionProvider());
     Session::setDefaultSessionProviderClassName("Rhubarb\\Crown\\Sessions\\SessionProviders\\PhpSessionProvider");
     // Although we have changed the default provider, we already instantiated the session so the provider will not
     // have changed
     $this->assertInstanceOf("Rhubarb\\Crown\\Tests\\Sessions\\UnitTestingSessionProvider", $session->testGetSessionProvider());
 }
 public function testSessionRestore()
 {
     $session = new UnitTestingSession();
     $session->TestValue = "abc123";
     $session->storeSession();
     // We can't test PHP sessions properly within the same script. However we can verify
     // that it at least restores the data from the $_SESSION array
     Settings::deleteSettingNamespace("UnitTestingSession");
     $session = new UnitTestingSession();
     $this->assertEquals("abc123", $session->TestValue);
 }