aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tests/api')
-rw-r--r--engine/tests/api/metadata.php21
-rw-r--r--engine/tests/api/plugins.php18
2 files changed, 28 insertions, 11 deletions
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index 2461e975e..9933263d1 100644
--- a/engine/tests/api/metadata.php
+++ b/engine/tests/api/metadata.php
@@ -28,6 +28,9 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
public function testGetMetastringById() {
foreach (array('metaUnitTest', 'metaunittest', 'METAUNITTEST') as $string) {
+ // since there is no guarantee that metastrings are garbage collected
+ // between unit test runs, we delete before testing
+ $this->delete_metastrings($string);
$this->create_metastring($string);
}
@@ -43,9 +46,6 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
{
$this->assertTrue(in_array($string, $this->metastrings));
}
-
- // clean up
- $this->delete_metastrings();
}
public function testElggGetEntitiesFromMetadata() {
@@ -77,7 +77,6 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
// clean up
$this->object->delete();
- $this->delete_metastrings();
}
public function testElggGetMetadataCount() {
@@ -198,20 +197,20 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$u2->delete();
}
-
- protected function create_metastring($string) {
+ protected function delete_metastrings($string) {
global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
- mysql_query("INSERT INTO {$CONFIG->dbprefix}metastrings (string) VALUES ('$string')");
- $this->metastrings[$string] = mysql_insert_id();
+ $string = sanitise_string($string);
+ mysql_query("DELETE FROM {$CONFIG->dbprefix}metastrings WHERE string = BINARY '$string'");
}
- protected function delete_metastrings() {
+ protected function create_metastring($string) {
global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
- $strings = implode(', ', $this->metastrings);
- mysql_query("DELETE FROM {$CONFIG->dbprefix}metastrings WHERE id IN ($strings)");
+ $string = sanitise_string($string);
+ mysql_query("INSERT INTO {$CONFIG->dbprefix}metastrings (string) VALUES ('$string')");
+ $this->metastrings[$string] = mysql_insert_id();
}
}
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 8ecb0a46c..114f3991b 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -68,6 +68,9 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'blurb' => 'A concise description.',
'description' => 'A longer, more interesting description.',
'website' => 'http://www.elgg.org/',
+ 'repository' => 'https://github.com/Elgg/Elgg',
+ 'bugtracker' => 'http://trac.elgg.org',
+ 'donations' => 'http://elgg.org/supporter.php',
'copyright' => '(C) Elgg Foundation 2011',
'license' => 'GNU General Public License version 2',
@@ -164,6 +167,21 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->manifest18->getWebsite(), 'http://www.elgg.org/');
$this->assertEqual($this->manifest17->getWebsite(), 'http://www.elgg.org/');
}
+
+ public function testElggPluginManifestGetRepository() {
+ $this->assertEqual($this->manifest18->getRepositoryURL(), 'https://github.com/Elgg/Elgg');
+ $this->assertEqual($this->manifest17->getRepositoryURL(), '');
+ }
+
+ public function testElggPluginManifestGetBugtracker() {
+ $this->assertEqual($this->manifest18->getBugTrackerURL(), 'http://trac.elgg.org');
+ $this->assertEqual($this->manifest17->getBugTrackerURL(), '');
+ }
+
+ public function testElggPluginManifestGetDonationsPage() {
+ $this->assertEqual($this->manifest18->getDonationsPageURL(), 'http://elgg.org/supporter.php');
+ $this->assertEqual($this->manifest17->getDonationsPageURL(), '');
+ }
public function testElggPluginManifestGetCopyright() {
$this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');