diff options
Diffstat (limited to 'engine/tests/api')
-rw-r--r-- | engine/tests/api/entity_getter_functions.php | 51 | ||||
-rw-r--r-- | engine/tests/api/helpers.php | 4 |
2 files changed, 28 insertions, 27 deletions
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 1633cbe19..aef7a991e 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(); @@ -1406,11 +1406,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 +1485,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 +1575,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 +1652,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 +1697,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 +1761,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 +1839,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 +1891,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 +1949,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', diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index 1362b3c9d..461627547 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -109,7 +109,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertIdentical('http://test1.com', $CONFIG->externals['js']['key']->url); // send a bad url - $result = elgg_register_js(); + $result = @elgg_register_js('bad'); $this->assertFalse($result); } @@ -140,7 +140,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $result = elgg_unregister_js('id1'); $this->assertTrue($result); - $this->assertNULL($CONFIG->externals['js']['head']['id1']); + @$this->assertNULL($CONFIG->externals['js']['head']['id1']); $result = elgg_unregister_js('id1'); $this->assertFalse($result); |