diff options
author | cash <cash.costello@gmail.com> | 2012-01-04 20:23:40 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2012-01-04 20:23:40 -0500 |
commit | bf372723d5e83e7a1d00d2330c67cb33c0d40c2c (patch) | |
tree | 4fbc74e1e334c2eeacf5ad66df46b073d0e709fb /engine/tests/objects | |
parent | 24a369c78df14469097dd440bba3cee087a39e7b (diff) | |
parent | b914774cdf2eabe217c61c9c39805c68af858d98 (diff) | |
download | elgg-bf372723d5e83e7a1d00d2330c67cb33c0d40c2c.tar.gz elgg-bf372723d5e83e7a1d00d2330c67cb33c0d40c2c.tar.bz2 |
Merge pull request #136 from sembrestels:endisable2
Diffstat (limited to 'engine/tests/objects')
-rw-r--r-- | engine/tests/objects/entities.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index 1772f7c1a..a4dc7946c 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -226,6 +226,39 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->assertTrue($this->entity->delete()); } + public function testElggEntityRecursiveDisableAndEnable() { + global $CONFIG; + + $this->save_entity(); + $obj1 = new ElggObject(); + $obj1->container_guid = $this->entity->getGUID(); + $obj1->save(); + $obj2 = new ElggObject(); + $obj2->container_guid = $this->entity->getGUID(); + $obj2->save(); + + // disable $obj2 before disabling the container + $this->assertTrue($obj2->disable()); + + // disable entities container by $this->entity + $this->assertTrue($this->entity->disable()); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'"); + $this->assertIdentical($entity->enabled, 'no'); + + // enable entities that were disabled with the container (but not $obj2) + $this->assertTrue($this->entity->enable()); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'"); + $this->assertIdentical($entity->enabled, 'yes'); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj2->guid}'"); + $this->assertIdentical($entity->enabled, 'no'); + + // cleanup + $this->assertTrue($obj2->enable()); + $this->assertTrue($obj2->delete()); + $this->assertTrue($obj1->delete()); + $this->assertTrue($this->entity->delete()); + } + public function testElggEntityMetadata() { // let's delete a non-existent metadata $this->assertFalse($this->entity->deleteMetadata('important')); |