summaryrefslogtreecommitdiff
path: root/tests/unit/Web
diff options
context:
space:
mode:
authorDavid <ottodavid@gmx.net>2014-09-04 19:45:25 +0200
committerDavid <ottodavid@gmx.net>2014-09-04 21:24:48 +0200
commitc6abc59438d05e50115bd29388cd4521b51c9c1f (patch)
tree6c95433fc2168fb9d151f7b8b96d3b4ffd6317bc /tests/unit/Web
parentbb2ae8c583c1f1efd7c6ba4100cd824ea0739f5b (diff)
Fix #531
Since PHP 5.3.3 the default value for session.use_only_cookies is 1, so we need to set that to 0 when CookieMode is "None"
Diffstat (limited to 'tests/unit/Web')
-rw-r--r--tests/unit/Web/THttpSessionTest.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/unit/Web/THttpSessionTest.php b/tests/unit/Web/THttpSessionTest.php
index aca83077..eb1ec4df 100644
--- a/tests/unit/Web/THttpSessionTest.php
+++ b/tests/unit/Web/THttpSessionTest.php
@@ -43,8 +43,32 @@ class THttpSessionTest extends PHPUnit_Framework_TestCase {
throw new PHPUnit_Framework_IncompleteTestError();
}
- public function testSetCookieMode() {
- throw new PHPUnit_Framework_IncompleteTestError();
+ public function testSetCookieModeNone() {
+ $session = new THttpSession();
+ $session->CookieMode = THttpSessionCookieMode::None;
+
+ $this->assertEquals(0, ini_get('session.use_cookies_only'));
+ $this->assertEquals(0, ini_get('session.use_cookies'));
+ $this->assertEquals(THttpSessionCookieMode::None, $session->CookieMode);
+ }
+
+ public function testSetCookieModeAllow() {
+ $session = new THttpSession();
+ $session->CookieMode = THttpSessionCookieMode::Allow;
+
+ $this->assertEquals(0, ini_get('session.use_only_cookies'));
+ $this->assertEquals(1, ini_get('session.use_cookies'));
+ $this->assertEquals(THttpSessionCookieMode::Allow, $session->CookieMode);
+ }
+
+ public function testSetCookieModeAlways() {
+ $session = new THttpSession();
+ $session->CookieMode = THttpSessionCookieMode::Only;
+
+ $this->assertEquals(1, ini_get('session.use_only_cookies'));
+ $this->assertEquals(1, ini_get('session.use_cookies'));
+ $this->assertEquals(0, ini_get('session.use_trans_sid'));
+ $this->assertEquals(THttpSessionCookieMode::Only, $session->CookieMode);
}
public function testSetAutoStart() {
@@ -110,4 +134,4 @@ class THttpSessionTest extends PHPUnit_Framework_TestCase {
public function testOffsetUnset() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-} \ No newline at end of file
+}