OSDN Git Service

- fixed bug Ethna_Session#isAnonymous method returns invalid result (thanks:longkey1)
authorYoshinari Takaoka <mumumu@mumumu.org>
Fri, 16 Oct 2009 14:33:41 +0000 (23:33 +0900)
committerYoshinari Takaoka <mumumu@mumumu.org>
Fri, 16 Oct 2009 14:33:41 +0000 (23:33 +0900)
CHANGES
class/Ethna_Session.php
test/Ethna_Session_Test.php [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index f680840..0ff6858 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -24,6 +24,8 @@
 -- modifier
 --- explode (文字列を,ある文字で分割して配列に変換する)
 -- Filterは一貫してプラグインを使うように変更したため、add-project時の app/filter ディレクトリを削除。
+- Ethna_Session#isAnonymous メソッドが状態を正しく取得できない場合があるバグを修正(thanks:longkey1)
+-- http://ml.ethna.jp/pipermail/users/2008-February/000899.html
 
 *** bug fix
 
index 108428b..e6c546d 100644 (file)
@@ -159,6 +159,7 @@ class Ethna_Session
         session_start();
         $_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
         $_SESSION['__anonymous__'] = $anonymous;
+        $this->anonymous = $anonymous;
         $this->session_start = true;
 
         return true;
diff --git a/test/Ethna_Session_Test.php b/test/Ethna_Session_Test.php
new file mode 100644 (file)
index 0000000..4d138ee
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ *  Ethna_Session_Test.php
+ *
+ *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
+ *  @version    $Id$
+ */
+
+//{{{  Ethna_Session_Test
+/**
+ *  Test Case For Ethna_Session
+ *
+ *  @access public
+ */
+class Ethna_Session_Test extends Ethna_UnitTestBase
+{
+    var $local_session;
+
+    function setUp()
+    {
+        $logger =& $this->ctl->getLogger();
+        $this->local_session =& new Ethna_Session("ETHNA_TEST", "/tmp", $logger);
+    }
+
+    function tearDown()
+    {
+        @$this->local_session->destroy();
+        $this->local_session = NULL;
+    }
+
+    function test_isAnonymous()
+    {
+        //   suppress header already sent error.
+        @$this->local_session->start(0, true);
+        $this->assertTrue($this->local_session->isAnonymous());
+    }
+}
+
+?>