moves test mailer to abstract TestCase
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 30 May 2014 16:03:30 +0000 (18:03 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 30 May 2014 16:29:26 +0000 (18:29 +0200)
Change-Id: Ia2ebc31914b7112963ae51f8407be21b91eea43d
Reviewed-on: http://gerrit.tine20.com/customers/715
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tests/tine20/Calendar/TestCase.php
tests/tine20/TestCase.php

index 5374a3b..87c9ccb 100644 (file)
@@ -26,11 +26,6 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     protected $_notificationController;
     
     /**
-     * @var Zend_Mail_Transport_Array
-     */
-    protected static $_mailer = NULL;
-    
-    /**
      * @var Tinebase_Model_Container
      */
     protected $_testCalendar;
@@ -1034,48 +1029,6 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     }
     
     /**
-     * get messages
-     * 
-     * @return array
-     */
-    public static function getMessages()
-    {
-        // make sure messages are sent if queue is activated
-        if (isset(Tinebase_Core::getConfig()->actionqueue)) {
-            Tinebase_ActionQueue::getInstance()->processQueue(100);
-        }
-        
-        return self::getMailer()->getMessages();
-    }
-    
-    /**
-     * get mailer
-     * 
-     * @return Zend_Mail_Transport_Abstract
-     */
-    public static function getMailer()
-    {
-        if (! self::$_mailer) {
-            self::$_mailer = Tinebase_Smtp::getDefaultTransport();
-        }
-        
-        return self::$_mailer;
-    }
-    
-    /**
-     * flush mailer (send all remaining mails first)
-     */
-    public static function flushMailer()
-    {
-        // make sure all messages are sent if queue is activated
-        if (isset(Tinebase_Core::getConfig()->actionqueue)) {
-            Tinebase_ActionQueue::getInstance()->processQueue(10000);
-        }
-        
-        self::getMailer()->flush();
-    }
-    
-    /**
      * testAdoptAlarmDSTBoundaryAllDayEvent
      * 
      * @see 0009820: Infinite loop in adoptAlarmTime / computeNextOccurrence (DST Boundary)
index 3260027..0513305 100644 (file)
@@ -9,11 +9,6 @@
  */
 
 /**
- * Test helper
- */
-require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php';
-
-/**
  * Test class for Calendar_Backend_Sql
  * 
  * @package     Calendar
index 84503da..ccd7acd 100644 (file)
@@ -70,6 +70,13 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
     protected $_originalTestUser;
     
     /**
+     * the mailer
+     * 
+     * @var Zend_Mail_Transport_Array
+     */
+    protected static $_mailer = null;
+    
+    /**
      * set up tests
      */
     protected function setUp()
@@ -208,4 +215,46 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
         
         return $this->_uit;
     }
+    
+    /**
+     * get messages
+     * 
+     * @return array
+     */
+    public static function getMessages()
+    {
+        // make sure messages are sent if queue is activated
+        if (isset(Tinebase_Core::getConfig()->actionqueue)) {
+            Tinebase_ActionQueue::getInstance()->processQueue(100);
+        }
+        
+        return self::getMailer()->getMessages();
+    }
+    
+    /**
+     * get mailer
+     * 
+     * @return Zend_Mail_Transport_Abstract
+     */
+    public static function getMailer()
+    {
+        if (! self::$_mailer) {
+            self::$_mailer = Tinebase_Smtp::getDefaultTransport();
+        }
+        
+        return self::$_mailer;
+    }
+    
+    /**
+     * flush mailer (send all remaining mails first)
+     */
+    public static function flushMailer()
+    {
+        // make sure all messages are sent if queue is activated
+        if (isset(Tinebase_Core::getConfig()->actionqueue)) {
+            Tinebase_ActionQueue::getInstance()->processQueue(10000);
+        }
+        
+        self::getMailer()->flush();
+    }
 }