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


PHP test::random_album_unsaved方法代码示例

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


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

示例1: name_with_only_invalid_chars_is_still_valid_test

 public function name_with_only_invalid_chars_is_still_valid_test()
 {
     $album = test::random_album_unsaved();
     $album->name = "[]";
     $album->save();
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:6,代码来源:Item_Model_Test.php

示例2: albums_can_have_two_dots_in_name_test

 public function albums_can_have_two_dots_in_name_test()
 {
     $album = test::random_album_unsaved(item::root());
     $album->name = $album->name . ".foo.bar";
     $album->save();
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:6,代码来源:Item_Model_Test.php

示例3: find_by_path_test

 public function find_by_path_test()
 {
     $level1 = test::random_album();
     $level2 = test::random_album_unsaved($level1);
     $level2->name = "plus + space";
     $level2->save()->reload();
     $level3 = test::random_photo_unsaved($level2);
     $level3->name = "same.jpg";
     $level3->save()->reload();
     $level2b = test::random_album($level1);
     $level3b = test::random_photo_unsaved($level2b);
     $level3b->name = "same.jpg";
     $level3b->save()->reload();
     // Item in album
     $this->assert_same($level3->id, item::find_by_path("/{$level1->name}/{$level2->name}/{$level3->name}")->id);
     // Album, ends with a slash
     $this->assert_same($level2->id, item::find_by_path("{$level1->name}/{$level2->name}/")->id);
     // Album, ends without a slash
     $this->assert_same($level2->id, item::find_by_path("/{$level1->name}/{$level2->name}")->id);
     // Return root if "" is passed
     $this->assert_same(item::root()->id, item::find_by_path("")->id);
     // Verify that we don't get confused by the part names, using the fallback code.
     db::build()->update("items")->set(array("relative_path_cache" => null))->where("id", "IN", array($level3->id, $level3b->id))->execute();
     $this->assert_same($level3->id, item::find_by_path("{$level1->name}/{$level2->name}/{$level3->name}")->id);
     $this->assert_same($level3b->id, item::find_by_path("{$level1->name}/{$level2b->name}/{$level3b->name}")->id);
     // Verify that we don't get false positives
     $this->assert_false(item::find_by_path("foo/bar/baz")->loaded());
     // Verify that the fallback code works
     $this->assert_same($level3b->id, item::find_by_path("{$level1->name}/{$level2b->name}/{$level3b->name}")->id);
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:30,代码来源:Item_Helper_Test.php

示例4: random_album

 static function random_album($parent = null)
 {
     return test::random_album_unsaved($parent)->save()->reload();
 }
开发者ID:andyst,项目名称:gallery3,代码行数:4,代码来源:test.php

示例5: resequence_child_weights_test

 public function resequence_child_weights_test()
 {
     $album = test::random_album_unsaved();
     $album->sort_column = "id";
     $album->save();
     $photo1 = test::random_photo($album);
     $photo2 = test::random_photo($album);
     $this->assert_true($photo2->weight > $photo1->weight);
     $album->reload();
     $album->sort_order = "DESC";
     $album->save();
     item::resequence_child_weights($album);
     $this->assert_equal(2, $photo1->reload()->weight);
     $this->assert_equal(1, $photo2->reload()->weight);
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:15,代码来源:Item_Helper_Test.php

示例6: slug_is_url_safe_test

 public function slug_is_url_safe_test()
 {
     try {
         $album = test::random_album_unsaved();
         $album->slug = "illegal chars! !@#@#\$!@~";
         $album->save();
         $this->assert_true(false, "Shouldn't be able to save");
     } catch (ORM_Validation_Exception $e) {
         $this->assert_same(array("slug" => "not_url_safe"), $e->validation->errors());
     }
     // This should work
     $album->slug = "the_quick_brown_fox";
     $album->save();
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:14,代码来源:Item_Model_Test.php


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