Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
afi
opacce
Commits
881091d6
Commit
881091d6
authored
Nov 14, 2019
by
Laurent
Browse files
hotline #98887 fix record page generate thumbnail button when record id has changed
parent
61482221
Pipeline
#8686
passed with stage
in 44 minutes and 36 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
8 deletions
+32
-8
VERSIONS_HOTLINE/98887
VERSIONS_HOTLINE/98887
+1
-0
application/modules/admin/controllers/RecordsController.php
application/modules/admin/controllers/RecordsController.php
+2
-1
library/ZendAfi/View/Helper/RenderRecord.php
library/ZendAfi/View/Helper/RenderRecord.php
+4
-1
tests/application/modules/admin/controllers/RecordsControllerTest.php
...ation/modules/admin/controllers/RecordsControllerTest.php
+17
-6
tests/application/modules/opac/controllers/RechercheControllerTest.php
...tion/modules/opac/controllers/RechercheControllerTest.php
+8
-0
No files found.
VERSIONS_HOTLINE/98887
0 → 100644
View file @
881091d6
- ticket #98887 : Correction du bouton "générer la vignette" sur la page notice lorsque l'id notice est obsolète
\ No newline at end of file
application/modules/admin/controllers/RecordsController.php
View file @
881091d6
...
...
@@ -42,7 +42,8 @@ class Admin_RecordsController extends ZendAfi_Controller_Action {
$record
->
setUrlImage
(
''
)
->
setUrlVignette
(
''
)
->
save
();
->
fetchUrlLocalVignette
();
$this
->
_helper
->
notify
(
$this
->
_
(
'Vignette réinitialisée pour "%s"'
,
$record
->
getTitrePrincipal
()));
$this
->
_redirectToReferer
();
}
...
...
library/ZendAfi/View/Helper/RenderRecord.php
View file @
881091d6
...
...
@@ -133,7 +133,10 @@ class ZendAfi_View_Helper_RenderRecord extends ZendAfi_View_Helper_BaseHelper {
?
$this
->
view
->
Admin_Button
((
new
Class_Entity
())
->
setUrl
(
$this
->
view
->
url
([
'module'
=>
'admin'
,
'controller'
=>
'records'
,
'action'
=>
'reset-thumbnail'
]))
'action'
=>
'reset-thumbnail'
,
'id'
=>
$this
->
notice
->
getId
()],
null
,
true
))
->
setText
(
$this
->
_
(
'Générer'
))
->
setAttribs
([
'title'
=>
$this
->
_
(
'Supprimer et re-générer la vignette de la notice "%s"'
,
$this
->
notice
->
getTitrePrincipal
())]))
...
...
tests/application/modules/admin/controllers/RecordsControllerTest.php
View file @
881091d6
...
...
@@ -55,10 +55,19 @@ abstract class RecordsControllerTestCase extends Admin_AbstractControllerTestCas
}
class
RecordsControllerResetThumbnailTest
extends
RecordsControllerTestCase
{
public
function
setUp
()
{
parent
::
setUp
();
$this
->
_http_client
->
whenCalled
(
'open_url'
)
->
answers
(
json_encode
([
'vignette'
=>
'http://cache.org/potter_thumb.jpg'
,
'image'
=>
'http://cache.org/potter.jpg'
,
'statut_recherche'
=>
2
]));
$this
->
_notice
->
setUrlImage
(
'http://harrypotter.com/poster.jpg'
)
->
setUrlVignette
(
'http://harrypotter.com/poster.jpg'
)
...
...
@@ -71,14 +80,16 @@ class RecordsControllerResetThumbnailTest extends RecordsControllerTestCase {
/** @test */
public
function
urlImageShouldBeEmpty
()
{
$this
->
assertEmpty
(
$this
->
_notice
->
getUrlImage
());
public
function
urlImageShouldBeNewUrlFromCacheDotOrg
()
{
$this
->
assertEquals
(
'http://cache.org/potter.jpg'
,
$this
->
_notice
->
getUrlImage
());
}
/** @test */
public
function
urlThumbnailShouldBeEmpty
()
{
$this
->
assertEmpty
(
$this
->
_notice
->
getUrlVignette
());
public
function
urlThumbnailShouldBeNewUrlFromCacheDotOrg
()
{
$this
->
assertEquals
(
'http://cache.org/potter_thumb.jpg'
,
$this
->
_notice
->
getUrlVignette
());
}
...
...
@@ -115,7 +126,7 @@ class RecordsControllerResetAlbumThumbnailTest extends RecordsControllerTestCase
$album
->
index
();
$id
=
$album
->
getNoticeId
();
$this
->
dispatch
(
'/admin/records/reset-thumbnail/id/
12345'
,
true
);
$this
->
dispatch
(
'/admin/records/reset-thumbnail/id/
'
.
$id
,
true
);
Class_Notice
::
clearCache
();
$this
->
_notice
=
Class_Notice
::
find
(
$id
);
...
...
@@ -142,7 +153,7 @@ class RecordsControllerResetAlbumThumbnailTest extends RecordsControllerTestCase
/** @test */
public
function
responseShouldNotifyRecordUpdated
()
{
$this
->
assertFlashMessengerContentContains
(
'Vignette réinitialisée pour "
Harry
Potter"'
);
$this
->
assertFlashMessengerContentContains
(
'Vignette réinitialisée pour "Potter"'
);
}
}
...
...
tests/application/modules/opac/controllers/RechercheControllerTest.php
View file @
881091d6
...
...
@@ -777,6 +777,14 @@ class RechercheControllerViewNoticeClefAlphaTest extends RechercheControllerNoti
$this
->
dispatch
(
'recherche/viewnotice/clef/TESTINGALPHAKEY---101/expressionRecherche/Millenium'
,
true
);
}
/** @test */
public
function
resetThumbnailButtonShouldContainsId345
()
{
$this
->
assertXPath
(
'//button[contains(@onclick, "admin/records/reset-thumbnail/id/345")]'
,
$this
->
response
->
getBody
());
}
/** @test */
public
function
retourListeShouldLinkToRechercheSimpleWithHashTagIdNotice
()
{
$this
->
assertXPathContentContains
(
'//div/a[@class="retour"][contains(@href, "/recherche/simple/expressionRecherche/Millenium#345")]'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment