Просмотр исходного кода

[TESTS] Test updates to correct issues found running entire suite

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16804 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 лет назад
Родитель
Сommit
ebd70b3db0

+ 7 - 0
tests/Zend/Amf/AuthTest.php

@@ -104,6 +104,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 	
 	public function testUnauthenticated()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new WrongPassword());
 		$this->_server->setAcl($this->_acl);
 		$data = $this->_callService();
@@ -113,6 +114,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 
 	public function testAnonymousDenied()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new WrongPassword());
 		$this->_acl->addRole(new Zend_Acl_Role(Zend_Amf_Constants::GUEST_ROLE));
 		$this->_server->setAcl($this->_acl);
@@ -123,6 +125,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 
 	public function testAnonymousOK()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new WrongPassword());
 		$this->_acl->addRole(new Zend_Acl_Role(Zend_Amf_Constants::GUEST_ROLE));
 		$this->_acl->allow(Zend_Amf_Constants::GUEST_ROLE, null, null);
@@ -153,6 +156,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 
 	public function testRightPassword()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new RightPassword("testuser", "testrole"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole"));
 		$this->_acl->allow("testrole", null, null);
@@ -189,6 +193,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 	// Class-defined ACL
 	public function testClassAclAllowed()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new RightPassword("testuser", "testrole"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole2"));
@@ -215,6 +220,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 	// Class-defined ACL
 	public function testClassAclAllowed2()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new RightPassword("testuser", "testrole2"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole2"));
@@ -226,6 +232,7 @@ class Zend_Amf_AuthTest extends PHPUnit_Framework_TestCase
 
 	public function testLogout()
 	{
+        Zend_Session::$_unitTestEnabled = true;
 		$this->_server->setAuth(new RightPassword("testuser", "testrole"));
 		$this->_acl->addRole(new Zend_Acl_Role("testrole"));
 		$this->_acl->allow("testrole", null, null);

+ 1 - 0
tests/Zend/Amf/ServerTest.php

@@ -948,6 +948,7 @@ class Zend_Amf_ServerTest extends PHPUnit_Framework_TestCase
      */
     public function testSessionAmf3()
     {
+        Zend_Session::$_unitTestEnabled = true;
         Zend_Session::start(); 
         $this->_server->setClass('Zend_Amf_testSession');
         $this->_server->setSession();

+ 0 - 5
tests/Zend/AuthTest.php

@@ -24,11 +24,6 @@
  */
 require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php';
 
-/**
- * Start output buffering to prevent problems using session
- */
-ob_start();
-
 
 /**
  * @see Zend_Auth

+ 5 - 1
tests/Zend/Controller/Response/HttpTest.php

@@ -196,7 +196,11 @@ class Zend_Controller_Response_HttpTest extends PHPUnit_Framework_TestCase
     public function test__toString()
     {
 
-        //$skipHeadersTest = headers_sent();
+        $skipHeadersTest = headers_sent();
+        if ($skipHeadersTest) {
+            $this->markTestSkipped('Unable to run Zend_Controller_Response_Http::__toString() test as headers have already been sent');
+            return;
+        }
 
         $this->_response->setHeader('Content-Type', 'text/plain');
         $this->_response->setBody('Content');

+ 7 - 1
tests/Zend/Date/DateObjectTest.php

@@ -42,6 +42,7 @@ class Zend_Date_DateObjectTest extends PHPUnit_Framework_TestCase
 
     public function setUp()
     {
+        $this->originalTimezone = date_default_timezone_get();
         date_default_timezone_set('Europe/Paris');
         require_once 'Zend/Cache.php';
         $cache = Zend_Cache::factory('Core', 'File',
@@ -50,6 +51,11 @@ class Zend_Date_DateObjectTest extends PHPUnit_Framework_TestCase
         Zend_Date_DateObjectTestHelper::setOptions(array('cache' => $cache));
     }
 
+    public function tearDown()
+    {
+        date_default_timezone_set($this->originalTimezone);
+    }
+
     /**
      * Test for date object creation null value
      */
@@ -590,4 +596,4 @@ class Zend_Date_DateObjectTestHelper extends Zend_Date
     {
         return parent::_getTime($sync);
     }
-}
+}

+ 2 - 0
tests/Zend/DateTest.php

@@ -63,6 +63,7 @@ class Zend_DateTest extends PHPUnit_Framework_TestCase
 
     public function setUp()
     {
+        $this->originalTimezone = date_default_timezone_get();
         date_default_timezone_set('Indian/Maldives');
         require_once 'Zend/Cache.php';
         $this->_cache = Zend_Cache::factory('Core', 'File',
@@ -76,6 +77,7 @@ class Zend_DateTest extends PHPUnit_Framework_TestCase
     public function tearDown()
     {
         $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
+        date_default_timezone_set($this->originalTimezone);
     }
 
     /**

+ 4 - 0
tests/Zend/Feed/Reader/Entry/AtomTest.php

@@ -10,6 +10,10 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase
 
     public function setup()
     {
+        if (Zend_Registry::isRegistered('Zend_Locale')) {
+            $registry = Zend_Registry::getInstance();
+            unset($registry['Zend_Locale']);
+        }
         $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom';
     }
 

+ 4 - 0
tests/Zend/Feed/Reader/Entry/RssTest.php

@@ -10,6 +10,10 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase
 
     public function setup()
     {
+        if (Zend_Registry::isRegistered('Zend_Locale')) {
+            $registry = Zend_Registry::getInstance();
+            unset($registry['Zend_Locale']);
+        }
         $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss';
     }
 

+ 4 - 0
tests/Zend/Feed/Reader/Feed/AtomTest.php

@@ -10,6 +10,10 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase
 
     public function setup()
     {
+        if (Zend_Registry::isRegistered('Zend_Locale')) {
+            $registry = Zend_Registry::getInstance();
+            unset($registry['Zend_Locale']);
+        }
         $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom';
     }
 

+ 4 - 0
tests/Zend/Feed/Reader/Feed/RssTest.php

@@ -10,6 +10,10 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase
 
     public function setup()
     {
+        if (Zend_Registry::isRegistered('Zend_Locale')) {
+            $registry = Zend_Registry::getInstance();
+            unset($registry['Zend_Locale']);
+        }
         $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss';
     }
 

+ 2 - 2
tests/Zend/FilterTest.php

@@ -112,13 +112,13 @@ class Zend_FilterTest extends PHPUnit_Framework_TestCase
     public function testStaticFactoryWithConstructorArguments()
     {
         // Test HtmlEntities with one ctor argument.
-        $filteredValue = Zend_Filter::get('"O\'Reilly"', 'HtmlEntities', array(ENT_COMPAT));
+        $filteredValue = Zend_Filter::get('"O\'Reilly"', 'HtmlEntities', array(array('quotestyle' => ENT_COMPAT)));
         $this->assertEquals('"O\'Reilly"', $filteredValue);
 
         // Test HtmlEntities with a different ctor argument,
         // and make sure it gives the correct response
         // so we know it passed the arg to the ctor.
-        $filteredValue = Zend_Filter::get('"O\'Reilly"', 'HtmlEntities', array(ENT_QUOTES));
+        $filteredValue = Zend_Filter::get('"O\'Reilly"', 'HtmlEntities', array(array('quotestyle' => ENT_QUOTES)));
         $this->assertEquals('"O'Reilly"', $filteredValue);
     }
 

+ 1 - 1
tests/Zend/Service/Amazon/S3/OfflineTest.php

@@ -45,4 +45,4 @@ class Zend_Service_Amazon_S3_OfflineTest extends PHPUnit_Framework_TestCase
     public function testNothing()
     {
     }
-}
+}

+ 1 - 1
tests/Zend/Service/Amazon/S3/OnlineTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php
 
 /**
  * Zend Framework