diff options
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r-- | modules/gallery/tests/Gallery_Filters.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 25 | ||||
-rw-r--r-- | modules/gallery/tests/Items_Rest_Helper_Test.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/xss_data.txt | 5 |
4 files changed, 33 insertions, 5 deletions
diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php index 4e32553b..debbe846 100644 --- a/modules/gallery/tests/Gallery_Filters.php +++ b/modules/gallery/tests/Gallery_Filters.php @@ -28,8 +28,10 @@ class GalleryCodeFilterIterator extends FilterIterator { public function accept() { // Skip anything that we didn"t write $path_name = $this->getInnerIterator()->getPathName(); + $file_name = $this->getInnerIterator()->getFileName(); return !( - strpos($path_name, ".svn") || + $file_name == "." || + $file_name == ".." || 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_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 15aa2d8c..f9e6a4e3 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Item_Model_Test extends Gallery_Unit_Test_Case { + public function teardown() { + identity::set_active_user(identity::admin_user()); + } + public function saving_sets_created_and_updated_dates_test() { $item = test::random_photo(); $this->assert_true(!empty($item->created)); @@ -364,6 +368,27 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { $this->assert_true(!array_key_exists("album_cover_item_id", $result)); } + public function as_restful_array_with_ids_test() { + $album = test::random_album(); + $photo = test::random_photo($album); + $album->reload(); + + $result = $album->as_restful_array(false); + $this->assert_same(item::root()->id, $result["parent_id"]); + $this->assert_same($photo->id, $result["album_cover_item_id"]); + $this->assert_true(!array_key_exists("parent", $result)); + $this->assert_true(!array_key_exists("album_cover_item", $result)); + } + + public function as_restful_array_with_edit_bit_test() { + $response = item::root()->as_restful_array(true); + $this->assert_true($response["can_edit"]); + + identity::set_active_user(identity::guest()); + $response = item::root()->as_restful_array(true); + $this->assert_false($response["can_edit"]); + } + public function first_photo_becomes_album_cover() { $album = test::random_album(); $photo = test::random_photo($album); diff --git a/modules/gallery/tests/Items_Rest_Helper_Test.php b/modules/gallery/tests/Items_Rest_Helper_Test.php index 94bf912a..17e979a5 100644 --- a/modules/gallery/tests/Items_Rest_Helper_Test.php +++ b/modules/gallery/tests/Items_Rest_Helper_Test.php @@ -135,7 +135,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { items_rest::get($request)); } - public function get_ancestor_test() { + public function get_ancestors_test() { $album1 = test::random_album(); $photo1 = test::random_photo($album1); $album2 = test::random_album($album1); @@ -155,7 +155,7 @@ class Items_Rest_Helper_Test extends Gallery_Unit_Test_Case { $request = new stdClass(); $request->params = new stdClass(); - $request->params->ancestor_for = rest::url("item", $photo2); + $request->params->ancestors_for = rest::url("item", $photo2); $this->assert_equal_array( array( $restful_root, diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 0a75d6f7..68dca9cb 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -4,6 +4,7 @@ modules/akismet/views/admin_akismet_stats.html.php 9 DIRTY_ATTR urle modules/comment/views/admin_block_recent_comments.html.php 4 DIRTY_ATTR text::alternate("g-even","g-odd") modules/comment/views/admin_block_recent_comments.html.php 5 DIRTY_ATTR $comment->author()->avatar_url(32,$theme->url(,true)) modules/comment/views/admin_block_recent_comments.html.php 10 DIRTY gallery::date_time($comment->created) +modules/comment/views/admin_comments.html.php 5 DIRTY $form modules/comment/views/admin_manage_comments.html.php 43 DIRTY $menu->render() modules/comment/views/admin_manage_comments.html.php 107 DIRTY_ATTR $comment->id modules/comment/views/admin_manage_comments.html.php 107 DIRTY_ATTR text::alternate("g-odd","g-even") @@ -32,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 18 DIRTY_ATTR $comment->id -modules/comment/views/comments.html.php 21 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true)) +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/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) |