Commit 6bd0fc65 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch...

Merge branch 'hotline#128802_le_serveur_de_cache_n_accepte_pas_les_vignettes_en_webp' into 'hotline'

Hotline#128802 le serveur de cache n accepte pas les vignettes en webp

See merge request afi/opacce!4135
parents 37ac8908 8611f25c
- ticket #128802 : Page notice : le bouton "modifier la vignette" prends maintenant en charge les images au format .webp
\ No newline at end of file
......@@ -509,16 +509,16 @@ Pour vous désabonner de la lettre d\'information, merci de cliquer sur le lien
['value' => '500'])->bePrivate(),
'ALLOWED_FILES_EXTENSIONS_FOR_IMPORT' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des extensions de fichiers disponibles à l\'import.'),
['value' => 'css;pdf;mp3;mp4;ogg;m4v;ico;gif;svg;jpg;jpeg;png;epub;geojson;xsl;txt;pdf']),
['value' => 'css;pdf;mp3;mp4;ogg;m4v;ico;gif;svg;jpg;jpeg;png;epub;geojson;xsl;txt;pdf;webp']),
'RESIZABLE_DIMENSIONS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des dimensions disponibles pour retailler les images lors de l\'import.'),
['value' => '800x600;1024x768;1280x1024;']),
'RESIZABLE_EXTENSIONS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des extensions de fichiers susceptibles d\'être redimensionnés.'),
['value' => 'jpg;jpeg;png;']),
['value' => 'jpg;jpeg;png;webp']),
'SELECTABLE_EXTENSIONS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des extensions susceptibles d\'être sélectionnées pour enrichir un contenu.'),
['value' => 'svg;gif;jpg;jpeg;png;geojson;pdf']),
['value' => 'svg;gif;jpg;jpeg;png;geojson;pdf;webp']),
'IMAGICK_IMAGE_COMPRESSION_QUALITY' => Class_AdminVar_Meta::newDefault($this->_('Compression d\'image utilisée dans le redimensionnement et la compression des images.'),
['value' => '90'])->bePrivate(),
......
......@@ -24,7 +24,7 @@ class ZendAfi_Validate_VignetteUrl extends Zend_Validate_Abstract {
protected
$_messageTemplates = [self::INVALID_URL_FORMAT => "'%value%' n'est pas une URL de vignette correspondant aux formats acceptés."],
$_valid_url_patterns = ['.+\.(png|jpg|jpeg|gif)$',
$_valid_url_patterns = ['.+\.(png|jpg|jpeg|gif|webp)$',
'\/cgi-bin\/koha\/opac-image\.pl\?thumbnail=',
'www\.adav-assoc\.com\/.*\/GetImage\/',
'\/dam_picture.php\?id=',
......
......@@ -245,33 +245,51 @@ class RecordsControllerThumbnailTest extends RecordsControllerTestCase {
class RecordsControllerThumbnailActionPostValidUrlTest extends RecordsControllerTestCase {
public function setUp() {
parent::setUp();
abstract class RecordsControllerThumbnailFormatTestCase extends RecordsControllerTestCase{
protected $_format;
protected function _setFormat(){
}
public function getFormat(){
return $this->_format;
}
protected function _setServices(){
$this->_http_client
->whenCalled('open_url')
->with('http://cache.org?isbn=0123456789'
.'&type_doc=1'
.'&titre='.urlencode('Harry Potter')
.'&auteur='.urlencode('J.K.Rowling')
.'&image='.urlencode('http://upload.wikimedia.org/potter.jpg')
.'&image='.urlencode('http://upload.wikimedia.org/potter.'. $this->getFormat())
.'&src='.Class_WebService_AllServices::createSecurityKey()
.'&api=2.0'
.'&action=12')
->answers(json_encode(['vignette' => 'http://cache.org/potter_thumb.jpg',
'image' => 'http://cache.org/potter.jpg',
->answers(json_encode(['vignette' => 'http://cache.org/potter_thumb.'. $this->getFormat(),
'image' => 'http://cache.org/potter.'. $this->getFormat(),
'statut_recherche' => 2]))
->beStrict();
$this->postDispatch('/admin/records/thumbnail/id/12345',
['url_vignette' => 'http://upload.wikimedia.org/potter.jpg']);
['url_vignette' => 'http://upload.wikimedia.org/potter.'. $this->getFormat()]);
}
public function setUp(){
parent::setUp();
$this->_setFormat();
$this->_setServices();
}
/** @test */
public function noticeUrlVignetteShouldBePotterThumbDotJpg() {
$this->assertEquals('http://cache.org/potter_thumb.jpg', Class_Notice::find(12345)->fetchUrlVignette());
$this->assertEquals('http://cache.org/potter_thumb.'. $this->getFormat(), Class_Notice::find(12345)->fetchUrlVignette());
}
......@@ -283,6 +301,25 @@ class RecordsControllerThumbnailActionPostValidUrlTest extends RecordsController
class RecordsControllerThumbnailActionPostValidFormatJpgTest extends RecordsControllerThumbnailFormatTestCase {
protected function _setFormat() {
$this->_format = 'jpg';
}
}
class RecordsControllerThumbnailActionPostValidFormatWebpTest extends RecordsControllerThumbnailFormatTestCase {
protected function _setFormat() {
$this->_format = 'webp';
}
}
class RecordsControllerThumbnailActionPostValidUrlForPeriodiqueTest extends RecordsControllerTestCase {
public function setUp() {
parent::setUp();
......
......@@ -3955,4 +3955,4 @@ class UpgradeDB_414_Test extends UpgradeDBTestCase {
->fetch()));
}
}
}
\ No newline at end of file
......@@ -152,7 +152,7 @@ class CkEditorAdminWithFileBrowserTest extends CkEditorLoggedTestCase {
/** @test */
public function editorConfigShouldContainsSelectableExtensions() {
$this->assertContains('/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub',
$this->assertContains('/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bwebp%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub',
$this->_html);
}
......
......@@ -21,6 +21,8 @@
class CoreFiveFileInputSelectableExtensionsTest extends ViewHelperTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_helper = new ZendAfi_View_Helper_CoreFiveFileInput();
......@@ -33,8 +35,8 @@ class CoreFiveFileInputSelectableExtensionsTest extends ViewHelperTestCase {
}
/** @test */
/** @test */
public function coreFiveShouldContainsSelectableExtensions() {
$this->assertContains('function openFileManagerFor_test(){injectPathInInput = function(data){$("input[name=\'test\']").attr(\'value\',data).trigger(\'change\');};window.open("/admin/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub&core_five_file_input=1', $this->_html);
$this->assertContains('function openFileManagerFor_test(){injectPathInInput = function(data){$("input[name=\'test\']").attr(\'value\',data).trigger(\'change\');};window.open("/admin/file-manager?full_screen=1&browser=userfiles%2Ffile&selectable_extensions=svg%3Bgif%3Bjpg%3Bjpeg%3Bpng%3Bgeojson%3Bpdf%3Bwebp%3Bcss%3Bmp3%3Bmp4%3Bogg%3Bm4v%3Bico%3Bepub%3Bxsl%3Btxt&core_five_file_input=1', $this->_html);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment