mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-10 17:29:18 -04:00
Pick a new album cover when the photo that's the current cover is
deleted. Fixes ticket #1083.
This commit is contained in:
@@ -54,7 +54,6 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
$this->assert_same($dst_album->id, $photo->parent_id);
|
||||
}
|
||||
|
||||
|
||||
public function move_updates_album_covers_test() {
|
||||
// 2 photos in the source album
|
||||
$src_album = test::random_album();
|
||||
@@ -106,4 +105,16 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
$this->assert_not_same("{$rand}.jpg", $photo2->name);
|
||||
$this->assert_not_same($rand, $photo2->slug);
|
||||
}
|
||||
|
||||
public function delete_cover_photo_picks_new_album_cover() {
|
||||
$album = test::random_album();
|
||||
$photo1 = test::random_photo($album);
|
||||
// At this point, $photo1 is the album cover. We verify this in
|
||||
// Item_Model_Test::first_photo_becomes_album_cover
|
||||
$photo2 = test::random_photo($album);
|
||||
$photo1->delete();
|
||||
$album->reload();
|
||||
|
||||
$this->assert_same($photo2->id, $album->album_cover_item_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user