From 0c4397913c7d313dbf10e9553f46e1d6715c6963 Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 9 Apr 2011 17:08:11 +0000 Subject: Fixes #2600. Applied Hellekin's patch. Props to him for understanding what was going on because whoa. git-svn-id: http://code.elgg.org/elgg/trunk@8968 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/entity_getter_functions.php | 54 +++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'engine/tests/api/entity_getter_functions.php') diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 1633cbe19..59aa7074a 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -1341,7 +1341,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1382,6 +1382,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } function testElggApiGettersEntityMetadataNVPValidNValidVEqualsTriple() { + if ($boasdf == true) { + $awoefhaow = true; + } $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); @@ -1406,11 +1409,13 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { // make some bad ones $invalid_md_name = 'test_metadata_name_' . rand(); + $invalid_md_name2 = 'test_metadata_name_' . rand(); + $invalid_md_name3 = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; - $e->$md_name3 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$invalid_md_name2 = $md_value2; + $e->$invalid_md_name3 = $md_value3; $e->save(); $guids[] = $e->getGUID(); @@ -1483,10 +1488,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { // make some bad ones $invalid_md_name = 'test_metadata_name_' . rand(); + $invalid_md_name2 = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$invalid_md_name2 = $md_value2; $e->save(); $guids[] = $e->getGUID(); @@ -1572,11 +1578,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; - $e->$md_name2 = $invalid_md_value; - $e->$md_name3 = $invalid_md_value; - $e->$md_name4 = $invalid_md_value; - $e->$md_name5 = $invalid_md_value; + $e->$invalid_md_name = $md_value; + $e->$md_name2 = $md_value2; + $e->$md_name3 = $md_value3; + $e->$md_name4 = $md_value4; + $e->$md_name5 = $md_value5; $e->save(); $guids[] = $e->getGUID(); @@ -1649,7 +1655,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1694,7 +1700,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1758,7 +1764,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1836,7 +1842,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $invalid_md_name = 'test_metadata_name_' . rand(); $e = new ElggObject(); $e->subtype = $subtype; - $e->$md_name = $invalid_md_value; + $e->$invalid_md_name = $md_value; $e->save(); $guids[] = $e->getGUID(); @@ -1888,33 +1894,32 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); - $md_value = 2; $guids = array(); $valid_guids = array(); // our targets $valid = new ElggObject(); $valid->subtype = $subtype; - $valid->$md_name = $md_value; + $valid->$md_name = 1; $valid->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid->getGUID(); $valid2 = new ElggObject(); $valid2->subtype = $subtype; - $valid2->$md_name = 3; + $valid2->$md_name = 2; $valid2->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid2->getGUID(); $valid3 = new ElggObject(); $valid3->subtype = $subtype; - $valid3->$md_name = 1; + $valid3->$md_name = 3; $valid3->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid3->getGUID(); - $md_valid_values = array($md_value, $md_value2); + $md_valid_values = array(1, 2, 3); $options = array( 'type' => 'object', @@ -1947,33 +1952,32 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); - $md_value = 'b'; $guids = array(); $valid_guids = array(); // our targets $valid = new ElggObject(); $valid->subtype = $subtype; - $valid->$md_name = $md_value; + $valid->$md_name = 'a'; $valid->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid->getGUID(); $valid2 = new ElggObject(); $valid2->subtype = $subtype; - $valid2->$md_name = 'c'; + $valid2->$md_name = 'b'; $valid2->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid2->getGUID(); $valid3 = new ElggObject(); $valid3->subtype = $subtype; - $valid3->$md_name = 'a'; + $valid3->$md_name = 'c'; $valid3->save(); $guids[] = $valid->getGUID(); $valid_guids[] = $valid3->getGUID(); - $md_valid_values = array($md_value, $md_value2); + $md_valid_values = array('a', 'b', 'c'); $options = array( 'type' => 'object', -- cgit v1.2.3 From 30a1df9bcf1ac12a8aec0f307f53f8eb6d105809 Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 9 Apr 2011 17:34:16 +0000 Subject: Refs #2600. Removed the very special debug vars that I told myself "Make sure you remove those before you commit or you'll look like an idiot" when I added. *ahem* git-svn-id: http://code.elgg.org/elgg/trunk@8970 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/api/entity_getter_functions.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'engine/tests/api/entity_getter_functions.php') diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 59aa7074a..aef7a991e 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -1382,9 +1382,6 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } function testElggApiGettersEntityMetadataNVPValidNValidVEqualsTriple() { - if ($boasdf == true) { - $awoefhaow = true; - } $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); -- cgit v1.2.3