enforce enotice compliance on remaining tests
authorEileen McNaughton <eileen@fuzion.co.nz>
Sat, 18 Jul 2015 05:08:34 +0000 (17:08 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Tue, 21 Jul 2015 08:58:04 +0000 (20:58 +1200)
CRM/Extension/Container/Collection.php
tests/extensions/test.extension.manager.paymenttest/info.xml
tests/extensions/test.extension.manager.paymenttest/main.php
tests/phpunit/CRM/Extension/Container/CollectionTest.php
tests/phpunit/CRM/Extension/Manager/ModuleTest.php
tests/phpunit/CRM/Extension/Manager/PaymentTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index 41b1bbb911601ab3b92d0a7e79860dfa826d2077..07ce478dcdcc59d0543804db343649e9e0163d60 100644 (file)
@@ -155,7 +155,7 @@ class CRM_Extension_Container_Collection implements CRM_Extension_Container_Inte
     if ($this->cache) {
       $k2c = $this->cache->get($this->cacheKey);
     }
-    if (!is_array($k2c)) {
+    if (!isset($k2c) || !is_array($k2c)) {
       $k2c = array();
       $containerNames = array_reverse(array_keys($this->containers));
       foreach ($containerNames as $name) {
index 2782446752d09b49247e997425a58f821d88f145..9e91db0e187b606c112950ccaead63c889487619 100644 (file)
@@ -1,6 +1,7 @@
 <extension key='test.extension.manager.paymenttest' type='payment'>
   <file>main</file>
   <name>test_extension_manager_paymenttest</name>
+  <description>Sample Payment extension</description>
   <typeInfo>
     <userNameLabel>username</userNameLabel>
     <passwordLabel>password</passwordLabel>
@@ -18,4 +19,4 @@
     <isRecur>0</isRecur>
     <paymentType>1</paymentType>
   </typeInfo>
-</extension>
\ No newline at end of file
+</extension>
index 98d817ac8e82dcb27494aad7be4edb5b8778a385..e28abf9c707181bc564c6120b8d0aca87356e180 100644 (file)
@@ -8,18 +8,22 @@ class test_extension_manager_paymenttest extends CRM_Core_Payment {
   static $counts = array();
 
   public function install() {
+    self::$counts['install'] = isset(self::$counts['install']) ? self::$counts['install'] : 0;
     self::$counts['install'] = 1 + (int) self::$counts['install'];
   }
 
   public function uninstall() {
+    self::$counts['uninstall'] = isset(self::$counts['uninstall']) ? self::$counts['uninstall'] : 0;
     self::$counts['uninstall'] = 1 + (int) self::$counts['uninstall'];
   }
 
   public function disable() {
+    self::$counts['disable'] = isset(self::$counts['disable']) ? self::$counts['disable'] : 0;
     self::$counts['disable'] = 1 + (int) self::$counts['disable'];
   }
 
   public function enable() {
+    self::$counts['enable'] = isset(self::$counts['enable']) ? self::$counts['enable'] : 0;
     self::$counts['enable'] = 1 + (int) self::$counts['enable'];
   }
 
index 4952a8dc1c35d51c7a98a451adc8566552e61579..691514c6d74e162a08ce8e35c137f06242d30888 100644 (file)
@@ -30,10 +30,6 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  * Class CRM_Extension_Container_CollectionTest
  */
 class CRM_Extension_Container_CollectionTest extends CiviUnitTestCase {
-  //@todo make BAO enotice compliant  & remove the line below
-  // WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
-  // new test classes should be compliant.
-  public $_eNoticeCompliant = FALSE;
 
   public function setUp() {
     parent::setUp();
index 4d91b058be3ece054de5cf235bab26c02fedf9a2..c8341b9be097866851ad58a259e6dab82458df7c 100644 (file)
@@ -6,10 +6,6 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  * Class CRM_Extension_Manager_ModuleTest
  */
 class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase {
-  //@todo make BAO enotice compliant  & remove the line below
-  // WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
-  // new test classes should be compliant.
-  public $_eNoticeCompliant = FALSE;
 
   public function setUp() {
     parent::setUp();
@@ -283,6 +279,9 @@ class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase {
    */
   public static function incHookCount($module, $name) {
     global $_test_extension_manager_moduletest_counts;
+    if (!isset($_test_extension_manager_moduletest_counts[$module][$name])) {
+      $_test_extension_manager_moduletest_counts[$module][$name] = 0;
+    }
     $_test_extension_manager_moduletest_counts[$module][$name] = 1 + (int) $_test_extension_manager_moduletest_counts[$module][$name];
   }
 
index acfeaad944fa0b4b9176d54307388f3cf78e955a..eb65b99feb1d675c7daa632f4e6d1c65eae47248 100644 (file)
@@ -30,10 +30,6 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  * Class CRM_Extension_Manager_PaymentTest
  */
 class CRM_Extension_Manager_PaymentTest extends CiviUnitTestCase {
-  //@todo make BAO enotice compliant  & remove the line below
-  // WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
-  // new test classes should be compliant.
-  public $_eNoticeCompliant = FALSE;
 
   public function setUp() {
     parent::setUp();
index fb3e4aa72fda81751b5a7084e2fb22d5783f6c06..a8a830ad486120df7346221114b8f14682fdd17c 100755 (executable)
@@ -118,11 +118,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    */
   public static $populateOnce = FALSE;
 
-  /**
-   * Allow classes to state E-notice compliance
-   */
-  public $_eNoticeCompliant = TRUE;
-
   /**
    * @var boolean DBResetRequired allows skipping DB reset
    *               in specific test case. If you still need
@@ -433,12 +428,8 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     //flush component settings
     CRM_Core_Component::getEnabledComponents(TRUE);
 
-    if ($this->_eNoticeCompliant) {
-      error_reporting(E_ALL);
-    }
-    else {
-      error_reporting(E_ALL & ~E_NOTICE);
-    }
+    error_reporting(E_ALL);
+
     $this->_sethtmlGlobals();
   }