aboutsummaryrefslogtreecommitdiff
path: root/engine/tests
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tests')
-rw-r--r--engine/tests/api/metadata.php11
-rw-r--r--engine/tests/api/plugins.php18
-rw-r--r--engine/tests/regression/trac_bugs.php27
-rw-r--r--engine/tests/test_files/plugin_18/manifest.xml3
4 files changed, 54 insertions, 5 deletions
diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php
index 244036f80..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);
}
@@ -194,11 +197,19 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest {
$u2->delete();
}
+ protected function delete_metastrings($string) {
+ global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
+ $METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
+
+ $string = sanitise_string($string);
+ mysql_query("DELETE FROM {$CONFIG->dbprefix}metastrings WHERE string = BINARY '$string'");
+ }
protected function create_metastring($string) {
global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
+ $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');
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 26a45ab6a..691433a41 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -202,16 +202,33 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
/**
* http://trac.elgg.org/ticket/3210 - Don't remove -s in friendly titles
- * @todo: http://trac.elgg.org/ticket/2276 - improve char encoding
+ * http://trac.elgg.org/ticket/2276 - improve char encoding
*/
public function test_friendly_title() {
$cases = array(
- 'Simple Test' => 'simple-test',
- 'Test top-level page' => 'test-top-level-page',
-// 'éclair' => 'éclair',
-// 'English, Español, and 日本語' => 'english-español-and-日本語'
+ // hyphen, underscore and ASCII whitespace replaced by separator,
+ // other non-alphanumeric ASCII removed
+ "a-a_a a\na\ra\ta\va!a\"a#a\$a%a&a'a(a)a*a+a,a.a/a:a;a<a=a>a?a@a[a\\a]a^a`a{a|a}a~a"
+ => "a-a-a-a-a-a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+
+ // separators trimmed
+ "-_ hello _-" => "hello",
+
+ // accents removed, lower case, other multibyte chars are URL encoded
+ "I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n, AND \xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E"
+ // Iñtërnâtiônàlizætiøn, AND 日本語
+ => 'internationalizaetion-and-%E6%97%A5%E6%9C%AC%E8%AA%9E',
+
+ // some HTML entity replacements
+ "Me &amp; You" => 'me-and-you',
);
+ // where available, string is converted to NFC before transliteration
+ if (ElggTranslit::hasNormalizerSupport()) {
+ $form_d = "A\xCC\x8A"; // A followed by 'COMBINING RING ABOVE' (U+030A)
+ $cases[$form_d] = "a";
+ }
+
foreach ($cases as $case => $expected) {
$friendly_title = elgg_get_friendly_title($case);
$this->assertIdentical($expected, $friendly_title);
diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml
index 9654b6422..5d788616a 100644
--- a/engine/tests/test_files/plugin_18/manifest.xml
+++ b/engine/tests/test_files/plugin_18/manifest.xml
@@ -6,6 +6,9 @@
<blurb>A concise description.</blurb>
<description>A longer, more interesting description.</description>
<website>http://www.elgg.org/</website>
+ <repository>https://github.com/Elgg/Elgg</repository>
+ <bugtracker>http://trac.elgg.org</bugtracker>
+ <donations>http://elgg.org/supporter.php</donations>
<copyright>(C) Elgg Foundation 2011</copyright>
<license>GNU General Public License version 2</license>