当前位置: 首页>>代码示例>>PHP>>正文


PHP test::random_album方法代码示例

本文整理汇总了PHP中test::random_album方法的典型用法代码示例。如果您正苦于以下问题:PHP test::random_album方法的具体用法?PHP test::random_album怎么用?PHP test::random_album使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test的用法示例。


在下文中一共展示了test::random_album方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resolve_test

 public function resolve_test()
 {
     $album = test::random_album();
     $tag = tag::add($album, "tag1")->reload();
     $tuple = rest::resolve(rest::url("tag_item", $tag, $album));
     $this->assert_equal_array($tag->as_array(), $tuple[0]->as_array());
     $this->assert_equal_array($album->as_array(), $tuple[1]->as_array());
 }
开发者ID:andyst,项目名称:gallery3,代码行数:8,代码来源:Tag_Item_Rest_Helper_Test.php

示例2: build_breadcrumbs_for_item_test

 public function build_breadcrumbs_for_item_test()
 {
     $album = test::random_album();
     $item = test::random_photo($album);
     $expected = array();
     $expected[] = Breadcrumb::instance(item::root()->title, item::root()->url("show={$album->id}"))->set_first();
     $expected[] = Breadcrumb::instance($album->title, $album->url("show={$item->id}"));
     $expected[] = Breadcrumb::instance($item->title, $item->url())->set_last();
     $this->assert_equal($expected, Breadcrumb::array_from_item_parents($item));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:10,代码来源:Breadcrumb_Test.php

示例3: post_test

 public function post_test()
 {
     $tag = test::random_tag();
     // Create an editable item to be tagged
     $album = test::random_album();
     access::allow(identity::everybody(), "edit", $album);
     // Add the album to the tag
     $request->url = rest::url("tag", $tag);
     $request->params->url = rest::url("item", $album);
     $this->assert_equal_array(array("url" => rest::url("tag_item", $tag, $album)), tag_rest::post($request));
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:11,代码来源:Tag_Rest_Helper_Test.php

示例4: _get_proxy

 private function _get_proxy()
 {
     $album = test::random_album();
     $photo = test::random_photo($album);
     access::deny(identity::everybody(), "view_full", $album);
     access::deny(identity::registered_users(), "view_full", $album);
     $proxy = ORM::factory("digibug_proxy");
     $proxy->uuid = random::hash();
     $proxy->item_id = $photo->id;
     return $proxy->save();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:11,代码来源:Digibug_Controller_Test.php

示例5: create_tag_test

 public function create_tag_test()
 {
     $album = test::random_album();
     tag::add($album, "tag1");
     $tag = ORM::factory("tag")->where("name", "=", "tag1")->find();
     $this->assert_true(1, $tag->count);
     // Make sure adding the tag again doesn't increase the count
     tag::add($album, "tag1");
     $this->assert_true(1, $tag->reload()->count);
     tag::add(test::random_album(), "tag1");
     $this->assert_true(2, $tag->reload()->count);
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:12,代码来源:Tag_Test.php

示例6: deleting_an_item_deletes_its_comments_too_test

 public function deleting_an_item_deletes_its_comments_too_test()
 {
     $album = test::random_album();
     $comment = ORM::factory("comment");
     $comment->item_id = $album->id;
     $comment->author_id = identity::guest()->id;
     $comment->guest_name = "test";
     $comment->text = "text";
     $comment->save();
     $album->delete();
     $this->assert_false(ORM::factory("comment", $comment->id)->loaded());
 }
开发者ID:andyst,项目名称:gallery3,代码行数:12,代码来源:Comment_Event_Test.php

示例7: viewable_test

 public function viewable_test()
 {
     $album = test::random_album();
     $item = test::random_photo($album);
     $album->reload();
     identity::set_active_user(identity::guest());
     // We can see the item when permissions are granted
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php

示例8: rename_merge_tag_with_same_items_test

 public function rename_merge_tag_with_same_items_test()
 {
     $album = test::random_album();
     tag::add($album, "tag1");
     tag::add($album, "tag2");
     $tag1 = ORM::factory("tag")->where("name", "=", "tag1")->find();
     $tag1->name = "tag2";
     $tag1->save();
     // Tags should be merged
     $tag1->reload();
     $this->assert_equal(1, $tag1->count);
     $this->assert_true($tag1->has($album));
     $this->assert_equal(1, ORM::factory("tag")->count_all());
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:14,代码来源:Tag_Test.php

示例9: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $album = test::random_album();
     $comment = ORM::factory("comment");
     $comment->item_id = $album->id;
     $comment->author_id = identity::admin_user()->id;
     $comment->text = "text";
     $comment->save();
     identity::set_active_user(identity::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(identity::everybody(), "view", $album);
     $this->assert_true(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(identity::everybody(), "view", $album);
     $this->assert_false(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:16,代码来源:Comment_Model_Test.php

示例10: change_album_no_csrf_fails_test

 public function change_album_no_csrf_fails_test()
 {
     $controller = new Albums_Controller();
     $album = test::random_album();
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(identity::everybody(), "edit", item::root());
     try {
         $controller->update($album->id);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
         $this->assert_same("@todo FORBIDDEN", $e->getMessage());
     }
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:16,代码来源:Albums_Controller_Test.php

示例11: move_conflicts_result_in_a_rename_test

 public function move_conflicts_result_in_a_rename_test()
 {
     $rand = rand();
     $photo1 = test::random_photo_unsaved(item::root());
     $photo1->name = "{$rand}.jpg";
     $photo1->slug = (string) $rand;
     $photo1->save();
     $src_album = test::random_album();
     $photo2 = test::random_photo_unsaved($src_album);
     $photo2->name = "{$rand}.jpg";
     $photo2->slug = (string) $rand;
     $photo2->save();
     item::move($photo2, item::root());
     $this->assert_same(item::root()->id, $photo2->parent_id);
     $this->assert_not_same("{$rand}.jpg", $photo2->name);
     $this->assert_not_same($rand, $photo2->slug);
 }
开发者ID:andyst,项目名称:gallery3,代码行数:17,代码来源:Item_Helper_Test.php

示例12: illegal_access_test

 public function illegal_access_test()
 {
     $album = test::random_album();
     $photo = test::random_photo($album);
     $album->reload();
     access::deny(identity::everybody(), "view", $album);
     identity::set_active_user(identity::guest());
     $request = new stdClass();
     $request->url = rest::url("data", $photo, "thumb");
     $request->params = new stdClass();
     $request->params->size = "thumb";
     try {
         data_rest::get($request);
         $this->assert_true(false);
     } catch (Kohana_404_Exception $e) {
         // pass
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:18,代码来源:Data_Rest_Helper_Test.php

示例13: get_ancestors_test

 public function get_ancestors_test()
 {
     $album1 = test::random_album();
     $photo1 = test::random_photo($album1);
     $album2 = test::random_album($album1);
     $photo2 = test::random_photo($album2);
     $album1->reload();
     $album2->reload();
     $root = ORM::factory("item", 1);
     $restful_root = array("url" => rest::url("item", $root), "entity" => $root->as_restful_array(), "relationships" => rest::relationships("item", $root));
     $restful_root["members"] = array();
     foreach ($root->children() as $child) {
         $restful_root["members"][] = rest::url("item", $child);
     }
     $request = new stdClass();
     $request->params = new stdClass();
     $request->params->ancestors_for = rest::url("item", $photo2);
     $this->assert_equal_array(array($restful_root, 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())), "members" => array(rest::url("item", $photo1), rest::url("item", $album2))), 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())), "members" => array(rest::url("item", $photo2))), 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())))), items_rest::get($request));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:19,代码来源:Items_Rest_Helper_Test.php

示例14: descendant_count_test

 public function descendant_count_test()
 {
     $parent = test::random_album();
     $photo = test::random_photo($parent);
     $album1 = test::random_album($parent);
     $photo1 = test::random_photo($album1);
     $parent->reload();
     $this->assert_equal(3, $parent->descendants_count());
     $this->assert_equal(2, $parent->descendants_count(array(array("type", "=", "photo"))));
     $this->assert_equal(1, $parent->descendants_count(array(array("type", "=", "album"))));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:11,代码来源:ORM_MPTT_Test.php

示例15: delete_album_fails_without_permission_test

 public function delete_album_fails_without_permission_test()
 {
     $album1 = test::random_album();
     access::deny(identity::everybody(), "edit", $album1);
     identity::set_active_user(identity::guest());
     $request->url = rest::url("item", $album1);
     try {
         item_rest::delete($request);
     } catch (Exception $e) {
         $this->assert_equal("@todo FORBIDDEN", $e->getMessage());
         return;
     }
     $this->assert_true(false, "Shouldn't get here");
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:14,代码来源:Item_Rest_Helper_Test.php


注:本文中的test::random_album方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。