aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-18 23:14:57 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-18 23:14:57 +0000
commit2c760856db924868e8fdaac4e3442bbfeb073c1c (patch)
tree7499cff51f54c5d7dad8776aa9122a493e0ee55c /engine
parentba94a48ff66a001dd20c5ac2da34681880583945 (diff)
downloadelgg-2c760856db924868e8fdaac4e3442bbfeb073c1c.tar.gz
elgg-2c760856db924868e8fdaac4e3442bbfeb073c1c.tar.bz2
Getter API test: Moved the setup and tear down into the construct and destruct methods. Fixed a few new tests that were failing because of sorting by time.
git-svn-id: http://code.elgg.org/elgg/trunk@3948 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/tests/api/entity_getter_functions.php39
1 files changed, 23 insertions, 16 deletions
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php
index c4706d3df..aa7442d4b 100644
--- a/engine/tests/api/entity_getter_functions.php
+++ b/engine/tests/api/entity_getter_functions.php
@@ -12,14 +12,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
* Called before each test object.
*/
public function __construct() {
- parent::__construct();
- }
-
- /**
- * Called after each test method.
- */
- public function setUp() {
- elgg_set_ignore_access(TRUE);
+ elgg_set_ignore_access(TRUE);
$this->entities = array();
$this->subtypes = array(
'object' => array(),
@@ -62,12 +55,28 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$this->entities[] = $e;
$this->subtypes['group'][] = $subtype;
}
+
+ parent::__construct();
+ }
+
+ /**
+ * Called after each test method.
+ */
+ public function setUp() {
+ return TRUE;
}
/**
* Called after each test method.
*/
public function tearDown() {
+ return TRUE;
+ }
+
+ /**
+ * Called after each test object.
+ */
+ public function __destruct() {
global $CONFIG;
$this->swallowErrors();
@@ -87,12 +96,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$subtype_str = implode(',', $subtype_arr);
$q = "DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE subtype IN ($subtype_str)";
delete_data($q);
- }
- /**
- * Called after each test object.
- */
- public function __destruct() {
parent::__destruct();
}
@@ -866,7 +870,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$options = array(
'type' => 'object',
- 'subtype' => ELGG_ENTITY_NO_VALUE,
+ 'subtype' => ELGG_ENTITIES_NO_VALUE,
'limit' => 1,
'order_by' => 'e.time_created desc'
);
@@ -892,8 +896,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$subtype = 'subtype_' . rand();
+ $e_subtype = new ElggObject();
+ $e_subtype->subtype = $subtype;
+ $e_subtype->save();
+
$e = new ElggObject();
- $e->subtype = $subtype;
$e->save();
$options = array(
@@ -913,10 +920,10 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
// this entity should NOT be the entity we just created
// and should have no subtype
foreach ($entities as $entity) {
- $this->assertNotEqual($e->getGUID(), $entity->getGUID());
$this->assertEqual($entity->subtype_id, 0);
}
+ $e_subtype->delete();
$e->delete();
$q = "DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE subtype = '$subtype'";