From 749fe96b5b987bec29fb608acfcbdb81e57aaebf Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 27 Nov 2015 21:38:28 +0000 Subject: Remove risk of infinite loop in PhotoSet. Use a separate attribute for data direct from a database row when creating a PhotoSet, so that data will always contain one or more photo IDs. --- t/app/model/photoset.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/app/model/photoset.t b/t/app/model/photoset.t index 938c77b2a..cfb5236a8 100644 --- a/t/app/model/photoset.t +++ b/t/app/model/photoset.t @@ -5,7 +5,6 @@ use Test::Exception; use utf8; use FixMyStreet::DB; -use Data::Dumper; use DateTime; use Path::Tiny 'path'; use File::Temp 'tempdir'; @@ -59,6 +58,7 @@ subtest 'Photoset with photo inline in DB' => sub { my $report = make_report( $image_path->slurp ); my $photoset = $report->get_photoset(); is $photoset->num_images, 1, 'Found just 1 image'; + is $photoset->data, '1cdd4329ceee2234bd4e89cb33b42061a0724687'; }; $image_path->copy( path( $UPLOAD_DIR, '0123456789012345678901234567890123456789.jpeg' ) ); @@ -68,7 +68,7 @@ subtest 'Photoset with 1 referenced photo' => sub { is $photoset->num_images, 1, 'Found just 1 image'; }; -subtest 'Photoset with 1 referenced photo' => sub { +subtest 'Photoset with 3 referenced photo' => sub { my $report = make_report( '0123456789012345678901234567890123456789,0123456789012345678901234567890123456789,0123456789012345678901234567890123456789' ); my $photoset = $report->get_photoset(); is $photoset->num_images, 3, 'Found 3 images'; -- cgit v1.2.3