summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-01-24 18:14:28 -0500
committerBharat Mediratta <bharat@menalto.com>2013-01-24 18:14:28 -0500
commit03535786307c60f0f79ce4f773c9c1a8e43826ed (patch)
tree5ef1329cfaea5ab43dd9d28cb8aa48c0a34e1eed /modules/gallery/tests
parent86a2759062ee3dbf93f4c17c7499e3f506035047 (diff)
parent98d09c3740f1c19e477a71bdb44791306d7bd05b (diff)
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/File_Structure_Test.php18
-rw-r--r--modules/gallery/tests/Gallery_Filters.php4
-rw-r--r--modules/gallery/tests/Item_Model_Test.php8
3 files changed, 25 insertions, 5 deletions
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 7ad865e0..ce75ea13 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -285,7 +285,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
}
public function all_public_functions_in_test_files_end_in_test() {
- // Who tests the tests? :-)
+ // Who tests the tests? :-) (ref: http://www.xkcd.com/1163)
$dir = new PhpCodeFilterIterator(
new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(
@@ -315,4 +315,20 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
}
}
}
+
+ public function no_extra_spaces_at_end_of_line_test() {
+ $dir = new GalleryCodeFilterIterator(
+ new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
+ $errors = "";
+ foreach ($dir as $file) {
+ if (preg_match("/\.(php|css|html|js)$/", $file)) {
+ foreach (file($file) as $line_num => $line) {
+ if ((substr($line, -2) == " \n") || (substr($line, -1) == " ")) {
+ $errors .= "$file at line " . ($line_num + 1) . "\n";
+ }
+ }
+ }
+ }
+ $this->assert_true(empty($errors), "Extra spaces at end of line found at:\n$errors");
+ }
}
diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php
index 83dbd53f..6c2a6aa3 100644
--- a/modules/gallery/tests/Gallery_Filters.php
+++ b/modules/gallery/tests/Gallery_Filters.php
@@ -47,6 +47,10 @@ class GalleryCodeFilterIterator extends FilterIterator {
strpos($path_name, SYSPATH) !== false ||
strpos($path_name, MODPATH . "gallery/libraries/HTMLPurifier") !== false ||
strpos($path_name, MODPATH . "gallery/vendor/joomla") !== false ||
+ strpos($path_name, MODPATH . "organize/vendor/ext") !== false ||
+ strpos($path_name, DOCROOT . "lib") !== false ||
+ strpos($path_name, DOCROOT . "themes/admin_wind/css/themeroller") !== false ||
+ strpos($path_name, DOCROOT . "themes/wind/css/themeroller") !== false ||
substr($path_name, -1, 1) == "~");
}
}
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index a7eba1ad..c45bbc3c 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -66,7 +66,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
}
public function rename_photo_test() {
- $item = test::random_photo();
+ $item = test::random_unique_photo();
$original_name = $item->name;
$thumb_file = file_get_contents($item->thumb_path());
@@ -89,7 +89,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function rename_album_test() {
$album = test::random_album();
- $photo = test::random_photo($album);
+ $photo = test::random_unique_photo($album);
$album->reload();
$thumb_file = file_get_contents($photo->thumb_path());
@@ -152,7 +152,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function move_album_test() {
$album2 = test::random_album();
$album1 = test::random_album($album2);
- $photo = test::random_photo($album1);
+ $photo = test::random_unique_photo($album1);
$thumb_file = file_get_contents($photo->thumb_path());
$resize_file = file_get_contents($photo->resize_path());
@@ -180,7 +180,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function move_photo_test() {
$album1 = test::random_album();
- $photo = test::random_photo($album1);
+ $photo = test::random_unique_photo($album1);
$album2 = test::random_album();