aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tests/api')
-rw-r--r--engine/tests/api/access_collections.php10
-rw-r--r--engine/tests/api/entity_getter_functions.php11
-rw-r--r--engine/tests/api/helpers.php25
-rw-r--r--engine/tests/api/metadata.php9
-rw-r--r--engine/tests/api/plugins.php33
5 files changed, 44 insertions, 44 deletions
diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php
index 1e61c45bb..0c37fa779 100644
--- a/engine/tests/api/access_collections.php
+++ b/engine/tests/api/access_collections.php
@@ -194,7 +194,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
return $value;
}
- register_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_register_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
// enable security since we usually run as admin
$ia = elgg_set_ignore_access(false);
@@ -202,14 +202,16 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
$this->assertTrue($result);
$ia = elgg_set_ignore_access($ia);
- unregister_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook');
+ elgg_unregister_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
+
+ delete_access_collection($acl_id);
}
// groups interface
// only runs if the groups plugin is enabled because implementation is split between
// core and the plugin.
public function testCreateDeleteGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
@@ -231,7 +233,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest {
}
public function testJoinLeaveGroupACL() {
- if (!is_plugin_enabled('groups')) {
+ if (!elgg_is_active_plugin('groups')) {
return;
}
diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php
index aef7a991e..e7906d3c8 100644
--- a/engine/tests/api/entity_getter_functions.php
+++ b/engine/tests/api/entity_getter_functions.php
@@ -855,7 +855,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
public function testElggApiGettersEntityNoSubtype() {
// create an entity we can later delete.
- // order by time created and limit by 1 should == this entity.
+ // order by guid and limit by 1 should == this entity.
$e = new ElggObject();
$e->save();
@@ -2789,4 +2789,13 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
$this->assertEqual($a_e_map[$a->id], $a->owner_guid);
}
}
+
+ public function testElggGetEntitiesBadWheres() {
+ $options = array(
+ 'container_guid' => 'abc'
+ );
+
+ $entities = elgg_get_entities($options);
+ $this->assertFalse($entities);
+ }
}
diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php
index ee2e64cfe..f48f91faf 100644
--- a/engine/tests/api/helpers.php
+++ b/engine/tests/api/helpers.php
@@ -63,6 +63,8 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(elgg_instanceof($bad_entity));
$this->assertFalse(elgg_instanceof($bad_entity, 'object'));
$this->assertFalse(elgg_instanceof($bad_entity, 'object', 'test_subtype'));
+
+ remove_subtype('object', 'test_subtype');
}
/**
@@ -72,7 +74,13 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$conversions = array(
'http://example.com' => 'http://example.com',
'https://example.com' => 'https://example.com',
+ 'http://example-time.com' => 'http://example-time.com',
+
'//example.com' => '//example.com',
+ 'ftp://example.com/file' => 'ftp://example.com/file',
+ 'mailto:brett@elgg.org' => 'mailto:brett@elgg.org',
+ 'javascript:alert("test")' => 'javascript:alert("test")',
+ 'app://endpoint' => 'app://endpoint',
'example.com' => 'http://example.com',
'example.com/subpage' => 'http://example.com/subpage',
@@ -166,7 +174,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id1']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id1');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id1');
+ }
}
$result = elgg_unregister_js('id1');
@@ -180,7 +190,9 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertFalse(isset($CONFIG->externals_map['js']['id2']));
foreach ($elements as $element) {
- $this->assertFalse($element->name == 'id2');
+ if (isset($element->name)) {
+ $this->assertFalse($element->name == 'id2');
+ }
}
$this->assertTrue(isset($CONFIG->externals_map['js']['id3']));
@@ -204,7 +216,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
$this->assertTrue($result);
$js_urls = elgg_get_loaded_js('footer');
- $this->assertIdentical(array('http://test1.com'), $js_urls);
+ $this->assertIdentical(array(500 => 'http://test1.com'), $js_urls);
}
/**
@@ -227,9 +239,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest {
}
$js_urls = elgg_get_loaded_js('head');
- $this->assertIdentical($js_urls[0], $urls['id1']);
- $this->assertIdentical($js_urls[1], $urls['id2']);
- $this->assertIdentical($js_urls[2], $urls['id3']);
+
+ $this->assertIdentical($js_urls[500], $urls['id1']);
+ $this->assertIdentical($js_urls[501], $urls['id2']);
+ $this->assertIdentical($js_urls[502], $urls['id3']);
$js_urls = elgg_get_loaded_js('footer');
$this->assertIdentical(array(), $js_urls);
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index d9113b68a..7897b8d47 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -75,16 +75,9 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$this->assertIdentical($case_true, $case_false);
- // check deprecated get_entities_from_metadata() function
- $deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE);
- $this->assertIdentical($deprecated, $case_true);
-
- // check entity list
- //$this->dump(list_entities_from_metadata('metaUnitTest', 'Tested', '', '', 0, 10, TRUE, TRUE, TRUE, FALSE));
-
// clean up
- $this->delete_metastrings();
$this->object->delete();
+ $this->delete_metastrings();
}
public function testElggGetMetadataCount() {
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 00b0d4513..a0faaff0e 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -68,8 +68,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'blurb' => 'A concise description.',
'description' => 'A longer, more interesting description.',
'website' => 'http://www.elgg.org/',
- 'copyright' => '(C) Elgg 2010',
- 'license' => 'GNU Public License version 2',
+ 'copyright' => '(C) Elgg Foundation 2011',
+ 'license' => 'GNU General Public License version 2',
'requires' => array(
array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'),
@@ -105,7 +105,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0),
),
- 'admin_interface' => 'simple',
'activate_on_install' => true
);
@@ -118,8 +117,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'version' => '1.0',
'description' => 'A 1.7-style manifest.',
'website' => 'http://www.elgg.org/',
- 'copyright' => '(C) Elgg 2010',
- 'license' => 'GNU Public License version 2',
+ 'copyright' => '(C) Elgg Foundation 2011',
+ 'license' => 'GNU General Public License version 2',
'elgg_version' => '2009030702',
'name' => 'Plugin Test 17',
);
@@ -166,13 +165,13 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
}
public function testElggPluginManifestGetCopyright() {
- $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010');
- $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010');
+ $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');
+ $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');
}
public function testElggPluginManifestGetLicense() {
- $this->assertEqual($this->manifest18->getLicense(), 'GNU Public License version 2');
- $this->assertEqual($this->manifest17->getLicense(), 'GNU Public License version 2');
+ $this->assertEqual($this->manifest18->getLicense(), 'GNU General Public License version 2');
+ $this->assertEqual($this->manifest17->getLicense(), 'GNU General Public License version 2');
}
@@ -215,18 +214,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->package17->getManifest()->getDescription(), 'A 1.7-style manifest.');
}
- public function testElggPluginManifestGetDescriptionTranslated() {
- $en = array(
- $this->package18->getManifest()->getDescription() => 'A translated 1.8 description!',
- $this->package17->getManifest()->getDescription() => 'A translated 1.7 description!',
- );
-
- add_translation('en', $en);
-
- $this->assertEqual($this->package18->getManifest()->getDescription(), 'A translated 1.8 description!');
- $this->assertEqual($this->package17->getManifest()->getDescription(), 'A translated 1.7 description!');
- }
-
public function testElggPluginManifestGetCategories() {
$categories = array(
'Admin', 'ServiceAPI'
@@ -277,10 +264,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->manifest17->getConflicts(), array());
}
- public function testElggPluginManifestGetAdminInterface() {
- $this->assertEqual($this->manifest18->getAdminInterface(), 'simple');
- }
-
public function testElggPluginManifestGetActivateOnInstall() {
$this->assertEqual($this->manifest18->getActivateOnInstall(), true);
}