Przeglądaj źródła

add test for ZF-5728

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19276 44c647ce-9c0f-0410-b52a-842ac1e357ba
stas 16 lat temu
rodzic
commit
996330516f
1 zmienionych plików z 17 dodań i 0 usunięć
  1. 17 0
      tests/Zend/Captcha/FigletTest.php

+ 17 - 0
tests/Zend/Captcha/FigletTest.php

@@ -282,6 +282,23 @@ class Zend_Captcha_FigletTest extends PHPUnit_Framework_TestCase
         $input = array("id" => $this->captcha->getId(), "input" => $this->captcha->getWord());
         $this->assertTrue($this->element->isValid($input));
     }
+    
+    /**
+     * @group ZF-5728
+     */
+    public function testSetSessionWorks()
+    {
+        if(headers_sent($file, $line)) {
+            $this->markTestSkipped("Cannot use sessions because headers already sent");
+        }
+        require_once 'Zend/Session/Namespace.php';
+        $session = new Zend_Session_Namespace('captcha');
+        $this->captcha->setSession($session);
+        $this->testCaptchaIsRendered();
+        $input = array("id" => $this->captcha->getId(), "input" => $this->captcha->getWord());
+        $this->assertTrue($this->element->isValid($input));
+        $this->assertEquals($session->word, $this->captcha->getWord());
+    }
 }
 
 class Zend_Captcha_FigletTest_SessionContainer