summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-12-06 16:14:26 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-12-06 16:14:26 +0000
commitcf1965957c48b1c88a3913f8167688d03d191cec (patch)
tree9da9e719c68f4428771c9b70389b93f7a1bafd26 /modules/gallery/tests
parent1659e487a26ef0460926376b7b8b40aaba0c0577 (diff)
parentc3ef8921260db8e39b6d2a7b4708e3d19f35f8b5 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/Item_Model_Test.php23
-rw-r--r--modules/gallery/tests/Var_Test.php38
-rw-r--r--modules/gallery/tests/selenium/Add_Album.html52
-rw-r--r--modules/gallery/tests/selenium/Add_Comment.html52
-rw-r--r--modules/gallery/tests/selenium/Add_Item.html62
-rw-r--r--modules/gallery/tests/selenium/Login.html47
6 files changed, 45 insertions, 229 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index 90c54e3c..264a2128 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -406,6 +406,29 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
return; // pass
}
$this->assert_true(false, "Shouldn't get here");
+ }
+
+ public function urls_test() {
+ $photo = test::random_photo();
+ $this->assert_true(
+ preg_match("|http://./var/resizes/name_\d+\.jpg\?m=\d+|", $photo->resize_url()),
+ $photo->resize_url() . " is malformed");
+ $this->assert_true(
+ preg_match("|http://./var/thumbs/name_\d+\.jpg\?m=\d+|", $photo->thumb_url()),
+ $photo->thumb_url() . " is malformed");
+ $this->assert_true(
+ preg_match("|http://./var/albums/name_\d+\.jpg\?m=\d+|", $photo->file_url()),
+ $photo->file_url() . " is malformed");
+ // Albums have special thumbnails. Empty album has cachebuster of 0 since it has no thumbnail
+ $album = test::random_album();
+ $this->assert_true(
+ preg_match("|http://./var/thumbs/name_\d+/\.album\.jpg\?m=0|", $album->thumb_url()),
+ $album->thumb_url() . " is malformed");
+
+ $photo = test::random_photo($album);
+ $this->assert_true(
+ preg_match("|http://./var/thumbs/name_\d+/\.album\.jpg\?m=\d+|", $album->thumb_url()),
+ $album->thumb_url() . " is malformed");
}
}
diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php
index b3492c71..292fe2f1 100644
--- a/modules/gallery/tests/Var_Test.php
+++ b/modules/gallery/tests/Var_Test.php
@@ -19,31 +19,37 @@
*/
class Var_Test extends Gallery_Unit_Test_Case {
public function add_parameter_test() {
- module::set_var("gallery", "Parameter", "original value");
- $this->assert_equal("original value", module::get_var("gallery", "Parameter"));
+ module::set_var("Var_Test", "Parameter", "original value");
+ $this->assert_equal("original value", module::get_var("Var_Test", "Parameter"));
- module::set_var("gallery", "Parameter", "updated value");
- $this->assert_equal("updated value", module::get_var("gallery", "Parameter"));
+ module::set_var("Var_Test", "Parameter", "updated value");
+ $this->assert_equal("updated value", module::get_var("Var_Test", "Parameter"));
}
public function clear_parameter_test() {
- module::set_var("gallery", "Parameter", "original value");
- $this->assert_equal("original value", module::get_var("gallery", "Parameter"));
+ module::set_var("Var_Test", "Parameter", "original value");
+ module::clear_var("Var_Test", "Parameter");
+ $this->assert_equal(null, module::get_var("Var_Test", "Parameter"));
+ }
- module::clear_var("gallery", "Parameter");
- $this->assert_equal(null, module::get_var("gallery", "Parameter"));
+ public function clear_all_module_parameters_test() {
+ module::set_var("Var_Test", "Parameter1", "original value");
+ module::set_var("Var_Test", "Parameter2", "original value");
+ module::clear_all_vars("Var_Test");
+ $this->assert_equal(null, module::get_var("Var_Test", "Parameter1"));
+ $this->assert_equal(null, module::get_var("Var_Test", "Parameter2"));
}
public function incr_parameter_test() {
- module::set_var("gallery", "Parameter", "original value");
- module::incr_var("gallery", "Parameter");
- $this->assert_equal("1", module::get_var("gallery", "Parameter"));
+ module::set_var("Var_Test", "Parameter", "original value");
+ module::incr_var("Var_Test", "Parameter");
+ $this->assert_equal("1", module::get_var("Var_Test", "Parameter"));
- module::set_var("gallery", "Parameter", "2");
- module::incr_var("gallery", "Parameter", "9");
- $this->assert_equal("11", module::get_var("gallery", "Parameter"));
+ module::set_var("Var_Test", "Parameter", "2");
+ module::incr_var("Var_Test", "Parameter", "9");
+ $this->assert_equal("11", module::get_var("Var_Test", "Parameter"));
- module::incr_var("gallery", "NonExistent", "9");
- $this->assert_equal(null, module::get_var("gallery", "NonExistent"));
+ module::incr_var("Var_Test", "NonExistent", "9");
+ $this->assert_equal(null, module::get_var("Var_Test", "NonExistent"));
}
} \ No newline at end of file
diff --git a/modules/gallery/tests/selenium/Add_Album.html b/modules/gallery/tests/selenium/Add_Album.html
deleted file mode 100644
index ccd4d0b7..00000000
--- a/modules/gallery/tests/selenium/Add_Album.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>AddAlbum</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">AddAlbum</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/index.php/albums/1</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=Add album</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name</td>
- <td>seleniumtest</td>
-</tr>
-<tr>
- <td>type</td>
- <td>title</td>
- <td>Selenium Test Album</td>
-</tr>
-<tr>
- <td>type</td>
- <td>description</td>
- <td>Test</td>
-</tr>
-<tr>
- <td>click</td>
- <td>//button[@type='button']</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>Selenium Test Album</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/modules/gallery/tests/selenium/Add_Comment.html b/modules/gallery/tests/selenium/Add_Comment.html
deleted file mode 100644
index 054e7597..00000000
--- a/modules/gallery/tests/selenium/Add_Comment.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>Add comment</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">Add comment</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/index.php/albums/1</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>g-photo-id-2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>g-author</td>
- <td>Test</td>
-</tr>
-<tr>
- <td>type</td>
- <td>g-email</td>
- <td>test@gmail.com</td>
-</tr>
-<tr>
- <td>type</td>
- <td>g-text</td>
- <td>This is a selenium test comment.</td>
-</tr>
-<tr>
- <td>click</td>
- <td>//button[@type='submit']</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>This is a selenium test comment.</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/modules/gallery/tests/selenium/Add_Item.html b/modules/gallery/tests/selenium/Add_Item.html
deleted file mode 100644
index 741dff65..00000000
--- a/modules/gallery/tests/selenium/Add_Item.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>AddItem</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">AddItem</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/index.php/albums/1</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=Add an item</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name</td>
- <td>seleniumitem.jpg</td>
-</tr>
-<tr>
- <td>type</td>
- <td>title</td>
- <td>Selenium Item</td>
-</tr>
-<tr>
- <td>type</td>
- <td>description</td>
- <td>Test item</td>
-</tr>
-<tr>
- <td>type</td>
- <td>file</td>
- <td>/Users/ckieffer/Sites/gallery3.0/core/tests/images/DSC_0003.jpg</td>
-</tr>
-<tr>
- <td>click</td>
- <td>//button[@type='button']</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=X</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextPresent</td>
- <td>Selenium Item</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/modules/gallery/tests/selenium/Login.html b/modules/gallery/tests/selenium/Login.html
deleted file mode 100644
index d2e45c63..00000000
--- a/modules/gallery/tests/selenium/Login.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>Login</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">Login</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/index.php/albums/1</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>g-login-link</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>g-name</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>g-password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>//button[@type='button']</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>g-user-profile-link</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>