summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/File_Structure_Test.php9
-rw-r--r--modules/gallery/tests/Gallery_Filters.php1
-rw-r--r--modules/gallery/tests/Item_Rest_Helper_Test.php10
-rw-r--r--modules/gallery/tests/Items_Rest_Helper_Test.php18
-rw-r--r--modules/gallery/tests/controller_auth_data.txt2
-rw-r--r--modules/gallery/tests/xss_data.txt82
6 files changed, 101 insertions, 21 deletions
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 39df9f06..96e0b758 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -23,13 +23,18 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
public function no_trailing_closing_php_tag_test() {
$dir = new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
+ $count = 0;
foreach ($dir as $file) {
+ $count++;
if (!preg_match("|\.html\.php$|", $file->getPathname())) {
$this->assert_false(
preg_match('/\?\>\s*$/', file_get_contents($file)),
"{$file->getPathname()} ends in ?>");
}
}
+
+ $this->assert_true($count > 500, "We should have analyzed at least this 500 files");
+ $this->assert_true($count < 1000, "We shouldn't be shipping 1000 files!");
}
public function view_files_correct_suffix_test() {
@@ -42,8 +47,8 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
if (strpos($file, "views")) {
$this->assert_true(
- preg_match("#/views/.*?(\.html|mrss|txt)\.php$#", $file->getPathname()),
- "{$file->getPathname()} should end in .{html,mrss,txt}.php");
+ preg_match("#/views/.*?\.(html|mrss|txt|json)\.php$#", $file->getPathname()),
+ "{$file->getPathname()} should end in .{html,mrss,txt,json}.php");
}
}
}
diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php
index debbe846..052990d5 100644
--- a/modules/gallery/tests/Gallery_Filters.php
+++ b/modules/gallery/tests/Gallery_Filters.php
@@ -32,6 +32,7 @@ class GalleryCodeFilterIterator extends FilterIterator {
return !(
$file_name == "." ||
$file_name == ".." ||
+ strpos($path_name, DOCROOT . ".git") !== false ||
strpos($path_name, DOCROOT . "test") !== false ||
strpos($path_name, DOCROOT . "var") !== false ||
strpos($path_name, MODPATH . "forge") !== false ||
diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php
index 0b5e0471..a2ab534b 100644
--- a/modules/gallery/tests/Item_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Item_Rest_Helper_Test.php
@@ -43,6 +43,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
@@ -58,6 +60,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
@@ -73,6 +77,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
@@ -100,6 +106,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
@@ -123,6 +131,8 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
diff --git a/modules/gallery/tests/Items_Rest_Helper_Test.php b/modules/gallery/tests/Items_Rest_Helper_Test.php
index 17e979a5..8e53110a 100644
--- a/modules/gallery/tests/Items_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Items_Rest_Helper_Test.php
@@ -36,12 +36,16 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $photo1),
"entity" => $photo1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $photo1)),
"tags" => array(
"url" => rest::url("item_tags", $photo1),
"members" => array()))),
array("url" => rest::url("item", $album2),
"entity" => $album2->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album2)),
"tags" => array(
"url" => rest::url("item_tags", $album2),
"members" => array())),
@@ -69,6 +73,8 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album2),
"entity" => $album2->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album2)),
"tags" => array(
"url" => rest::url("item_tags", $album2),
"members" => array())),
@@ -96,6 +102,8 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $photo1),
"entity" => $photo1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $photo1)),
"tags" => array(
"url" => rest::url("item_tags", $photo1),
"members" => array())))),
@@ -121,12 +129,16 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $photo1),
"entity" => $photo1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $photo1)),
"tags" => array(
"url" => rest::url("item_tags", $photo1),
"members" => array()))),
array("url" => rest::url("item", $album2),
"entity" => $album2->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album2)),
"tags" => array(
"url" => rest::url("item_tags", $album2),
"members" => array())),
@@ -162,6 +174,8 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album1),
"entity" => $album1->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album1)),
"tags" => array(
"url" => rest::url("item_tags", $album1),
"members" => array())),
@@ -172,6 +186,8 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $album2),
"entity" => $album2->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $album2)),
"tags" => array(
"url" => rest::url("item_tags", $album2),
"members" => array())),
@@ -180,6 +196,8 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case {
array("url" => rest::url("item", $photo2),
"entity" => $photo2->as_restful_array(),
"relationships" => array(
+ "comments" => array(
+ "url" => rest::url("item_comments", $photo2)),
"tags" => array(
"url" => rest::url("item_tags", $photo2),
"members" => array())))),
diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt
index 94e7a07f..8263f79d 100644
--- a/modules/gallery/tests/controller_auth_data.txt
+++ b/modules/gallery/tests/controller_auth_data.txt
@@ -23,6 +23,8 @@ modules/gallery/controllers/user_profile.php show
modules/gallery/controllers/user_profile.php contact DIRTY_AUTH
modules/gallery/controllers/user_profile.php send DIRTY_AUTH
modules/gallery/controllers/welcome_message.php index DIRTY_AUTH
+modules/organize/controllers/organize.php dialog DIRTY_CSRF
+modules/organize/controllers/organize.php add_album_fields DIRTY_AUTH
modules/rest/controllers/rest.php index DIRTY_CSRF|DIRTY_AUTH
modules/rest/controllers/rest.php __call DIRTY_CSRF|DIRTY_AUTH
modules/rss/controllers/rss.php feed DIRTY_CSRF|DIRTY_AUTH
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 7fce42a1..4ead8a3f 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -33,8 +33,8 @@ modules/comment/views/comment.mrss.php 29 DIRTY $child
modules/comment/views/comment.mrss.php 34 DIRTY_ATTR $child->thumb_url
modules/comment/views/comment.mrss.php 35 DIRTY_ATTR $child->thumb_height
modules/comment/views/comment.mrss.php 35 DIRTY_ATTR $child->thumb_width
-modules/comment/views/comments.html.php 21 DIRTY_ATTR $comment->id
-modules/comment/views/comments.html.php 24 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true))
+modules/comment/views/comments.html.php 28 DIRTY_ATTR $comment->id
+modules/comment/views/comments.html.php 31 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true))
modules/comment/views/user_profile_comments.html.php 5 DIRTY_ATTR $comment->id
modules/comment/views/user_profile_comments.html.php 10 DIRTY_JS $comment->item()->url()
modules/comment/views/user_profile_comments.html.php 11 DIRTY $comment->item()->thumb_img(array(),50)
@@ -122,6 +122,50 @@ modules/gallery/views/admin_themes.html.php 76 DIRTY $info-
modules/gallery/views/admin_themes.html.php 78 DIRTY $info->description
modules/gallery/views/admin_themes_preview.html.php 7 DIRTY_ATTR $url
modules/gallery/views/error_404.html.php 14 DIRTY $login_form
+modules/gallery/views/error_admin.html.php 150 DIRTY $type
+modules/gallery/views/error_admin.html.php 150 DIRTY $code
+modules/gallery/views/error_admin.html.php 153 DIRTY $message
+modules/gallery/views/error_admin.html.php 156 DIRTY_ATTR $error_id
+modules/gallery/views/error_admin.html.php 161 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 161 DIRTY $line
+modules/gallery/views/error_admin.html.php 166 DIRTY_ATTR ($num==$line)?"highlight":""
+modules/gallery/views/error_admin.html.php 166 DIRTY $num
+modules/gallery/views/error_admin.html.php 166 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
+modules/gallery/views/error_admin.html.php 178 DIRTY_ATTR $source_id
+modules/gallery/views/error_admin.html.php 178 DIRTY_JS $source_id
+modules/gallery/views/error_admin.html.php 178 DIRTY Kohana_Exception::debug_path($step["file"])
+modules/gallery/views/error_admin.html.php 178 DIRTY $step["line"]
+modules/gallery/views/error_admin.html.php 180 DIRTY Kohana_Exception::debug_path($step["file"])
+modules/gallery/views/error_admin.html.php 180 DIRTY $step["line"]
+modules/gallery/views/error_admin.html.php 187 DIRTY $step["function"]
+modules/gallery/views/error_admin.html.php 188 DIRTY_ATTR $args_id
+modules/gallery/views/error_admin.html.php 188 DIRTY_JS $args_id
+modules/gallery/views/error_admin.html.php 192 DIRTY_ATTR $args_id
+modules/gallery/views/error_admin.html.php 197 DIRTY $name
+modules/gallery/views/error_admin.html.php 200 DIRTY Kohana_Exception::safe_dump($arg,$name)
+modules/gallery/views/error_admin.html.php 208 DIRTY_ATTR $source_id
+modules/gallery/views/error_admin.html.php 208 DIRTY_ATTR ($num==$step["line"])?"highlight":""
+modules/gallery/views/error_admin.html.php 208 DIRTY $num
+modules/gallery/views/error_admin.html.php 208 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
+modules/gallery/views/error_admin.html.php 218 DIRTY_ATTR $env_id=$error_id."environment"
+modules/gallery/views/error_admin.html.php 218 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 220 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 222 DIRTY_ATTR $env_id=$error_id."environment_included"
+modules/gallery/views/error_admin.html.php 222 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 222 DIRTY count($included)
+modules/gallery/views/error_admin.html.php 223 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 228 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 235 DIRTY_ATTR $env_id=$error_id."environment_loaded"
+modules/gallery/views/error_admin.html.php 235 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 235 DIRTY count($included)
+modules/gallery/views/error_admin.html.php 236 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 241 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 249 DIRTY_ATTR $env_id="$error_id.environment".strtolower($var)
+modules/gallery/views/error_admin.html.php 250 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 250 DIRTY $var
+modules/gallery/views/error_admin.html.php 251 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 257 DIRTY $key
+modules/gallery/views/error_admin.html.php 261 DIRTY Kohana_Exception::safe_dump($value,$key)
modules/gallery/views/form_uploadify.html.php 9 DIRTY_JS url::file("lib/uploadify/uploadify.swf")
modules/gallery/views/form_uploadify.html.php 10 DIRTY_JS url::site("simple_uploader/add_photo/{$album->id}")
modules/gallery/views/form_uploadify.html.php 14 DIRTY_JS url::file("lib/uploadify/cancel.png")
@@ -235,16 +279,16 @@ modules/notification/views/item_updated.html.php 20 DIRTY_JS $item-
modules/notification/views/item_updated.html.php 20 DIRTY $item->abs_url()
modules/notification/views/user_profile_notification.html.php 5 DIRTY_ATTR $subscription->id
modules/notification/views/user_profile_notification.html.php 6 DIRTY_JS $subscription->url
-modules/organize/views/organize_dialog.html.php 92 DIRTY_JS $domain
-modules/organize/views/organize_dialog.html.php 93 DIRTY_JS $access_key
-modules/organize/views/organize_dialog.html.php 94 DIRTY_JS $protocol
-modules/organize/views/organize_dialog.html.php 95 DIRTY_JS $file_filter
-modules/organize/views/organize_dialog.html.php 96 DIRTY_JS $sort_order
-modules/organize/views/organize_dialog.html.php 97 DIRTY_JS $sort_fields
-modules/organize/views/organize_dialog.html.php 98 DIRTY_JS $album->id
-modules/organize/views/organize_dialog.html.php 99 DIRTY_JS $rest_uri
-modules/organize/views/organize_dialog.html.php 100 DIRTY_JS $controller_uri
-modules/organize/views/organize_dialog.html.php 124 DIRTY_JS $swf_url
+modules/organize/views/organize_dialog.html.php 90 DIRTY_JS $domain
+modules/organize/views/organize_dialog.html.php 91 DIRTY_JS $access_key
+modules/organize/views/organize_dialog.html.php 92 DIRTY_JS request::protocol()
+modules/organize/views/organize_dialog.html.php 93 DIRTY_JS $file_filter
+modules/organize/views/organize_dialog.html.php 94 DIRTY_JS $sort_order
+modules/organize/views/organize_dialog.html.php 95 DIRTY_JS $sort_fields
+modules/organize/views/organize_dialog.html.php 96 DIRTY_JS $album->id
+modules/organize/views/organize_dialog.html.php 97 DIRTY_JS $rest_uri
+modules/organize/views/organize_dialog.html.php 98 DIRTY_JS $controller_uri
+modules/organize/views/organize_dialog.html.php 122 DIRTY_JS $swf_uri
modules/recaptcha/views/admin_recaptcha.html.php 11 DIRTY $form
modules/recaptcha/views/admin_recaptcha.html.php 23 DIRTY_JS $public_key
modules/recaptcha/views/form_recaptcha.html.php 7 DIRTY_JS $public_key
@@ -316,13 +360,13 @@ themes/admin_wind/views/admin.html.php 43 DIRTY $theme
themes/admin_wind/views/admin.html.php 51 DIRTY $theme->admin_header_top()
themes/admin_wind/views/admin.html.php 52 DIRTY_JS item::root()->url()
themes/admin_wind/views/admin.html.php 55 DIRTY $theme->user_menu()
-themes/admin_wind/views/admin.html.php 57 DIRTY $theme->admin_menu()
-themes/admin_wind/views/admin.html.php 59 DIRTY $theme->admin_header_bottom()
-themes/admin_wind/views/admin.html.php 66 DIRTY $content
-themes/admin_wind/views/admin.html.php 72 DIRTY $sidebar
-themes/admin_wind/views/admin.html.php 77 DIRTY $theme->admin_footer()
-themes/admin_wind/views/admin.html.php 79 DIRTY $theme->admin_credits()
-themes/admin_wind/views/admin.html.php 83 DIRTY $theme->admin_page_bottom()
+themes/admin_wind/views/admin.html.php 58 DIRTY $theme->admin_menu()
+themes/admin_wind/views/admin.html.php 61 DIRTY $theme->admin_header_bottom()
+themes/admin_wind/views/admin.html.php 68 DIRTY $content
+themes/admin_wind/views/admin.html.php 74 DIRTY $sidebar
+themes/admin_wind/views/admin.html.php 79 DIRTY $theme->admin_footer()
+themes/admin_wind/views/admin.html.php 81 DIRTY $theme->admin_credits()
+themes/admin_wind/views/admin.html.php 85 DIRTY $theme->admin_page_bottom()
themes/admin_wind/views/block.html.php 3 DIRTY_ATTR $anchor
themes/admin_wind/views/block.html.php 5 DIRTY $id
themes/admin_wind/views/block.html.php 5 DIRTY_ATTR $css_id