diff --git a/lib/Alchemy/Phrasea/Application/Overview.php b/lib/Alchemy/Phrasea/Application/Overview.php index 57dcaacdff..89d1661392 100644 --- a/lib/Alchemy/Phrasea/Application/Overview.php +++ b/lib/Alchemy/Phrasea/Application/Overview.php @@ -66,7 +66,7 @@ return call_user_func( $response->setLastModified($file->get_modification_date()); } - if ($file->getDataboxSubdef()->get_class() == \databox_subdef::CLASS_THUMBNAIL) { + if (false === $record->is_grouping() && $file->getDataboxSubdef()->get_class() == \databox_subdef::CLASS_THUMBNAIL) { // default expiration is 5 days $expiration = 60 * 60 * 24 * 5; diff --git a/tests/Alchemy/Phrasea/Application/OverviewTest.php b/tests/Alchemy/Phrasea/Application/OverviewTest.php index 1b753fa0dd..96e8ddc007 100644 --- a/tests/Alchemy/Phrasea/Application/OverviewTest.php +++ b/tests/Alchemy/Phrasea/Application/OverviewTest.php @@ -2,9 +2,7 @@ require_once __DIR__ . '/../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc'; -use Silex\WebTestCase; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\File\UploadedFile; class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract { @@ -110,6 +108,29 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract $this->get_a_permalink(); } + public function testGetAStorythumbnail() + { + $story = \record_adapter::createStory(self::$collection); + + $media = $this->getMockBuilder('MediaVorus\Media\Media') + ->disableOriginalConstructor() + ->getMock(); + + $symfoFile = new UploadedFile(__DIR__ . '/../../../testfiles/cestlafete.jpg', 'cestlafete.jpg'); + + $media->expects($this->any()) + ->method('getFile') + ->will($this->returnValue($symfoFile)); + + $story->substitute_subdef('thumbnail', $media); + + $this->client->request('GET', '/datafiles/' . $story->get_sbas_id() . '/' . $story->get_record_id() . '/preview/'); + $response = $this->client->getResponse(); + + $this->assertEquals(200, $response->getStatusCode()); + } + + protected function get_a_permalink() { $token = static::$records['record_1']->get_preview()->get_permalink()->get_token();