aboutsummaryrefslogtreecommitdiff
path: root/engine/tests
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tests')
-rw-r--r--engine/tests/api/entity_getter_functions.php51
-rw-r--r--engine/tests/api/helpers.php4
-rw-r--r--engine/tests/objects/entities.php2
-rw-r--r--engine/tests/services/api.php8
4 files changed, 33 insertions, 32 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);
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index ca3abb274..c04bc60ff 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -107,7 +107,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
// set and check temp annotation
$this->assertTrue($this->entity->annotate('non_existent', 'testing'));
- $this->assertIdentical($this->entity->getAnnotations('non_existent'), 'testing');
+ $this->assertIdentical($this->entity->getAnnotations('non_existent'), array('testing'));
$this->assertTrue(array_key_exists('non_existent', $this->entity->expose_annotations()));
// save entity and check for annotation
diff --git a/engine/tests/services/api.php b/engine/tests/services/api.php
index 39951da1c..3d07c0bbb 100644
--- a/engine/tests/services/api.php
+++ b/engine/tests/services/api.php
@@ -19,7 +19,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest {
// expose_function
public function testExposeFunctionNoMethod() {
try {
- expose_function();
+ @expose_function();
$this->assertTrue(FALSE);
} catch (Exception $e) {
$this->assertIsA($e, 'InvalidParameterException');
@@ -29,7 +29,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest {
public function testExposeFunctionNoFunction() {
try {
- expose_function('test');
+ @expose_function('test');
$this->assertTrue(FALSE);
} catch (Exception $e) {
$this->assertIsA($e, 'InvalidParameterException');
@@ -39,7 +39,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest {
public function testExposeFunctionBadParameters() {
try {
- expose_function('test', 'test', 'BAD');
+ @expose_function('test', 'test', 'BAD');
$this->assertTrue(FALSE);
} catch (Exception $e) {
$this->assertIsA($e, 'InvalidParameterException');
@@ -59,7 +59,7 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest {
public function testExposeFunctionBadHttpMethod() {
try {
- expose_function('test', 'test', null, '', 'BAD');
+ @expose_function('test', 'test', null, '', 'BAD');
$this->assertTrue(FALSE);
} catch (Exception $e) {
$this->assertIsA($e, 'InvalidParameterException');