本文整理匯總了PHP中test::lorem_ipsum方法的典型用法代碼示例。如果您正苦於以下問題:PHP test::lorem_ipsum方法的具體用法?PHP test::lorem_ipsum怎麽用?PHP test::lorem_ipsum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test
的用法示例。
在下文中一共展示了test::lorem_ipsum方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: random_tag
static function random_tag()
{
$tag = ORM::factory("tag");
$tag->name = test::lorem_ipsum(rand(2, 4));
// Reload so that ORM coerces all fields into strings.
return $tag->save()->reload();
}
示例2: resize_bad_jpg_test
public function resize_bad_jpg_test()
{
// Input is a garbled jpg, output is jpg autofit to 300x300
$input_file = TMPPATH . test::random_name() . ".jpg";
$output_file = TMPPATH . test::random_name() . ".jpg";
$options = array("width" => 300, "height" => 300, "master" => Image::AUTO);
file_put_contents($input_file, test::lorem_ipsum(200));
// Should get passed to Image library and throw an exception
try {
gallery_graphics::resize($input_file, $output_file, $options, null);
$this->assert_true(false, "Shouldn't get here");
} catch (Exception $e) {
// pass
}
}
示例3: generate_album_cover_from_bad_photo_test
public function generate_album_cover_from_bad_photo_test()
{
$album = test::random_album();
$photo = test::random_photo($album);
$album->reload();
// At this point, the photo is valid and has a valid resize and thumb. Make it garble.
file_put_contents($photo->file_path(), test::lorem_ipsum(200));
// Regenerate album from garbled photo.
$photo->thumb_dirty = 1;
$photo->save();
$album->thumb_dirty = 1;
try {
graphics::generate($album);
$this->assert_true(false, "Shouldn't get here");
} catch (Exception $e) {
// Exception expected
}
// Check that the image got replaced with a missing image placeholder
$this->assert_same(file_get_contents(MODPATH . "gallery/images/missing_photo.jpg"), file_get_contents($album->thumb_path()));
// Check that the items table got updated with new metadata
$this->assert_equal(array(200, 200), array($album->thumb_width, $album->thumb_height));
// Check that the images are marked as dirty
$this->assert_equal(1, $album->thumb_dirty);
}