Commit 6befbd10 authored by Patrick Barroca's avatar Patrick Barroca 🐧

Merge branch 'hotline' into 'master'

Hotline

See merge request !3442
parents 0582a0dd 40cc2e69
Pipeline #9725 passed with stage
in 51 minutes and 51 seconds
23/03/2020 - v8.0.45
- ticket #108047 : Ressources numériques : L'accès à une ressource s'appuie exclusivement sur l'appartenance aux groupes
- ticket #79470 : Ressources numériques : Amélioration de la reconnaissance des urls de vignettes PNB
- ticket #106879 : Ressources numériques : Correction du moissonnage ArteVOD pour filtrer les films selon le pays de diffusion, par défaut la France
- ticket #108117 : Administration : L'activation du magasin de thèmes devient accessible aux administrateurs du portail
- ticket #107991 : Groupes d'utilisateurs : Correction du critère "âge".
- ticket #106864 : Newsletter : Il n'est plus possible de modifier ou supprimer le groupe manuel dédié à chaque newsletter
17/03/2020 - v8.0.44
- ticket #106075 : Compte lecteur : Ajout de la prise en charge de serveurs d'identité tiers France Connect, Google et plus généralement OpenId
- ticket #76799 : Compte lecteur : correction de la mise à jour des cartes liées.
- ticket #93357 : SIGB : Ajout du connecteur Decalog Flora
- ticket #86543 : SIGB Koha : Prise en compte des contraintes de mot de passe fort
- ticket #106412 : Version mobile : correction d'une erreur lorsqu'un abonné faisant partie d'un groupe dynamique se connectait
......
'93357' =>
['Label' => $this->_('SIGB Decalog Flora'),
'Desc' => $this->_('Support des web services du SIGB Decalog Flora (disponibilité temps réel, réservations, compte lecteur)'),
'Image' => '',
'Video' => '',
'Category' => $this->_('Communication SIGB'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=SIGB_Flora',
'Test' => '',
'Date' => '2020-01-23'],
\ No newline at end of file
- ticket #106988 : Intégrations : correction de la détection du type de document basé sur un sous-champ de la zone exemplaire autre que 995
\ No newline at end of file
- ticket #93357 : Ajout du connecteur SIGB Decalog Flora
\ No newline at end of file
......@@ -1134,13 +1134,19 @@ class notice_unimarc extends iso2709_record {
$label = $this->inner_guide['dt'] . $this->inner_guide['bl'];
$champ_code_barres = $this->getBarcode();
if (!isset($this->profil['attributs'][0]['item_zone']) || !$zone = $this->profil['attributs'][0]['item_zone'])
$zone = '995';
if ($this->profil['attributs'][0]['champ_type_doc']) {
$zone = (strlen($champ_code_barres) == 3) ? $champ_code_barres : '995';
$zone = (strlen($champ_code_barres) == 3) // legacy: before 'champ_type_doc' could equal '996' or '852', which has been deprecated by introduction of 'item_zone'. Need to check if some sites in production still uses these values (some tests does...)
? $champ_code_barres
: $zone;
$z995r = $this->get_subfield($zone,
$this->profil['attributs'][0]['champ_type_doc']);
} else {
$z995r = $this->get_subfield('995', 'r');
$z995p = $this->get_subfield('995', 'p');
$z995r = $this->get_subfield($zone, 'r');
$z995p = $this->get_subfield($zone, 'p');
if($champ_code_barres == '997')
$z995r = $this->get_subfield('997', 't');
elseif($champ_code_barres == '852')
......
......@@ -244,4 +244,52 @@ class PMBIntegrationSerialsTest extends PMBIntegrationRecordsTestCase {
$this->assertEquals('Revue française de pédagogie',
Class_Notice::findFirstBy(['type_doc' => 2])->getTitreChapeau());
}
}
class PMBIntegrationSerialsBretagneSacreeTest extends PMBIntegrationRecordsTestCase {
public function getProfilDonnees() {
return Class_IntProfilDonnees::forPMB()
->setIdProfil(115)
->setAccents(Class_IntProfilDonnees::ENCODING_UTF8)
->setTypeDocField('e')
->setBarCodeField('f')
->setItemZone(996)
->setTypeDocRecognition(Class_TypeDoc::PERIODIQUE, '', 'PERIODIQUE')
->getRawAttributes();
}
public function setUp() {
parent::setUp();
$this->loadRecordsFromFile('unimarc_bretagne_sacree');
}
/** @test */
public function numberOfRecordsShouldBeTwentyOne() {
$this->assertEquals(21, Class_Notice::countBy([]));
}
/** @test */
public function numberOfPeriodiqueTitleShouldBeTwo() {
$records = Class_Notice::findAllBy(['type_doc' => 'per_title']);
$this->assertEquals(2, Class_Notice::countBy(['type_doc' => 'per_title']));
}
/** @test */
public function numberOfPeriodiqueArticleShouldBeEighteen() {
$this->assertEquals(18, Class_Notice::countBy(['type_doc' => 'per_art']));
}
/** @test */
public function numberOfPeriodiqueShouldBeOne() {
$this->assertEquals(1, Class_Notice::countBy(['type_doc' => 2]));
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -143,11 +143,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
protected function _getTemplatingVars() {
return [
'TEMPLATING' => Class_AdminVar_Meta::newOnOff('Active l\'accès au magasin de thèmes',
['value' => 0])->bePrivate(),
'TEMPLATING' => Class_AdminVar_Meta::newOnOff($this->_('Active l\'accès au magasin de thèmes'),
['value' => 0]),
'MYBIBAPP_TEMPLATE' => Class_AdminVar_Meta::newOnOff('Active la génération automatique du thème pour MyBibApp',
['value' => 0])->bePrivate()
'MYBIBAPP_TEMPLATE' => Class_AdminVar_Meta::newOnOff($this->_('Active la génération automatique du thème pour MyBibApp'),
['value' => 0])
];
}
......@@ -226,6 +226,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'ARTE_VOD_LOGIN' => Class_AdminVar_Meta::newDefault($this->_('Login utilisé pour générer l\'adresse https://vod.mediatheque-numerique.com/mediatheques/[ARTE VOD LOGIN]'))->bePrivate(),
'ARTE_VOD_KEY' => Class_AdminVar_Meta::newDefault($this->_('Clé de moissonnage (optionelle)'))->bePrivate(),
'ARTE_VOD_SSO_KEY' => Class_AdminVar_Meta::newDefault($this->_('Clé de cryptage lors du SSO'))->bePrivate(),
'ARTE_VOD_COUNTRY' => Class_AdminVar_Meta::newDefault($this->_('Pays de diffusion utilisé lors du moissonnage (par défaut FR, ALL pour ne pas filtrer)'),
['value' => 'FR'])->bePrivate(),
'NUMERIQUE_PREMIUM_URL' => Class_AdminVar_Meta::newDefault('')->bePrivate(),
......
......@@ -76,7 +76,7 @@ class Class_ArteVodLink {
'nom' => $this->_user->getNom(),
'email' => $this->_user->getMail(),
'dnaiss' => $this->_user->getNaissance(),
'datout' => $this->_user->getDateFin(),
'datout' => $this->_user->getValidSubscriptionEndDate(),
'return_url' => $this->baseUrl(),
'referer' => Class_Url::getProtocol(). Class_AdminVar::getNomDomaine()];
......
......@@ -152,9 +152,6 @@ class Class_DigitalResource extends Class_Entity {
if (!$this->isPluginDocType($plugin))
return false;
if ($user->isAbonne() && !$user->isAbonnementValid())
return false;
if(!$this->hasPermissionOn($plugin, $user))
return false;
......
......@@ -796,6 +796,7 @@ class Class_Feature_List {
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Import_des_p%C3%A9riodiques_Koha_dans_Bokeh',
'Test' => '',
'Date' => '2020-02-06'],
'106075' =>
['Label' => $this->_('Serveurs d\'identité tiers'),
'Desc' => $this->_('Bokeh permet aux abonnés d\'associer leurs comptes FranceConnect, Google et plus généralement OpenId à leur compte Bokeh.'),
......@@ -807,6 +808,16 @@ class Class_Feature_List {
'Test' => '',
'Date' => '2020-02-27'],
'93357' =>
['Label' => $this->_('SIGB Decalog Flora'),
'Desc' => $this->_('Support des web services du SIGB Decalog Flora (disponibilité temps réel, réservations, compte lecteur)'),
'Image' => '',
'Video' => '',
'Category' => $this->_('Communication SIGB'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=SIGB_Flora',
'Test' => '',
'Date' => '2020-01-23'],
];
}
}
\ No newline at end of file
......@@ -376,7 +376,7 @@ class Class_FileManager_FileSystem {
$found = array_slice($found, 0, Class_FileManager_FileSystem::LISTING_LIMIT);
}
return array_filter(array_map([Class_FileManager, 'find'], $found));
return array_filter(array_map([Class_FileManager::class, 'find'], $found));
};
return (new Storm_Cache())
......
......@@ -984,6 +984,11 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
}
public function setItemZone($value) {
return $this->setItemField(self::FIELD_ITEM_ZONE, $value);
}
public function getBarCodeField() {
return unserialize($this->getAttributs())[0][self::FIELD_ITEM_BARCODE];
}
......
......@@ -92,10 +92,11 @@ class Class_User_SearchCriteriaValidSubscription extends Class_SearchCriteria_Ab
}
public function modelMatch($user) {
return $user->isAbonne()
? $user->isAbonnementValid()
: true;
public function modelMatch($model) {
if (!$this->_should_filter)
return true;
return $model->isValid();
}
......
......@@ -79,7 +79,7 @@ class Class_User_SearchCriteria_Age extends Class_SearchCriteria_Abstract {
if ($this->_hasFrom()
&& ($date = $this->substractYearsToCurrentDate((int)$this->_from))
&& $user->getNaissance() < $date) {
&& $user->getNaissance() > $date) {
return false;
}
......@@ -87,7 +87,7 @@ class Class_User_SearchCriteria_Age extends Class_SearchCriteria_Abstract {
return true;
$date = $this->substractYearsToCurrentDate((int)$this->_to);
return $user->getNaissance() <= $date;
return $user->getNaissance() >= $date;
}
......
......@@ -28,7 +28,7 @@ class UserGroupLoader extends Storm_Model_Loader {
public function save($model) {
$result = parent::save($model);
if ($model->isDynamic())
$this->_dynamics_of_user_cache = [];
$this->resetDynamicsOfUserCache();
return $result;
}
......@@ -123,9 +123,18 @@ class UserGroupLoader extends Storm_Model_Loader {
}
public function resetDynamicsOfUserCache() {
$this->_dynamics_of_user_cache = [];
return $this;
}
protected function _realFindAllDynamicsOf($user) {
return array_filter(Class_UserGroup::findAllDynamics(),
function($group) use($user) { return $group->hasUser($user); });
function($group) use($user)
{
return $group->hasUser($user);
});
}
}
......
......@@ -874,13 +874,6 @@ class Class_Users extends Storm_Model_Abstract {
}
public function isAbonneAndHasRightToAccess($access_name) {
if ($this->isAbonne() && !$this->isAbonnementValid())
return false;
return $this->hasRightToAccess($access_name);
}
/**
* @return array
*/
......@@ -965,57 +958,57 @@ class Class_Users extends Storm_Model_Abstract {
* @return bool
*/
public function hasRightAccessNumeriquePremium() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_NUMERIQUEPREMIUM);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_NUMERIQUEPREMIUM);
}
public function hasRightAccesArteVod() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_ARTEVOD);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_ARTEVOD);
}
public function hasRightAccesNumilog() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_NUMILOG);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_NUMILOG);
}
public function hasRightAccesVodeclic() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_VODECLIC);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_VODECLIC);
}
public function hasRightAccessCyberlibris() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_CYBERLIBRIS);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_CYBERLIBRIS);
}
public function hasRightAccessCiteDeLaMusique() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCESS_CITEDELAMUSIQUE);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCESS_CITEDELAMUSIQUE);
}
public function hasRightAccessMyCow() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_MYCOW);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_MYCOW);
}
public function hasRightAccessPlanetNemo() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_PLANETNEMO);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_PLANETNEMO);
}
public function hasRightAccesKidilangues() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_KIDILANGUES);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_KIDILANGUES);
}
public function hasRightAccessDilicom() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCES_PNB_DILICOM);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCES_PNB_DILICOM);
}
public function hasRightAccessLeSocial() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCESS_LESOCIAL);
return $this->hasRightToAccess(Class_UserGroup::RIGHT_ACCESS_LESOCIAL);
}
......@@ -1930,4 +1923,11 @@ class Class_Users extends Storm_Model_Abstract {
$this->save();
return $this;
}
public function getValidSubscriptionEndDate() {
if ($this->getDateFin() && ($this->getDateFin()) > ($this->getCurrentDate()))
return $this->getDateFin();
return $this->addDaysToCurrentDate(30);
}
}
......@@ -20,12 +20,18 @@
*/
class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumerique_Abstract {
const FILMS = 'films';
const CATEGORY_LABEL = 'ArteVOD';
const
FILMS = 'films',
CATEGORY_LABEL = 'ArteVOD',
COUNTRY_ALL = 'ALL';
public function getHarvestUrl($page_number){
return $this->getBaseUrl() . self::FILMS . '?page_nb=' . $page_number;
public function getHarvestUrl($page_number) {
$params = ['page_nb' => (int)$page_number];
if (static::COUNTRY_ALL !== ($country = Class_AdminVar::getValueOrDefault('ARTE_VOD_COUNTRY')))
$params['q_country'] = $country;
return $this->getBaseUrl() . static::FILMS . '?' . http_build_query($params);
}
......@@ -46,7 +52,8 @@ class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumeriqu
public function open_authenticated_url($url) {
$client = $this->getWebClient();
return ($user = trim(Class_AdminVar::get('ARTE_VOD_LOGIN'))) && ($password = trim(Class_AdminVar::get('ARTE_VOD_KEY')))
return ($user = trim(Class_AdminVar::get('ARTE_VOD_LOGIN')))
&& ($password = trim(Class_AdminVar::get('ARTE_VOD_KEY')))
? $client->open_url($url, ['auth' => ['user' => $user,
'password' => $password]])
: $client->open_url($url);
......
......@@ -142,9 +142,12 @@ class Class_WebService_BibNumerique_ArteVOD_Config extends Class_Entity {
public function getAdminVarsInstances() {
return [ Class_AdminVar::find('ARTE_VOD_LOGIN'),
Class_AdminVar::find('ARTE_VOD_KEY'),
Class_AdminVar::find('ARTE_VOD_SSO_KEY')
Class_AdminVar::init();
return [Class_AdminVar::find('ARTE_VOD_LOGIN'),
Class_AdminVar::find('ARTE_VOD_KEY'),
Class_AdminVar::find('ARTE_VOD_SSO_KEY'),
Class_AdminVar::find('ARTE_VOD_COUNTRY'),
];
}
......
......@@ -175,6 +175,16 @@ class ZendAfi_Controller_Plugin_Manager_UserGroup extends ZendAfi_Controller_Plu
}
protected function _canEdit($model) {
return !$model->isDedicated();
}
protected function _canDelete($model) {
return !$model->isDedicated();
}
protected function _getPost($key = null, $default = null) {
$post = $this->_request->getPost();
if(!isset($post[ZendAfi_Form_Admin_UserGroup::RIGHTS_PERMISSIONS]))
......@@ -261,25 +271,33 @@ class ZendAfi_Controller_Plugin_Manager_UserGroup extends ZendAfi_Controller_Plu
protected function _getLeafsActions($model) {
return [
['url' => '/admin/usergroup/editmembers/id/%s',
'icon' => 'users',
'label' => $this->_('Membres'),
'caption' => 'formatedCount'
],
['url' => '/admin/usergroup/edit/id/%s',
'icon' => 'edit',
'label' => $this->_('Modifier'),
],
['url' => '/admin/usergroup/delete/id/%s',
'icon' => 'delete',
'label' => $this->_('Supprimer'),
'anchorOptions' => [
'onclick' => "return confirm('Etes-vous sûr de vouloir supprimer ce groupe ?')"
]]
];
$actions = [['url' => '/admin/usergroup/editmembers/id/%s',
'icon' => 'users',
'label' => $this->_('Membres'),
'caption' => 'formatedCount'
]];
if ($model->isDedicatedTo(Class_Newsletter::class)) {
$actions[] = ['url' => '/admin/newsletter/edit-subscribers/id/' . $model->getModelId(),
'icon' => 'back',
'label' => $this->_('Retour aux destinataires de la lettres')];
return $actions;
}
return array_merge($actions,
[
['url' => '/admin/usergroup/edit/id/%s',
'icon' => 'edit',
'label' => $this->_('Modifier'),
],
['url' => '/admin/usergroup/delete/id/%s',
'icon' => 'delete',
'label' => $this->_('Supprimer'),
'anchorOptions' => [
'onclick' => "return confirm('Etes-vous sûr de vouloir supprimer ce groupe ?')"
]]
]);
}
}
?>
\ No newline at end of file
......@@ -29,6 +29,7 @@ class ZendAfi_Validate_VignetteUrl extends Zend_Validate_Abstract {
'www\.adav-assoc\.com\/.*\/GetImage\/',
'\/dam_picture.php\?id=',
'\/getimage.php\?url_image=',
'assets\.edenlivres\.fr',
];
......
......@@ -236,9 +236,7 @@ class Cvs_Service {
'dnaiss' => (($naissance = $user->getNaissance())
? Class_Date::frToIso($naissance)
: ''),
'datout' => (($finabo = $user->getDateFin())
? Class_Date::frToIso($finabo)
: ''),
'datout' => Class_Date::frToIso($user->getValidSubscriptionEndDate()),
'bibliotheque' => (($label = $this->_var('BMLABEL'))
? $label : $user->getLibelleBib())]);
......
......@@ -29,6 +29,7 @@ abstract class CvsActivatedTestCase extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_Users::setTimeSource(new TimeSourceForTest('2020-03-10'));
Class_AdminVar::set('Cvs_BMKEY', '22222');
Class_AdminVar::set('Cvs_BMID', '22223');
......@@ -648,6 +649,7 @@ class CvsSearchWithDemoAccountTest extends CvsActivatedTestCase {
<page><![CDATA[1]]></page>
<nombre_par_page><![CDATA[5]]></nombre_par_page>
<login>cvs_login_test</login>
<datout>2020-04-09</datout>
</body>
</albums>';
......@@ -792,6 +794,100 @@ l’école primaire, l’adaptation du matériel aux pratiques pédagogiques.',
class CvsSearchWithJerryExpiredLoggedTest extends CvsActivatedTestCase {
protected
$_cvs,
$_result;
public function setUp() {
parent::setUp();
$jerry = $this->fixture('Class_Users',
['id' => 4,
'idabon' => 34,
'login' => 34,
'pseudo' => 'J&Khan',
'prenom' => 'Jerry',
'nom' => 'Khan',
'mail' => 'feu@essence.fr',
'password' => 'secret',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
'id_site' => 1,
'date_fin' => '2000-09-02',
'naissance' => '1977-06-27']);
$jerry->setBib($this->fixture('Class_Bib',
['id' => 34,
'libelle' => 'Annecy']));
ZendAfi_Auth::getInstance()->logUser($jerry);
$this->_cvs = new Cvs_Service;
$http_client = $this
->mock()
->whenCalled('postData')
->with(Class_AdminVar::get('Cvs_API_URL'),
['xml' => $this->_expectedXML()])
->answers($this->_returnedXML())
->beStrict();
Class_WebService_Abstract::setHttpClient($http_client);
$this->_result = $this->_cvs->find('ecole', 1, 5);
}
protected function _expectedXML() {
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<albums>
<header>
<bmid>22223</bmid>
<sourceid>22225</sourceid>
<key>d0a1b72e8e6d7af27d400e2009c1a873</key>
<time>1369640315</time>
<adhid>34</adhid>
<action>search_document</action>
</header>
<body>
<q><![CDATA[ecole]]></q>
<espace><![CDATA[]]></espace>
<classement><![CDATA[consultes]]></classement>
<page><![CDATA[1]]></page>
<nombre_par_page><![CDATA[5]]></nombre_par_page>
<login>34</login>
<nom>Khan</nom>
<prenom>Jerry</prenom>
<pseudo>J&amp;Khan</pseudo>
<password>secret</password>
<email>feu@essence.fr</email>
<dnaiss>1977-06-27</dnaiss>
<datout>2020-04-09</datout>
<bibliotheque>Annecy</bibliotheque>
</body>
</albums>";
$dom = $this->_cvs->createDomDocument();
$dom->loadXML($xml);
return $this->_cvs->getEncodedXML($dom->saveXML());
}
protected function _returnedXML() {
return file_get_contents(__DIR__ . '/cvs_search_ecole.xml');
}
/** @test */
public function searchEcoleShouldReturnTitleForFirstNoticeEtreEtAvoir() {
$this->assertEquals('Etre et avoir',
$this->_result->getRecords()[0]->getTitrePrincipal());
}
}
class CvsLinkWithBorrowerTest extends CvsActivatedTestCase {
protected
......@@ -1036,6 +1132,7 @@ class CvsSearchWithAnonymousAccessTest extends CvsActivatedTestCase {
<page><![CDATA[1]]></page>
<nombre_par_page><![CDATA[5]]></nombre_par_page>
<login>cvs_login_test</login>
<datout>2020-04-09</datout>
</body>
</albums>';
......
......@@ -89,7 +89,7 @@ class LesYeuxDoc_Config extends Class_DigitalResource_Config {
'nom' => $user->getNom(),
'email' => $user->getMail(),
'dnaiss' => ($date = $user->getNaissance()) ? $date : '',
'datout' => $user->getDateFin(),
'datout' => $user->getValidSubscriptionEndDate(),
'return_url' => $return_url];
return $this->getAdminVar('SSO_URL')
......
......@@ -77,6 +77,8 @@ class LesYeuDocDashboardTestCase extends LesYeuxDocActivatedTestCase {
public function setUp() {
parent::setUp();
Class_Users::setTimeSource(new TimeSourceForTest('2020-03-10'));
$this->dispatch('/LesYeuxDoc_Plugin', true);
}
......@@ -89,14 +91,14 @@ class LesYeuDocDashboardTestCase extends LesYeuxDocActivatedTestCase {
/** @test */
public function ssoUrlForTestUserShouldBePortalMediathequeNumerique() {
$this->assertContains('<pre>https://portal.mediatheque-numerique.com/sso_login?sso_id=afi&id=79&id_encrypted=aff73a5e918d0cbefa1077d3468cfcfc03abd9c94b3d827b1b7dd283db2450f9&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=&nom=&email=&dnaiss=&datout=&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr</pre>',
$this->assertContains('<pre>https://portal.mediatheque-numerique.com/sso_login?sso_id=afi&id=79&id_encrypted=aff73a5e918d0cbefa1077d3468cfcfc03abd9c94b3d827b1b7dd283db2450f9&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=&nom=&email=&dnaiss=&datout=2020-04-09&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr</pre>',
$this->_response->getBody());
}
/** @test */
public function ssoUrlForTestUserAndAlbumOlivierRolinShouldBePortalMediathequeNumerique() {
$this->assertContains('<pre>https://portal.mediatheque-numerique.com/sso_login?sso_id=afi&id=79&id_encrypted=aff73a5e918d0cbefa1077d3468cfcfc03abd9c94b3d827b1b7dd283db2450f9&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=&nom=&email=&dnaiss=&datout=&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr%2Ffilm%2F703%2Folivier-rolin</pre>',
$this->assertContains('<pre>https://portal.mediatheque-numerique.com/sso_login?sso_id=afi&id=79&id_encrypted=aff73a5e918d0cbefa1077d3468cfcfc03abd9c94b3d827b1b7dd283db2450f9&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=&nom=&email=&dnaiss=&datout=2020-04-09&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr%2Ffilm%2F703%2Folivier-rolin</pre>',
$this->_response->getBody());
}
}
......@@ -299,6 +301,22 @@ class LesYeuDocModuleSsoTest extends AbstractControllerTestCase {
'document.location.href="http://lesyeuxdoc.com?sso_id=afi&id=2345&id_encrypted=8043a43d11f8daccc5b1a0a5ccbadedd1a3edba6b551c0ca1abaf42e49a36158&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=Jean&nom=Rouch&email=rouch%40ethno.fr&dnaiss=1975-01-01&datout=2023-01-01&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr";',
$this->_response->getBody());
}
/** @test */
public function withExpiredSubscriptionshouldRedirectToLesYeuxDocWithValidDate() {
$this->fixtures->activate();
$this->fixtures->logValidUser();
Class_Users::find(1)->setDateFin('2000-01-01')->save();
Class_Users::setTimeSource(new TimeSourceForTest('2020-03-10'));
LesYeuxDoc_Config::setTimeSource(new TimeSourceForTest('2018-28-05 11:50:00'));
$this->dispatch('/opac/modules/les-yeux-doc', true);
$this->assertXpathContentContains('//script',
'document.location.href="http://lesyeuxdoc.com?sso_id=afi&id=2345&id_encrypted=8043a43d11f8daccc5b1a0a5ccbadedd1a3edba6b551c0ca1abaf42e49a36158&d=d0f3e0faa0b2546ea784554bea817f2dcac68a0c5e658ce907af0711e6674e53&prenom=Jean&nom=Rouch&email=rouch%40ethno.fr&dnaiss=1975-01-01&datout=2020-04-09&return_url=https%3A%2F%2Fwww.lesyeuxdoc.fr";',
$this->_response->getBody());