Skip to content
Snippets Groups Projects
Commit 5347b71c authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

Merge branch 'hotline#133563_pb_traduction_titres_articles_en_recherche' into 'master'

hotline : 133563 : check parent_id in index cms

See merge request !4749
parents 81c662ad 41974d42
Branches
Tags
1 merge request!4749hotline : 133563 : check parent_id in index cms
Pipeline #23653 passed with stage
in 27 minutes and 5 seconds
- correctif #133563 : Correction de la langue dans la recherche des articles traduits.
\ No newline at end of file
......@@ -103,6 +103,6 @@ class Class_Cosmogramme_Integration_PhasePseudoRecordCms
protected function _articlesRecordsJoin() : string {
return 'from notices as n '
. 'inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="' . Class_TypeDoc::ARTICLE . '") '
. 'inner join cms_article as a on a.id_article=e.id_origine';
. 'inner join cms_article as a on a.id_article=e.id_origine or a.parent_id = e.id_origine';
}
}
......@@ -21,6 +21,7 @@
class PhasePseudoRecordCmsUnindexTest extends Class_Cosmogramme_Integration_PhaseTestCase {
protected function _getPreviousPhase() {
return (new Class_Cosmogramme_Integration_Phase(0.1))
->beCron();
......@@ -29,12 +30,13 @@ class PhasePseudoRecordCmsUnindexTest extends Class_Cosmogramme_Integration_Phas
public function setUp() {
parent::setUp();
Zend_Registry::set('sql',
$this->mock()
->whenCalled('fetchAllByColumn')->answers([])
->whenCalled('fetchAllByColumn')
->with('select n.id_notice from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine where (a.debut is not null and date(a.debut) > date(now())) or (a.fin is not null and date(a.fin) < date(now()))')
->with('select n.id_notice from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine or a.parent_id = e.id_origine where (a.debut is not null and date(a.debut) > date(now())) or (a.fin is not null and date(a.fin) < date(now()))')
->answers([12]));
$this->fixture(Class_Article::class,
......@@ -95,6 +97,7 @@ class PhasePseudoRecordCmsUnindexTest extends Class_Cosmogramme_Integration_Phas
class PhasePseudoRecordCmsIndexTest extends Class_Cosmogramme_Integration_PhaseTestCase {
protected function _getPreviousPhase() {
return (new Class_Cosmogramme_Integration_Phase(0.1))
->beCron();
......@@ -103,12 +106,13 @@ class PhasePseudoRecordCmsIndexTest extends Class_Cosmogramme_Integration_PhaseT
public function setUp() {
parent::setUp();
Zend_Registry::set('sql',
$this->mock()
->whenCalled('fetchAllByColumn')->answers([])
->whenCalled('fetchAllByColumn')
->with('select id_article from cms_article where id_article not in (select a.id_article from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine) and ((debut is null or date(debut) <= date(now())) and (fin is null or date(fin) >= date(now()))) and status=3 and indexation=1 order by id_article')
->with('select id_article from cms_article where id_article not in (select a.id_article from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine or a.parent_id = e.id_origine) and ((debut is null or date(debut) <= date(now())) and (fin is null or date(fin) >= date(now()))) and status=3 and indexation=1 order by id_article')
->answers([22199]));
Class_Article::setTimeSource(new TimeSourceForTest('2022-04-30 14:50:49'));
......@@ -164,3 +168,79 @@ class PhasePseudoRecordCmsIndexTest extends Class_Cosmogramme_Integration_PhaseT
$this->assertLogContains('1 notice(s) traitée(s)');
}
}
/* https://forge.afi-sa.net/issues/133563 */
class PhasePseudoRecordCmsIndexWithTranslatedRecordTest
extends Class_Cosmogramme_Integration_PhaseTestCase {
protected function _getPreviousPhase() {
return (new Class_Cosmogramme_Integration_Phase(0.1))
->beCron();
}
public function setUp() {
parent::setUp();
Class_AdminVar::set('DEFAULT_LANGUAGE', 'fr');
Class_AdminVar::set('LANGUES', 'en;');
Zend_Registry::set('sql',
$this->mock()
->whenCalled('fetchAllByColumn')
->with('select n.id_notice from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine or a.parent_id = e.id_origine where (a.debut is not null and date(a.debut) > date(now())) or (a.fin is not null and date(a.fin) < date(now()))')
->answers([])
->whenCalled('fetchAllByColumn')
->with('select id_article from cms_article where id_article not in (select a.id_article from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine) and ((debut is null or date(debut) <= date(now())) and (fin is null or date(fin) >= date(now()))) and status=3 and indexation=1')
->answers([22299])
->whenCalled('fetchAllByColumn')
->with('select id_article from cms_article where id_article not in (select a.id_article from notices as n inner join exemplaires as e on (n.id_notice=e.id_notice and n.type=1 and n.type_doc="8") inner join cms_article as a on a.id_article=e.id_origine or a.parent_id = e.id_origine) and ((debut is null or date(debut) <= date(now())) and (fin is null or date(fin) >= date(now()))) and status=3 and indexation=1')
->answers([])
->beStrict());
$this->fixture(Class_Notice::class,
['id' => 159,
'titres' => 'ARTICLE EN FRANCAIS',
'type' => 1,
'type_doc' => 8]);
$this->fixture(Class_Exemplaire::class,
['id' => 753,
'id_notice' => 159,
'id_origine' => 22199]);
$this->fixture(Class_Article::class,
['id' => 22199,
'id_notice' => 159,
'parent_id' => 0,
'titre' => 'Article en francais',
'contenu' => 'Article en francais',
'status' => Class_Article::STATUS_VALIDATED,
'indexation' => 1,
'langue' => 'fr']);
$this->fixture(Class_Article::class,
['id' => 22299,
'titre' => 'translation article',
'contenu' => 'translation article',
'status' => Class_Article::STATUS_VALIDATED,
'indexation' => 1,
'langue' => 'en',
'parent_id' => 22199]);
$this->_phase = $this->_buildPhase('PseudoRecordCms')
->setMemoryCleaner(function() {})
->run();
}
/** @test */
public function recordShouldHaveTitresTestingArticle() {
$this->assertEquals('ARTICLE EN FRANCAIS', Class_Notice::findFirstBy(['type_doc' => Class_TypeDoc::ARTICLE])
->getTitres());
}
}
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