Skip to content
Snippets Groups Projects
Commit 4dcb9882 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline#81053_skileos_suppression_de_fichiers_et_pb_de_vignettes' into 'hotline'

Hotline#81053 skileos suppression de fichiers et pb de vignettes

See merge request !2867
parents 3e24a301 149bfa47
Branches
Tags
2 merge requests!2870Hotline,!2867Hotline#81053 skileos suppression de fichiers et pb de vignettes
Pipeline #5218 passed with stage
in 32 minutes and 53 seconds
- ticket #81053 : Connecteur Skilleos : suppression automatique des albmus n'étant plus fournis
\ No newline at end of file
......@@ -67,6 +67,11 @@ class Skilleos_Service extends Class_DigitalResource_Service {
}
protected function _deleteNonHarvested() {
return $this->_deleteNonHarvestedAlbums();
}
public function httpGetCatalogue() {
return $this->httpGet(static::$REST_URL,
['headers' => [ 'Authorization' => 'Bearer ' . $this->getToken()]]);
......
......@@ -28,7 +28,7 @@ class Skilleos_Service_Parser extends Class_WebService_BibNumerique_RessourceNum
->setDescription($json->introduction.$json->description.$json->contenu_and_objectif);
$this->_lessons = [];
$this->_posters[] = $json->ressource->url;
$this->_posters[] = isset($json->picture) ? $json->picture->url : $json->ressource->url;
$this->addAuthor($json->teacher->name);
......
......@@ -179,6 +179,12 @@ abstract class SkilleosServiceTestCase extends AbstractControllerTestCase {
parent::setUp();
SkilleosAdminVars::activate();
$this->fixture('Class_Album',
['id' => 4,
'titre' => 'I hope to be deleted',
'type_doc_id' => Skilleos_Config::getInstance()->getDocType(),
'id_origine' => 'zork666']);
$token_json = file_get_contents(__DIR__. '/token.json');
$results_json = file_get_contents(__DIR__. '/results.json');
......@@ -241,19 +247,19 @@ class SkilleosServiceHarvestTest extends SkilleosServiceTestCase {
/** @test */
public function urlOriginShouldBeSet() {
$this->assertEquals('http://skilleos.com/sigb/sso/',Class_Album::find(1)->getUrlOrigine());
$this->assertEquals('http://skilleos.com/sigb/sso/',Class_Album::find(5)->getUrlOrigine());
}
/** @test */
public function categoryShouldBeSkilleos() {
$this->assertEquals('Cours en ligne Skilleos',Class_Album::find(1)->getCategoryLabel());
$this->assertEquals('Cours en ligne Skilleos',Class_Album::find(5)->getCategoryLabel());
}
/** @test */
public function matiereSportEtBienEtreShouldBeCreated() {
$id = Class_Album::find(2)->getMatiere();
$id = Class_Album::find(6)->getMatiere();
$labels= Class_CodifMatiere::find($id)->getLibelle();
$this->assertEquals('Sport & Bien-être', $labels);
}
......@@ -261,24 +267,31 @@ class SkilleosServiceHarvestTest extends SkilleosServiceTestCase {
/** @test */
public function albumTitleShouldBeMeditationRelaxation() {
$this->assertEquals('Hatha Yoga', Class_Album::find(1)->getTitre());
$this->assertEquals('Hatha Yoga', Class_Album::find(5)->getTitre());
}
/** @test */
public function descriptionShouldContains() {
$this->assertContains('Des instructions pour rendre',Class_Album::find(2)->getDescription());
$this->assertContains('Des instructions pour rendre',Class_Album::find(6)->getDescription());
}
/** @test */
public function authorShouldBeYogaChezMoi() {
$this->assertEquals('Tatiana Abbey', Class_Album::find(2)->getAuthors()[0]->getName());
$this->assertEquals('Tatiana Abbey', Class_Album::find(6)->getAuthors()[0]->getName());
}
/** @test */
public function thumbnailShouldBeThumbDotpng() {
$this->assertEquals('https://moncompte.skilleos.com/uploads/ressources/default/0001/11/thumb_10683_default_big.png', Class_Album::find(6)->getPoster());
}
/** @test */
public function withoutUserConnectionLinkToModuleSkilleosShouldIndicateToConnect() {
ZendAfi_Auth::getInstance()->clearIdentity();
Class_Album::find(2)->index();
Class_Album::find(6)->index();
$this->dispatch('/noticeajax/resnumeriques/id/1', true);
$this->assertXPathContentContains('//a[contains(@href, "modules/skilleos")]', 'Vous devez ', $this->_response->getBody());
}
......@@ -287,15 +300,15 @@ class SkilleosServiceHarvestTest extends SkilleosServiceTestCase {
/** @test */
public function withValidUserConnectionLinkToModuleSkilleosShouldIndicateToConnect() {
Class_Album::find(2)->index();
Class_Album::find(6)->index();
$this->dispatch('/noticeajax/resnumeriques/id/1', true);
$this->assertXPathContentContains('//a[contains(@href, "/modules/skilleos/album_id/2")]', utf8_encode('Accéder à '), $this->_response->getBody());
$this->assertXPathContentContains('//a[contains(@href, "/modules/skilleos/album_id/6")]', utf8_encode('Accéder à '), $this->_response->getBody());
}
/** @test */
public function withAlbumIdShouldRedirectToSkilleos() {
$this->dispatch('/opac/modules/skilleos/album_id/2',true);
$this->dispatch('/opac/modules/skilleos/album_id/6',true);
$ticket = (new Class_CasTicket())->getTicketForCurrentUser();
$this->assertXPathContentContains('//script','/sigb/sso/602?casid=QUEST&ticket='.$ticket, $this->_response->getBody());
}
......
......@@ -105,7 +105,7 @@
"url": "https:\/\/moncompte.skilleos.com\/uploads\/ressources\/default\/0001\/12\/thumb_11660_default_big.png"
},
"id": 677,
"ressource": {
"picture": {
"url": "https:\/\/moncompte.skilleos.com\/uploads\/ressources\/default\/0001\/12\/thumb_11659_default_big.png"
}
},
......
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