Kaynağa Gözat

ZF-1982: added new getNamespace() and a UnitTest

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19080 44c647ce-9c0f-0410-b52a-842ac1e357ba
bate 16 yıl önce
ebeveyn
işleme
ab442eb274

+ 9 - 0
library/Zend/Session/Namespace.php

@@ -514,4 +514,13 @@ class Zend_Session_Namespace extends Zend_Session_Abstract implements IteratorAg
         }
     }
 
+    /**
+     * Returns the namespace name
+     *
+     * @return string
+     */
+    public function getNamespace()
+    {
+        return $this->_namespace;
+    }
 }

+ 22 - 0
tests/Zend/Session/SessionTest.php

@@ -1005,4 +1005,26 @@ class Zend_SessionTest extends PHPUnit_Framework_TestCase
         }
         Zend_Session::start();
     }
+
+    /**
+     * test for method getNamespace()
+     *
+     * @group ZF-1982
+     * @return void
+     */
+    public function testGetNameSpaceMethod()
+    {
+        Zend_Session::$_unitTestEnabled = true;
+        $namespace = array(
+            'FooBar',
+            'Foo_Bar',
+            'Foo-Bar',
+            'Foo1000'
+        );
+        foreach ($namespace as $v) {
+            $s = new Zend_Session_Namespace($v);
+            $this->assertEquals($v, $s->getNamespace());
+        }
+    }
+
 }