本文整理汇总了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();
}
示例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();
}
示例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);
}
示例4: random_album
static function random_album($parent = null)
{
return test::random_album_unsaved($parent)->save()->reload();
}
示例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);
}
示例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();
}