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
19ad678e
Commit
19ad678e
authored
Dec 19, 2019
by
efalcy
Committed by
Patrick Barroca
Jan 08, 2020
Browse files
dev#100249: ArteVOD : add a dashboard
parent
5d74dfe5
Pipeline
#9062
passed with stage
in 44 minutes and 10 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
429 additions
and
21 deletions
+429
-21
VERSIONS_WIP/100249
VERSIONS_WIP/100249
+1
-0
application/modules/admin/controllers/BibnumController.php
application/modules/admin/controllers/BibnumController.php
+20
-0
application/modules/admin/views/scripts/bibnum/artevod-dashboard.phtml
...odules/admin/views/scripts/bibnum/artevod-dashboard.phtml
+2
-0
library/Class/DigitalResource/Config.php
library/Class/DigitalResource/Config.php
+24
-4
library/Class/WebService/BibNumerique/ArteVOD.php
library/Class/WebService/BibNumerique/ArteVOD.php
+6
-1
library/Class/WebService/BibNumerique/ArteVOD/Config.php
library/Class/WebService/BibNumerique/ArteVOD/Config.php
+201
-0
library/Class/WebService/BibNumerique/Connectors.php
library/Class/WebService/BibNumerique/Connectors.php
+4
-0
library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
...ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
+8
-10
library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
...ary/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
+2
-3
library/ZendAfi/View/Helper/DigitalResource/Dashboard/Settings.php
...endAfi/View/Helper/DigitalResource/Dashboard/Settings.php
+0
-1
public/opac/js/digital_connectors.js
public/opac/js/digital_connectors.js
+4
-1
scripts/emacs/yasnippet/snippets/text-mode/php-mode/class
scripts/emacs/yasnippet/snippets/text-mode/php-mode/class
+1
-1
tests/application/modules/admin/controllers/BibnumControllerTest.php
...cation/modules/admin/controllers/BibnumControllerTest.php
+156
-0
No files found.
VERSIONS_WIP/100249
0 → 100644
View file @
19ad678e
- dev#100249 : Ressource numérique ARTE VOD : Ajout d'un Tableau de bord
\ No newline at end of file
application/modules/admin/controllers/BibnumController.php
View file @
19ad678e
...
...
@@ -25,6 +25,7 @@ class Admin_BibnumController extends ZendAfi_Controller_Action {
$this
->
view
->
titre
=
$this
->
_
(
'Liste des connecteurs disponibles'
);
}
public
function
collectionsAction
()
{
$categories
=
Class_AlbumCategorie
::
getCollections
();
...
...
@@ -42,4 +43,23 @@ class Admin_BibnumController extends ZendAfi_Controller_Action {
'categories'
=>
$albums
,
'items'
=>
[]]]);
}
public
function
artevodDashboardAction
(){
$this
->
view
->
titre
=
$this
->
_
(
'Accès ARTEVOD'
);
}
public
function
artevodTrySsoAction
()
{
$config
=
new
Class_WebService_BibNumerique_ArteVOD_Config
();
ZendAfi_Auth_Others
::
getInstance
()
->
swapUserWith
(
Class_Users
::
getIdentity
(),
$user
=
$config
->
getTestUser
());
$url
=
$config
->
urlFor
(
$user
,
$this
->
_request
->
getParams
());
return
$url
?
$this
->
_javascriptRedirectTo
(
$url
)
:
$this
->
_redirectToIndex
(
$this
->
_config
->
getNotAllowedMessage
());
}
}
\ No newline at end of file
application/modules/admin/views/scripts/bibnum/artevod-dashboard.phtml
0 → 100644
View file @
19ad678e
<?php
echo
$this
->
digitalResource_Dashboard
(
new
Class_WebService_BibNumerique_ArteVOD_Config
());
library/Class/DigitalResource/Config.php
View file @
19ad678e
...
...
@@ -61,6 +61,11 @@ class Class_DigitalResource_Config extends Class_Entity {
}
public
function
getDoctypeId
()
{
return
$this
->
getName
();
}
protected
function
_getDefaultConfig
()
{
return
[
'PhoneLabel'
=>
$this
->
_
(
'Accéder à la ressource'
),
'OtherBatches'
=>
[]];
...
...
@@ -120,7 +125,7 @@ class Class_DigitalResource_Config extends Class_Entity {
foreach
(
$this
->
getAdminVars
()
as
$key
=>
$meta
)
$vars
[]
=
$this
->
getDigitalResource
()
->
getAdminVarInstance
(
$key
);
return
$vars
;
return
array_filter
(
$vars
)
;
}
...
...
@@ -152,7 +157,7 @@ class Class_DigitalResource_Config extends Class_Entity {
public
function
getDescription
()
{
return
[
'label'
=>
static
::
getName
(),
'code'
=>
static
::
getName
(),
'doctype_id'
=>
static
::
get
Name
(),
'doctype_id'
=>
static
::
get
DoctypeId
(),
'url'
=>
$this
->
getUrl
(),
'image_url'
=>
$this
->
getIcon
(),
'desc'
=>
$this
->
getIntroduction
(),
...
...
@@ -300,7 +305,7 @@ class Class_DigitalResource_Config extends Class_Entity {
public
function
getRecordSsoUrl
(
$user
,
$record
)
{
return
$this
->
getAlbumSsoUrl
(
$
s
uer
,
$record
->
getAlbum
());
return
$this
->
getAlbumSsoUrl
(
$u
s
er
,
$record
->
getAlbum
());
}
...
...
@@ -324,13 +329,23 @@ class Class_DigitalResource_Config extends Class_Entity {
return
''
;
}
public
function
getTypeDocImage
(
$view
)
{
return
$view
->
tagImg
(
$view
->
url
([
'module'
=>
'opac'
,
'controller'
=>
'digital-resource'
,
'action'
=>
'typedoc-icon'
,
'id'
=>
$this
->
getName
()]),
[
'class'
=>
'error'
,
'alt'
=>
$this
->
_
(
'Aucune image'
)]);
}
public
function
getTestUser
()
{
$login
=
$this
->
getName
()
.
'_test_user'
;
$user
=
(
$user
=
Class_Users
::
findFirstBy
([
'login'
=>
$login
]))
?
$user
:
Class_Users
::
newInstance
([
'login'
=>
$login
,
'password'
=>
$login
]);
'password'
=>
$login
]);
$user
->
save
();
$group
=
$this
->
getTestGroup
();
...
...
@@ -413,4 +428,9 @@ class Class_DigitalResource_Config extends Class_Entity {
$this
->
_digital_resource
=
$resource
;
return
$this
;
}
public
function
renderTrySsoUrlOn
(
$view
,
$params
=
[])
{
return
$view
->
url
(
array_merge
(
$params
,
[
'action'
=>
'try-sso'
]));
}
}
\ No newline at end of file
library/Class/WebService/BibNumerique/ArteVOD.php
View file @
19ad678e
...
...
@@ -24,8 +24,13 @@ class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumeriqu
const
CATEGORY_LABEL
=
'ArteVOD'
;
public
function
getHarvestUrl
(
$page_number
){
return
$this
->
getBaseUrl
()
.
self
::
FILMS
.
'?page_nb='
.
$page_number
;
}
protected
function
loadPage
(
$page_number
=
1
)
{
$url
=
$this
->
get
BaseUrl
()
.
self
::
FILMS
.
'?page_nb='
.
$page_number
;
$url
=
$this
->
get
HarvestUrl
(
$page_number
)
;
$content
=
$this
->
open_authenticated_url
(
$url
);
if
(
''
==
$content
)
{
$this
->
getLogger
()
->
error
(
'Erreur de communication'
);
...
...
library/Class/WebService/BibNumerique/ArteVOD/Config.php
0 → 100644
View file @
19ad678e
<?php
/**
* Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_BibNumerique_ArteVOD_Config
extends
Class_Entity
{
use
Trait_Translator
;
protected
function
_getConfig
()
{
return
[
'Name'
=>
$this
->
_
(
'Artevod'
),
'Batch'
=>
'MOISSONNAGE_ARTEVOD'
,
'DocTypeLabel'
=>
$this
->
_
(
'ressource Artevod'
),
'PermissionLabel'
=>
$this
->
_
(
'Bibliothèque numérique: accéder à la ressource Artevod'
),
];
}
public
function
__construct
()
{
$this
->
_name
=
'Artevod'
;
$this
->
updateAttributes
(
$this
->
_getConfig
());
}
public
function
isEnabled
()
{
return
Class_AdminVar
::
isArteVODEnabled
();
}
public
function
getSsoUrl
(
$user
)
{
if
(
!
$user
)
return
''
;
return
(
Class_ArteVodLink
::
forUser
(
$user
)
->
url
());
}
public
function
getAlbumSsoUrl
(
$user
,
$album
)
{
if
(
!
$album
)
return
''
;
return
(
Class_ArteVodLink
::
forAlbumAndUser
(
$album
,
$user
)
->
url
());
}
public
function
withNameSpace
(
$value
)
{
return
$value
;
}
public
function
getDocType
()
{
return
Class_TypeDoc
::
ARTEVOD
;
}
public
function
getPermittedGroups
()
{
$groups
=
new
Storm_Collection
(
Class_UserGroup
::
findAll
());
return
array_filter
(
$groups
->
select
(
function
(
$group
)
{
return
$group
->
hasRight
(
Class_UserGroup
::
RIGHT_ACCES_ARTEVOD
);
})
->
getArrayCopy
());
}
public
function
hasRightAccess
(
$user
)
{
return
true
;
}
public
function
getBatchInstance
()
{
return
new
Class_Batch_ArteVOD
();
}
public
function
getHarvestUrl
(
$page
=
1
)
{
return
(
new
Class_WebService_BibNumerique_ArteVOD
())
->
getHarvestUrl
(
$page
);
}
public
function
getTypeDocImage
(
$view
){
return
$view
->
iconeSupport
(
$this
->
getDocType
());
}
public
function
getTestUser
()
{
$login
=
$this
->
getName
()
.
'_test_user'
;
$user
=
(
$user
=
Class_Users
::
findFirstBy
([
'login'
=>
$login
]))
?
$user
:
Class_Users
::
newInstance
([
'login'
=>
$login
,
'password'
=>
$login
]);
$user
->
save
();
$group
=
$this
->
getTestGroup
();
$group
->
addUser
(
$user
)
->
save
();
Class_Users
::
clearCache
();
return
Class_Users
::
find
(
$user
->
getId
());
}
public
function
getTestGroup
()
{
$group_name
=
$this
->
getName
()
.
'_test_group'
;
$group
=
(
$group
=
Class_UserGroup
::
findFirstBy
([
'libelle'
=>
$group_name
]))
?
$group
:
Class_UserGroup
::
newInstance
([
'libelle'
=>
$group_name
]);
$group
->
save
();
if
(
!
$permission
=
Class_Permission
::
findFirstBy
([
'code'
=>
$this
->
getName
()]))
return
$group
;
$permission
->
permitTo
(
$group
,
new
Class_Entity
());
Class_UserGroup
::
clearCache
();
return
Class_UserGroup
::
find
(
$group
->
getId
());
}
public
function
isHarvestingEnabled
()
{
return
Class_Batch
::
findFirstBy
([
'type'
=>
$this
->
getBatch
()]);
}
public
function
getAdminVarsInstances
()
{
return
[
Class_AdminVar
::
find
(
'ARTE_VOD_LOGIN'
),
Class_AdminVar
::
find
(
'ARTE_VOD_KEY'
),
Class_AdminVar
::
find
(
'ARTE_VOD_SSO_KEY'
)
];
}
public
function
urlFor
(
$user
,
$params
=
[])
{
if
(
!
$user
)
return
;
if
(
!
$this
->
hasRightAccess
(
$user
))
return
;
if
(
!
$this
->
isEnabled
())
return
;
$link
=
Class_ArteVodLink
::
forUser
(
$user
);
if
(
isset
(
$params
[
'album_id'
]))
{
$album
=
Class_Album
::
find
(
$params
[
'album_id'
]);
$link
=
Class_ArteVodLink
::
forAlbumAndUser
(
$album
,
$user
);
}
return
$link
->
url
();
}
public
function
renderHarvestDiagOn
(
$view
)
{
return
''
;
}
public
function
renderCustomDiagOn
(
$view
)
{
return
''
;
}
public
function
renderSSODiagOn
(
$view
)
{
return
''
;
}
public
function
countAlbums
(){
return
Class_Album
::
countBy
([
'type_doc_id'
=>
$this
->
getDocType
()]);
}
public
function
getSsoAction
()
{
return
'artevod'
;
}
public
function
renderTrySsoUrlOn
(
$view
,
$params
=
[])
{
return
$view
->
url
(
array_merge
(
$params
,
[
'action'
=>
'artevod-try-sso'
]));
}
}
\ No newline at end of file
library/Class/WebService/BibNumerique/Connectors.php
View file @
19ad678e
...
...
@@ -54,6 +54,10 @@ class Class_WebService_BibNumerique_Connectors {
?
''
:
call_user_func
([
'Class_AdminVar'
,
$connector
[
"enabled"
]]);
if
(
isset
(
$connector
[
'dashboard'
]))
$connector
[
'dashboard_url'
]
=
Class_Url
::
absolute
(
$connector
[
'dashboard'
],
null
,
true
);
$connector
[
'code'
]
=
$key
;
$type_doc_constant
=
'Class_TypeDoc::'
.
strtoupper
(
$key
);
...
...
library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
View file @
19ad678e
...
...
@@ -37,16 +37,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View
$html
[]
=
$this
->
_getBatchHtml
(
$config
);
$html
[]
=
$this
->
_getHarvestHtml
(
$config
);
$html
[]
=
$this
->
_tag
(
'h4'
,
$this
->
_
(
'Image du type de document: '
)
.
$this
->
view
->
tagImg
(
$this
->
view
->
url
([
'module'
=>
'opac'
,
'controller'
=>
'digital-resource'
,
'action'
=>
'typedoc-icon'
,
'id'
=>
$config
->
getName
()]),
[
'class'
=>
'error'
,
'alt'
=>
$this
->
_
(
'Aucune image'
)]));
$html
[]
=
$this
->
_getTypeDocImage
(
$config
);
$html
[]
=
$this
->
_getAlbumsHtml
(
$config
);
$html
[]
=
$this
->
_getRecordsHtml
(
$config
);
...
...
@@ -54,6 +45,13 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View
}
protected
function
_getTypedocImage
(
$config
){
return
$this
->
_tag
(
'h4'
,
$this
->
_
(
'Image du type de document: '
)
.
$config
->
getTypeDocImage
(
$this
->
view
));
}
protected
function
_renderThumbnailerLog
(
$album
)
{
$thumbnailer
=
Class_WebService_BibNumerique_Vignette
::
getInstance
();
$thumbnailer
->
setLogger
(
new
Class_Log
);
...
...
library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
View file @
19ad678e
...
...
@@ -72,7 +72,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel
:
$this
->
_getSSOHtml
(
$config
,
$user
);
$html
[]
=
$this
->
view
->
button
((
new
Class_Entity
)
->
setUrl
(
$
this
->
view
->
url
([
'action'
=>
'try-sso'
]
))
->
setUrl
(
$
config
->
renderTrySsoUrlOn
(
$this
->
view
))
->
setText
(
$this
->
_
(
'Essayer le SSO avec l\'utilisateur "%s"'
,
$user
->
getLogin
())));
...
...
@@ -105,8 +105,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel
'data-popup'
=>
'true'
]))
.
$this
->
_getSSOHtml
(
$config
,
$user
,
$album
)
.
$this
->
view
->
button
((
new
Class_Entity
)
->
setUrl
(
$this
->
view
->
url
([
'action'
=>
'try-sso'
,
'album_id'
=>
$album
->
getId
()]))
->
setUrl
(
$config
->
renderTrySsoUrlOn
(
$this
->
view
,
[
'album_id'
=>
$album
->
getId
()]))
->
setText
(
$this
->
_
(
'Essayer le SSO avec l\'utilisateur "%s" pour l\'album "%s"'
,
$user
->
getLogin
(),
$album
->
getTitre
())));
...
...
library/ZendAfi/View/Helper/DigitalResource/Dashboard/Settings.php
View file @
19ad678e
...
...
@@ -59,7 +59,6 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Settings extends ZendAfi_Vie
'anchorOptions'
=>
[
'data-popup'
=>
true
],
'label'
=>
$this
->
_
(
'Modifier "%s"'
,
$model
->
getClef
())]]);
});
return
$this
->
view
->
renderTable
(
$description
,
$config
->
getAdminVarsInstances
());
}
...
...
public/opac/js/digital_connectors.js
View file @
19ad678e
...
...
@@ -38,7 +38,10 @@
"
url
"
:
"
http://www.mediatheque-numerique.com/
"
,
"
image_url
"
:
"
https://bokeh-library-portal.org/userfiles/media/ressources_numeriques/arte_vod.png
"
,
"
desc
"
:
"
Le meilleur du catalogue d'ARTE (grands documentaires, collections emblématiques, spectacles, émissions phares, cinéma patrimonial et contemporain)
"
,
"
features
"
:
[
"
HARVEST
"
,
"
SSO
"
],
"
features
"
:
[
"
HARVEST
"
,
"
SSO
"
],
"
dashboard
"
:
{
"
module
"
:
"
admin
"
,
"
controller
"
:
"
bibnum
"
,
"
action
"
:
"
artevod-dashboard
"
},
"
sales_contact
"
:
{
"
mail
"
:
"
contact@mediatheque-numerique.com
"
,
"
name
"
:
"
Caroline Ghienne
"
,
"
url
"
:
"
http://www.mediatheque-numerique.com/inscription-mediatheque
"
}
...
...
scripts/emacs/yasnippet/snippets/text-mode/php-mode/class
View file @
19ad678e
...
...
@@ -3,7 +3,7 @@
# --
<?php
/**
* Copyright (c) 2012-20
19
, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-20
20
, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
...
...
tests/application/modules/admin/controllers/BibnumControllerTest.php
View file @
19ad678e
...
...
@@ -71,6 +71,12 @@ class Admin_BibnumControllerIndexTest extends Admin_AbstractControllerTestCase {
public
function
biliondemandDashBordShouldBePresent
()
{
$this
->
assertXPathContentContains
(
'//table[@class="digital_connectors"]//tr[@data-code="bibliondemand"]/td//button'
,
'Tableau de bord'
);
}
/** @test */
public
function
arteVodDashBoardShouldBePresent
()
{
$this
->
assertXPathContentContains
(
'//table[@class="digital_connectors"]//tr[@data-code="artevod"]/td//button'
,
'Tableau de bord'
);
}
}
...
...
@@ -133,4 +139,154 @@ class Admin_BibnumControllerTreeSelectTest extends Admin_AbstractControllerTestC
$this
->
assertEquals
(
json_encode
(
$expected
),
$this
->
_response
->
getBody
());
}
}
class
Admin_BibnumControllerArteVodDashboardTest
extends
Admin_AbstractControllerTestCase
{
protected
$_storm_default_to_volatile
=
true
;
public
function
setUp
(){
parent
::
setUp
();
Class_AdminVar
::
set
(
'ARTE_VOD_SSO_KEY'
,
'123'
);
Class_AdminVar
::
set
(
'ARTE_VOD_KEY'
,
'123'
);
Class_AdminVar
::
set
(
'ARTE_VOD_LOGIN'
,
'123'
);
$this
->
fixture
(
'Class_UserGroup'
,
[
'id'
=>
42
,
'libelle'
=>
'Accès ARTEVOD'
])
->
addRight
(
Class_UserGroup
::
RIGHT_ACCES_ARTEVOD
);
$this
->
fixture
(
'Class_Batch'
,
[
'id'
=>
12
,
'type'
=>
Class_Batch_ArteVOD
::
TYPE
,
'pick_day'
=>
'1'
]);
$codif_type_doc
=
$this
->
fixture
(
'Class_CodifTypeDoc'
,
[
'id'
=>
Class_TypeDoc
::
ARTEVOD
,
'famille_id'
=>
Class_CodifTypeDoc
::
INCONNU
,
'bibliotheques'
=>
'1;8'
,
'annexes'
=>
'10;12'
,
'sections'
=>
'18;19'
]);
$this
->
fixture
(
'Class_TypeDoc'
,
[
'id'
=>
Class_TypeDoc
::
ARTEVOD
,
'codif_type_doc'
=>
$codif_type_doc
,
'label'
=>
'Type doc'
]);
$album
=
$this
->
fixture
(
'Class_Album'
,
[
'id'
=>
13
,
'titre'
=>
'Etre et Avoir'
,
'visible'
=>
1
,
'status'
=>
3
,
'fichier'
=>
'etreetavoir.png'
,
'external_uri'
=>
'http://www.mediatheque-numerique.com/films/etre-et-avoir'
]);
$album
->
beArteVOD
()
->
addPosterURI
(
'http://myposter.png'
)
->
save
();
$album
->
setFileSystem
(
$this
->
mock
()
->
whenCalled
(
'file_exists'
)
->
with
(
'./userfiles/album/13/thumb_etreetavoir.png'
)
->
answers
(
true
));
Class_WebService_Vignette
::
setHttpClient
(
$this
->
mock
()
->
whenCalled
(
'open_url'
)
->
with
(
'http://myposter.png'
)
->
answers
(
true
)
->
whenCalled
(
'getResponse'
)
->
answers
((
new
Class_Testing_HttpResponse
)));
Class_Album
::
setMemoryCleaner
(
function
()
{});
Class_Album
::
find
(
13
)
->
index
();
$this
->
dispatch
(
'/admin/bibnum/artevod-dashboard'
);
}
/** @test */
public
function
arteVodDashboardPageShouldExist
()
{
$this
->
assertXPathContentContains
(
'//table'
,
'ARTE_VOD_SSO_KEY'
);
$this
->
assertXPathContentContains
(
'//table'
,
'ARTE_VOD_LOGIN'
);
$this
->
assertXPathContentContains
(
'//table'
,
'ARTE_VOD_KEY'
);
}
/** @test */
public
function
arteVodPermissionsTableWithAccesARTEVODShouldBeDisplayed
()
{
$this
->
assertXPathContentContains
(
'//table'
,
'Accès ARTEVOD'
);
}
/** @test */
public
function
arteVodSSOConfigurationShouldContainsTestLink
()
{
$this
->
assertXPathContentContains
(
'//h4'
,
'URL SSO générée par /modules/artevod'
);
}
/** @test */
public
function
arteVodSSOTestLinkShouldBeURL
()
{
$this
->
assertXPathContentContains
(
'//pre'
,
'vod.mediatheque-numerique.com%2Fmediatheques%2F123'
);
}
/** @test */
public
function
arteVodHarvestShouldDisplayMoissonerCatalogueArteVOD
()
{
$this
->
assertXPathContentContains
(
'//td'
,
'Moissonner catalogue ArteVOD'
,
$this
->
_response
->
getBody
());
}
/** @test */
public
function
arteVODHarvestLinkShouldBeVodMediathequeNumerique
()
{
$this
->
assertXPathContentContains
(
'//pre'
,
'https://vod.mediatheque-numerique.com/api/v1/films?page_nb=1'
);
}
/** @test */
public
function
iconARTEVODShouldBeDisplayed
()
{
$this
->
assertXPathContentContains
(
'//img/@src'
,
'/images/supports/artevod.png'
);
}
/** @test */
public
function
arteVodDashboardShouldDisplayThumbnail
()
{
$this
->
assertXPathContentContains
(
'//pre'
,
'Image source : http://myposter.png'
);
}
/** @test */
public
function
numberOfAlbumShouldBeDisplayed
()
{
$this
->
assertXPathContentContains
(
'//h4'
,
'Nombre de notices présentes dans Bokeh : 1'
,
$this
->
_response
->
getBody
());
}
}
class
Admin_BibnumControllerArteVodDashboardSsoTest
extends
Admin_AbstractControllerTestCase
{
public
function
setUp
(){
parent
::
setUp
();
Class_AdminVar
::
set
(
'ARTE_VOD_SSO_KEY'
,
'123'
);
Class_AdminVar
::
set
(
'ARTE_VOD_KEY'
,
'123'
);
Class_AdminVar
::
set
(
'ARTE_VOD_LOGIN'
,
'123'
);
$this
->
fixture
(
'Class_UserGroup'
,
[
'id'
=>
42
,
'libelle'
=>
'Accès ARTEVOD'
])
->
addRight
(
Class_UserGroup
::
RIGHT_ACCES_ARTEVOD
);
$user
=
$this
->
fixture
(
'Class_Users'
,
[
'id'
=>
5
,
'login'
=>
'super_admin'
,
'password'
=>
'super'
,
'role_level'
=>
ZendAfi_Acl_AdminControllerRoles
::
SUPER_ADMIN
]);
ZendAfi_Auth
::
getInstance
()
->
logUser
(
$user
);
$this
->
dispatch
(
'/admin/bibnum/artevod-try-sso'
);
}
/** @test */
public
function
shouldJavascriptRedirectToPortalMediathequeNumeriqueDotComSsoLogin
()
{
$this
->
assertXPathContentContains
(
'//script'
,
'https://portal.medi