Commit 066ea25f authored by Patrick Barroca's avatar Patrick Barroca 🐧

Merge branch…

Merge branch 'hotline#82189_pas_de_mise_a_jour_du_flux_xml_de_la_ressource_numerique_lekiosk_' into 'hotline'

hotline #82189 :  Le kiok : delete non harvesting album and get album id unique

See merge request !2949
parents 04eb193a 8c1c372e
Pipeline #5904 passed with stage
in 31 minutes and 22 seconds
- ticket #82189 : Connecteur LeKiosk : correction de la mise à jour lors du moissonage
\ No newline at end of file
<?php
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query('ALTER TABLE album modify id_origine varchar(255)');
} catch(Exception $e) {}
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
......@@ -120,4 +121,10 @@ class Lekiosk_Service extends Class_DigitalResource_Service {
? $result['token']
: null;
}
protected function _deleteNonHarvested() {
return $this->_deleteNonHarvestedAlbums();
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class Lekiosk_Service_Parser {
$album = new Lekiosk_Service_Album();
$album
->setId($attribs['PUBLICATIONID'])
->setId($attribs['PUBLICATIONID'].':'.$attribs['ISSUENUMBER'])
->setTitle($this->_getTitle($attribs))
->setExternalUri($attribs['SSOURL'])
->setDescription($attribs['ISSUEDESCRIPTION'])
......
......@@ -314,8 +314,8 @@ class LekioskServiceHarvestTest extends LekioskServiceTestCase {
/** @test */
public function nationalSportIdShouldBe851749() {
$this->assertEquals(851749, $this->_10_national_sport->getIdOrigine());
public function nationalSportIdShouldBe851749419() {
$this->assertEquals('851749:419', $this->_10_national_sport->getIdOrigine());
}
/** @test */
......@@ -576,14 +576,59 @@ abstract class LekioskServiceHttpHarvestingTestCase extends AbstractControllerTe
$service = new Lekiosk_Service($config);
$service->harvest();
Class_Album::clearCache();
}
}
class LekioskServiceHttpUpdateHarvestingTest extends LekioskServiceHttpHarvestingTestCase {
public function setUp() {
parent::setUp();
$token_json = file_get_contents(__DIR__. '/token.json');
$http_client = $this->mock()
->whenCalled('postRawData')
->with('https://apipros.lekiosk.com/login',
'{"username":"FOIX","userpwd":"PWD"}','application/json')
->answers($token_json)
->whenCalled('open_url')
->with('https://apipros.lekiosk.com/publications/flow',
['headers' => ['Authorization' => 'JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MjY2MjAxNiwibmFtZSI6Illvbm5lQGdtYWlsLmNvbSIsImV4cCI6MTUxNzM5OTE0M30.qZuwpsrZmk95LU0XYKPBFqpJJ4wxOVyZnJ_Gt3panxw']])
->answers(file_get_contents(__DIR__. '/updated_catalogue_from_http.xml'))
->whenCalled('open_url')
->answers(null);
Lekiosk_Service::setDefaultHttpClient($http_client);
$config = Lekiosk_Config::getInstance();
$config->setTimeSource(new TimeSourceForTest('2019-02-06 10:00:00'));
$service = new Lekiosk_Service($config);
$service->harvest();
Class_Album::clearCache();
}
/** @test */
public function allPreviousAlbumShouldBeDeleted() {
$this->assertCount(2, Class_Album::findAll());
}
/** @test */
public function oneAlbumTitleShouldBe10NationalSport() {
$this->assertEquals('Le 10 Sport National n°440 : 6 décembre 2018', Class_Album::find(4)->getTitre());
}
}
class LekioskServiceHttpHarvestingTest extends LekioskServiceHttpHarvestingTestCase {
/** @test */
public function contextShouldExpectation() {
......
B<IFData><Data Typeproduction="Magazine numérique" PublicationDescription="Le 10 Sport National est le mensuel entièrement dédié au sport. Vous y trouverez les infos foot, tennis ou encore basket du moment..." Frequency="Mensuel" IsAdult="0" IssueTitle="Le 10 Sport National" IssueDescription="Le 10 Sport National est le mensuel entièrement dédié au sport. Vous y trouverez les infos foot, tennis ou encore basket du moment..." IssueNumber="440" CoverURL="http://cdn2.lekiosk.com/Public/Publications/851749/21424703/Images/Detail.jpg" ReleaseDate="Thu Dec 06 2018 00:00:00 GMT+0000 (UTC)" PagesCount="32" URL="https://pros.lekiosk.com/login/accesshash?email=107653616b7e508f0f4293c23f868135851bb6ecf777eb8066e2ce89ff47fe8a&amp;id=756&amp;AccessHash=cb39b7947805ae2a98103e393fbf642841a1a83f&amp;returnUrl=/fr/pageproduct/851749/21424703" Editeur="10 Medias" PublicationId="851749" Categories="Sports" SSOURL="https://apipros.lekiosk.com/login/cas?id=756&amp;returnUrl=/fr/pageproduct/851749/21424703" SSOFORMURL="/fr/pageproduct/851749/21424703"/><Data Typeproduction="Magazine numérique" PublicationDescription="20minutes.fr, information en continu. Actualités, Politique, Football, People, High Tech." Frequency="Quotidien" IsAdult="0" IssueTitle="20 Minutes" IssueDescription="" IssueNumber="20190108" CoverURL="http://cdn2.lekiosk.com/Public/Publications/1883912/21431411/Images/Detail.jpg" ReleaseDate="Tue Jan 08 2019 00:00:00 GMT+0000 (UTC)" PagesCount="10" URL="https://pros.lekiosk.com/login/accesshash?email=107653616b7e508f0f4293c23f868135851bb6ecf777eb8066e2ce89ff47fe8a&amp;id=756&amp;AccessHash=cb39b7947805ae2a98103e393fbf642841a1a83f&amp;returnUrl=/fr/pageproduct/1883912/21431411" Editeur="20 Minutes France" PublicationId="1883912" Categories="Quotidiens" SSOURL="https://apipros.lekiosk.com/login/cas?id=756&amp;returnUrl=/fr/pageproduct/1883912/21431411" SSOFORMURL="/fr/pageproduct/1883912/21431411"/></IFData>
......@@ -2392,3 +2392,17 @@ class UpgradeDB_360_Test extends UpgradeDBTestCase {
/** @test */
public function placeholderForSigbStandardCodificationsMigration() {}
}
class UpgradeDB_361_Test extends UpgradeDBTestCase {
public function prepare() {
$this->silentQuery('ALTER TABLE album modify id_origine varchar(50)');
}
/** @test */
public function idOrigineLengthShouldBe255() {
$this->assertFieldType('album','id_origine', 'varchar(255)');
}
}
\ 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