Browse Source

fix fatal error when phpLiveDocx is null

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19580 44c647ce-9c0f-0410-b52a-842ac1e357ba
bkarwin 16 years ago
parent
commit
0d2ce9b6a7

+ 10 - 10
tests/Zend/Service/LiveDocx/LiveDocxTest.php

@@ -20,16 +20,12 @@
  * @version    $Id: $
  */
 
+require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
+
 if (!defined('PHPUnit_MAIN_METHOD')) {
     define('PHPUnit_MAIN_METHOD', 'Zend_Service_LiveDocx_LiveDocxTest::main');
 }
 
-/**
- * Test helper
- */
-require_once dirname(__FILE__) . '/../../../TestHelper.php';
-
-/** Zend_Service_LiveDocx_MailMerge */
 require_once 'Zend/Service/LiveDocx/MailMerge.php';
 
 /**
@@ -38,6 +34,8 @@ require_once 'Zend/Service/LiveDocx/MailMerge.php';
  * @category   Zend
  * @package    Zend_Service_LiveDocx
  * @subpackage UnitTests
+ * @group      Zend_Service
+ * @group      Zend_Service_LiveDocx
  * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @version    $Id: $
@@ -72,10 +70,12 @@ class Zend_Service_LiveDocX_LiveDocxTest extends PHPUnit_Framework_TestCase
     
     public function tearDown ()
     {
-        foreach ($this->phpLiveDocx->listTemplates() as $template) {
-            $this->phpLiveDocx->deleteTemplate($template['filename']);
-        }   
-        unset($this->phpLiveDocx);
+	if (isset($this->phpLiveDocx)) {
+	    foreach ($this->phpLiveDocx->listTemplates() as $template) {
+		$this->phpLiveDocx->deleteTemplate($template['filename']);
+	    }   
+	    unset($this->phpLiveDocx);
+	}
     }
 
     public function testGetFormat ()

+ 10 - 10
tests/Zend/Service/LiveDocx/MailMergeTest.php

@@ -20,16 +20,12 @@
  * @version    $Id: $
  */
 
+require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
+
 if (!defined('PHPUnit_MAIN_METHOD')) {
     define('PHPUnit_MAIN_METHOD', 'Zend_Service_LiveDocx_MailMergeTest::main');
 }
 
-/**
- * Test helper
- */
-require_once dirname(__FILE__) . '/../../../TestHelper.php';
-
-/** Zend_Service_LiveDocx_MailMerge */
 require_once 'Zend/Service/LiveDocx/MailMerge.php';
 
 /**
@@ -38,6 +34,8 @@ require_once 'Zend/Service/LiveDocx/MailMerge.php';
  * @category   Zend
  * @package    Zend_Service_LiveDocx
  * @subpackage UnitTests
+ * @group      Zend_Service
+ * @group      Zend_Service_LiveDocx
  * @copyright  Copyright(c) 2005-2009 Zend Technologies USA Inc.(http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @version    $Id: $
@@ -81,11 +79,13 @@ class Zend_Service_LiveDocx_MailMergeTest extends PHPUnit_Framework_TestCase
 
     public function tearDown()
     {
-        foreach($this->phpLiveDocx->listTemplates() as $template) {
-            $this->phpLiveDocx->deleteTemplate($template['filename']);
-        }
+	if (isset($this->phpLiveDocx)) {
+	    foreach($this->phpLiveDocx->listTemplates() as $template) {
+		$this->phpLiveDocx->deleteTemplate($template['filename']);
+	    }
 
-        unset($this->phpLiveDocx);
+	    unset($this->phpLiveDocx);
+	}
     }
 
     // -------------------------------------------------------------------------