本文整理汇总了PHP中test::random_movie方法的典型用法代码示例。如果您正苦于以下问题:PHP test::random_movie方法的具体用法?PHP test::random_movie怎么用?PHP test::random_movie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test
的用法示例。
在下文中一共展示了test::random_movie方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: movie_thumbnails_are_jpgs_test
public function movie_thumbnails_are_jpgs_test()
{
$movie = test::random_movie();
$name = legal_file::change_extension($movie->name, "jpg");
$_SERVER["REQUEST_URI"] = url::file("var/thumbs/{$name}");
$controller = new File_Proxy_Controller();
$this->assert_same($movie->thumb_path(), $controller->__call("", array()));
}
示例2: get_file_metadata_test
public function get_file_metadata_test()
{
$movie = test::random_movie();
$this->assert_equal(array(360, 288, "video/x-flv", "flv", 6.0), movie::get_file_metadata($movie->file_path()));
}
示例3: find_by_path_with_album_test
public function find_by_path_with_album_test()
{
$parent = test::random_album();
$album = test::random_movie($parent);
$album_path = "{$parent->name}/{$album->name}";
$thumb_path = "{$album_path}/.album.jpg";
// Check normal operation.
$this->assert_equal($album->id, item::find_by_path($album_path, "albums")->id);
$this->assert_equal($album->id, item::find_by_path($thumb_path, "thumbs")->id);
$this->assert_equal($album->id, item::find_by_path($album_path)->id);
// Check that we don't get false positives.
$this->assert_equal(null, item::find_by_path($thumb_path, "albums")->id);
$this->assert_equal(null, item::find_by_path($album_path, "thumbs")->id);
$this->assert_equal(null, item::find_by_path($thumb_path)->id);
// Check normal operation without relative path cache.
self::_remove_relative_path_caches();
$this->assert_equal($album->id, item::find_by_path($album_path, "albums")->id);
self::_remove_relative_path_caches();
$this->assert_equal($album->id, item::find_by_path($thumb_path, "thumbs")->id);
self::_remove_relative_path_caches();
$this->assert_equal($album->id, item::find_by_path($album_path)->id);
// Check that we don't get false positives without relative path cache.
self::_remove_relative_path_caches();
$this->assert_equal(null, item::find_by_path($thumb_path, "albums")->id);
$this->assert_equal(null, item::find_by_path($album_path, "thumbs")->id);
$this->assert_equal(null, item::find_by_path($thumb_path)->id);
}
示例4: generate_bad_movie_test
public function generate_bad_movie_test()
{
// Unlike photos, its ok to have missing movies - no thrown exceptions, thumb_dirty can be reset.
$movie = test::random_movie();
// At this point, the movie is valid and has a valid thumb. Make it garble.
file_put_contents($movie->file_path(), test::lorem_ipsum(200));
// Regenerate
$movie->thumb_dirty = 1;
graphics::generate($movie);
// Check that the image got replaced with a missing image placeholder
$this->assert_same(file_get_contents(MODPATH . "gallery/images/missing_movie.jpg"), file_get_contents($movie->thumb_path()));
// Check that the items table got updated with new metadata
$this->assert_equal(array(200, 200), array($movie->thumb_width, $movie->thumb_height));
// Check that the image is *not* marked as dirty
$this->assert_equal(0, $movie->thumb_dirty);
}
示例5: fix_conflict_when_base_names_identical_between_jpg_png_flv_test
public function fix_conflict_when_base_names_identical_between_jpg_png_flv_test()
{
$parent = test::random_album();
$item1 = test::random_photo($parent);
$item2 = test::random_photo($parent);
$item3 = test::random_movie($parent);
$item1_orig_base = pathinfo($item1->name, PATHINFO_FILENAME);
$item2_orig_slug = $item2->slug;
$item3_orig_slug = $item3->slug;
$item2->set_data_file(MODPATH . "gallery/images/graphicsmagick.png");
$item2->name = "{$item1_orig_base}.png";
$item2->save();
$item3->name = "{$item1_orig_base}.flv";
$item3->save();
// item2 and item3 have same base name as item1 - conflict resolved by renaming with -01 and -02.
$this->assert_same("{$item1_orig_base}-01.png", $item2->name);
$this->assert_same("{$item2_orig_slug}-01", $item2->slug);
$this->assert_same("{$item1_orig_base}-02.flv", $item3->name);
$this->assert_same("{$item3_orig_slug}-02", $item3->slug);
}