Commit 24754b7c authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

Merge branch...

Merge branch 'hotline#96803_le_resume_des_articles_cms_n_est_pas_indexe_dans_les_notices_bokeh' into 'hotline'

hotline #96803 add article summary, author et creation year in record indexation

See merge request !3310
parents 00b664c3 db9aa170
Pipeline #8719 passed with stage
in 59 minutes and 56 seconds
- ticket #96803 : Indexation des articles : ajout du résumé en 330$a, de l'auteur en 701 et de l'année de création en 210$d
\ No newline at end of file
......@@ -127,6 +127,7 @@ class Class_Indexation_PseudoNotice {
'date_maj' =>'',
'isbn' => '',
'domaine_ids' => '',
'resume' => '',
'created_at' => null],
array_change_key_case($this->_datas));
}
......@@ -356,6 +357,7 @@ class Class_Indexation_PseudoNotice {
->visitUrl($this->_datas['url'])
->visitNotes($this->_datas['notes'])
->visitNatures($this->_datas['nature_doc'])
->visitResume($this->_datas['resume'])
->visitCustomFieldsValues($this->getCustomFieldsValues());
$this->_modelIdAcceptVisitor($visitor);
......@@ -597,7 +599,13 @@ class Class_Indexation_PseudoNotice_Cms extends Class_Indexation_PseudoNotice{
protected function _prepareDatas() {
parent::_prepareDatas();
$this->_datas['resume'] = strip_tags($this->_datas['description']);
$this->_datas['description'] = strip_tags($this->_datas['contenu']);
$this->_datas['auteur'] = $this->_model->hasAuteur()
? $this->_model->getAuteur()->getNomComplet()
: '';
$this->_datas['annee'] = date('Y', strtotime($this->_model->getDateCreation()));
}
}
......
......@@ -355,10 +355,17 @@ class Class_Indexation_PseudoNoticeArticleTest
public function setUp() {
parent::setUp();
$author = $this->fixture('Class_Users',
['id' => 3,
'login' => 'gm',
'nom' => 'Musso',
'prenom' => 'Guillaume',
'password' => 'secret']);
$this->fixture('Class_NoticeDomain',
['id' => 189,
'domain_id' => 17,
'record_alpha_key' => 'MYARTCILE-1-----8']);
'record_alpha_key' => 'MYARTICLE-1-GUILLAUMEMUSSO----8']);
$this->fixture('Class_Catalogue',
['id' => 17,
......@@ -366,13 +373,17 @@ class Class_Indexation_PseudoNoticeArticleTest
$this->fixture('Class_Article',
['id' => 1,
'titre' => 'My Artcile',
'titre' => 'My Article',
'contenu' => 'article is about...',
'description' => 'This is a test',
'date_creation' => '2018-02-17 10:22:34',
'auteur' => $author,
'domaine_ids' => '17']);
$this->fixture('Class_Article',
['id' => 5,
'titre' => 'My Artcile bis',
'titre' => 'My Article bis',
'auteur' => $author,
'contenu' => 'article is about bis...']);
Class_Article::indexAll();
......@@ -383,9 +394,42 @@ class Class_Indexation_PseudoNoticeArticleTest
public function noticeDomainShouldContainsOnlyOneEnreg() {
$this->assertCount(1, Class_NoticeDomain::findAll());
}
/** @test */
public function firstRecordTitleShouldBeMyArticle() {
$this->assertEquals('My Article', Class_Notice::find(1)->getTitrePrincipal());
}
/** @test */
public function firstRecordSummaryShouldBeThisIsATest() {
$this->assertEquals('This is a test', Class_Notice::find(1)->getResume());
}
/** @test */
public function secondRecordSummaryShouldBeEmpty() {
$this->assertEmpty(Class_Notice::find(2)->getResume());
}
/** @test */
public function firstRecordMainAuthorShouldBeMusso() {
$this->assertEquals('Guillaume Musso', Class_Notice::find(1)->getAuteurPrincipal());
}
/** @test */
public function firstRecord210DShouldContainsCreationYear2018() {
$this->assertEquals(['2018'],
Class_Notice::find(1)->get_subfield('210', 'd'));
}
}
/** @see http://forge.afi-sa.fr/issues/72723 */
class Class_Indexation_PseudoNoticeArticleWithUnknownDomainTest
extends Class_Indexation_PseudoNoticeTestCase {
......@@ -462,6 +506,8 @@ class Class_Indexation_PseudoNoticeArticleUpdateTest
}
/** @see http://forge.afi-sa.fr/issues/69916 */
class Class_Indexation_PseudoNoticeArticleLongContentTest
extends Class_Indexation_PseudoNoticeTestCase {
......
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