Fix #1006, story thumbnails are displayed correctly

This commit is contained in:
Romain Neutron
2012-11-26 14:38:39 +01:00
parent 5349c93570
commit fc19c70329
2 changed files with 25 additions and 4 deletions

View File

@@ -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;

View File

@@ -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();