aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/objects
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-12 23:37:29 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-12 23:37:29 +0000
commit014ba7d5c18172db7ff6940df12f0a785c9acbdb (patch)
tree36c5a1cf0c42feac25e19b3c3ab550b7fcfe9244 /engine/tests/objects
parentb95f23779af7f11a622a0e978c4a5a0917b8c76e (diff)
downloadelgg-014ba7d5c18172db7ff6940df12f0a785c9acbdb.tar.gz
elgg-014ba7d5c18172db7ff6940df12f0a785c9acbdb.tar.bz2
Updating ElggEntity::clearMetaData() to fail when passed a non-existent metadata name.
Fixes #2273 git-svn-id: http://code.elgg.org/elgg/trunk@7301 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/objects')
-rw-r--r--engine/tests/objects/entities.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index 018f7aa02..1f1f6d2b4 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -205,6 +205,29 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertTrue($this->entity->enable());
$this->assertTrue($this->entity->delete());
}
+
+ public function testElggEntityMetadata() {
+ // let's delte a non-existent metadata
+ $this->assertFalse($this->entity->clearMetaData('important'));
+
+ // let's add the meatadata
+ $this->assertTrue($this->entity->important = 'indeed!');
+ $this->assertTrue($this->entity->less_important = 'true, too!');
+ $this->save_entity();
+
+ // test deleting incorrectly: Ticket #2273
+ $this->assertFalse($this->entity->clearMetaData('impotent'));
+ $this->assertEqual($this->entity->important, 'indeed!');
+
+ // get rid of one metadata
+ $this->assertEqual($this->entity->important, 'indeed!');
+ $this->assertTrue($this->entity->clearMetaData('important'));
+ $this->assertEqual($this->entity->important, '');
+
+ // get rid of all metadata
+ $this->assertTrue($this->entity->clearMetaData());
+ $this->assertEqual($this->entity->less_important, '');
+ }
public function testElggEntityExportables() {
$exportables = array(