aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/objects/entities.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-13 23:53:30 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-13 23:53:30 +0000
commit5a955c633c1ac314ccff3fe5a719ae730105c13a (patch)
tree5fd79ac23c0a6e68172b68e690de23268b03f147 /engine/tests/objects/entities.php
parent36905b66bbffb985bf3756595d83ff7050cef583 (diff)
downloadelgg-5a955c633c1ac314ccff3fe5a719ae730105c13a.tar.gz
elgg-5a955c633c1ac314ccff3fe5a719ae730105c13a.tar.bz2
Deprecated ElggEntity->clearMetadata() by ElggEntity->deleteMetadata(). Disabling entities now disables their annotations and metadata. Enabling entities enables annotations and metadata. Fixes #1115.
git-svn-id: http://code.elgg.org/elgg/trunk@8213 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/objects/entities.php')
-rw-r--r--engine/tests/objects/entities.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index 67dd02596..824b47a8a 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -186,19 +186,42 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// ensure enabled
$this->assertTrue($this->entity->isEnabled());
- // false on disable
+ // false on disable because it's not saved yet.
$this->assertFalse($this->entity->disable());
// save and disable
$this->save_entity();
+
+ // add annotations and metadata to check if they're disabled.
+ $annotation_id = create_annotation($this->entity->guid, 'test_annotation_' . rand(), 'test_value_' . rand());
+ $metadata_id = create_metadata($this->entity->guid, 'test_metadata_' . rand(), 'test_value_' . rand());
+
$this->assertTrue($this->entity->disable());
// ensure disabled by comparing directly with database
$entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$this->entity->guid}'");
$this->assertIdentical($entity->enabled, 'no');
+ $annotation = get_data_row("SELECT * FROM {$CONFIG->dbprefix}annotations WHERE id = '$annotation_id'");
+ $this->assertIdentical($annotation->enabled, 'no');
+
+ $metadata = get_data_row("SELECT * FROM {$CONFIG->dbprefix}metadata WHERE id = '$metadata_id'");
+ $this->assertIdentical($metadata->enabled, 'no');
+
// re-enable for deletion to work
$this->assertTrue($this->entity->enable());
+
+ // check enabled
+ // check annotations and metadata enabled.
+ $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$this->entity->guid}'");
+ $this->assertIdentical($entity->enabled, 'yes');
+
+ $annotation = get_data_row("SELECT * FROM {$CONFIG->dbprefix}annotations WHERE id = '$annotation_id'");
+ $this->assertIdentical($annotation->enabled, 'yes');
+
+ $metadata = get_data_row("SELECT * FROM {$CONFIG->dbprefix}metadata WHERE id = '$metadata_id'");
+ $this->assertIdentical($metadata->enabled, 'yes');
+
$this->assertTrue($this->entity->delete());
}