]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Swallowing all Elgg notices within unit tests.
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 13 Oct 2009 23:12:13 +0000 (23:12 +0000)
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 13 Oct 2009 23:12:13 +0000 (23:12 +0000)
By default, SimpleTest converts PHP errors into exceptions. This is restricted by adding a call to swallowErrors() within the tearDown() methods. This has also been noted within the unit test skeleton.

git-svn-id: http://code.elgg.org/elgg/trunk@3535 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/tests/objects/entities.php
engine/tests/objects/objects.php
engine/tests/test_skeleton.php

index 0827fa24a731dba328994f5c57e43c0224426293..336e2f30d1ebffdd0735ae56b82b0826571f4a57 100644 (file)
@@ -19,6 +19,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
         * Called after each test method.
         */
        public function tearDown() {
+               $this->swallowErrors();
                unset($this->entity);
        }
 
index de3c2f1c4cc37efaac53756b8f5cc9fbf4562025..632ff4c38020d6261d79a6c2b9a1b38135d9ec76 100644 (file)
@@ -27,6 +27,7 @@ class ElggCoreObjectTest extends ElggCoreUnitTest {
         * Called after each test method.
         */
        public function tearDown() {
+               $this->swallowErrors();
                unset($this->entity);
        }
 
@@ -37,9 +38,6 @@ class ElggCoreObjectTest extends ElggCoreUnitTest {
                parent::__destruct();
        }
 
-       /**
-        * A basic test that will be called and fail.
-        */
        public function testElggObjectConstructor() {
                $attributes = array();
                $attributes['guid'] = '';
index 42bbd4ba593747db221555b6e0fdfbc3ff0ba91c..165ab087227676f64107511d6209b6d64b224906 100644 (file)
@@ -14,6 +14,8 @@ class ElggCoreSkeletonTest extends ElggCoreUnitTest {
         */
        public function __construct() {
                parent::__construct();
+               
+               // all code should come after here
        }
 
        /**
@@ -27,13 +29,15 @@ class ElggCoreSkeletonTest extends ElggCoreUnitTest {
         * Called after each test method.
         */
        public function tearDown() {
-
+               // do not allow SimpleTest to interpret Elgg notices as exceptions
+               $this->swallowErrors();
        }
 
        /**
         * Called after each test object.
         */
        public function __destruct() {
+               // all code should go above here
                parent::__destruct();
        }