diff --git a/VERSIONS_WIP/142642 b/VERSIONS_WIP/142642 new file mode 100644 index 0000000000000000000000000000000000000000..5cf5f85e3e12670c71667b78e694e5626ddc2856 --- /dev/null +++ b/VERSIONS_WIP/142642 @@ -0,0 +1 @@ + - ticket #142642 : Indexation des pages : création d'une clé œuvre pour la notice générée \ No newline at end of file diff --git a/library/Class/Indexation/PseudoNotice/WorkKey.php b/library/Class/Indexation/PseudoNotice/WorkKey.php index c2d169eef09336e2972825152c9c9c00070ad4dd..ae59d3dda45daa5aa2c1d6501fadf201c44b87ed 100644 --- a/library/Class/Indexation/PseudoNotice/WorkKey.php +++ b/library/Class/Indexation/PseudoNotice/WorkKey.php @@ -37,7 +37,8 @@ class Class_Indexation_PseudoNotice_WorkKey { $map = [Class_Album::class => Class_Indexation_PseudoNotice_WorkKeyAlbum::class, Class_Sitotheque::class => Class_Indexation_PseudoNotice_WorkKeyTitre::class, Class_Article::class => Class_Indexation_PseudoNotice_WorkKeyCms::class, - Class_Rss::class => Class_Indexation_PseudoNotice_WorkKeyTitre::class]; + Class_Rss::class => Class_Indexation_PseudoNotice_WorkKeyTitre::class, + Class_Profil::class => Class_Indexation_PseudoNotice_WorkKeyPage::class]; foreach($map as $model_class => $key_class) if (is_a($model, $model_class)) @@ -99,6 +100,19 @@ class Class_Indexation_PseudoNotice_WorkKeyTitre extends Class_Indexation_Pseudo +class Class_Indexation_PseudoNotice_WorkKeyPage extends Class_Indexation_PseudoNotice_WorkKey { + public function _record() { + return new Class_Entity(['TitrePrincipal' => $this->_model->getTitre(), + 'ComplementTitre' => '', + 'AuteurClefAlpha' => $this->_model->isInPortail() + ? 'Portal' + : $this->_model->getBibLibelle(), + 'TomeAlpha' => $this->_model->getId()]); + } +} + + + class Class_Indexation_PseudoNotice_WorkKeyCms extends Class_Indexation_PseudoNotice_WorkKey { public function _record() { @@ -107,4 +121,4 @@ class Class_Indexation_PseudoNotice_WorkKeyCms extends Class_Indexation_PseudoNo 'AuteurClefAlpha' => $this->_model->getAuthorName(), 'TomeAlpha' => '']); } -} \ No newline at end of file +} diff --git a/tests/scenarios/IndexablePages/IndexablePagesPseudoRecordTest.php b/tests/scenarios/IndexablePages/IndexablePagesPseudoRecordTest.php index 8b3d47de5486147e1680c47359e7cf1a177e5d48..d0773f15b07ab1ba14cadb4375e9a3c9ee94642c 100644 --- a/tests/scenarios/IndexablePages/IndexablePagesPseudoRecordTest.php +++ b/tests/scenarios/IndexablePages/IndexablePagesPseudoRecordTest.php @@ -118,6 +118,24 @@ class IndexablePagesPseudoRecordEnabledIndexableTest extends ModelTestCase { } + /** @test */ + public function recordWorkKeyShouldBeMysuperpage_Portal_233() { + $this->assertEquals('MYSUPERPAGE--PORTAL-233', + $this->_record->getClefOeuvre()); + } + + + /** @test */ + public function withPageInLibraryAnnecyShouldBeMysuperpage_Annecy_233() { + $this->_page->setBib($this->fixture(Class_Bib::class, + ['id' => 3, + 'libelle' => 'Annecy'])) + ->index(); + $this->assertEquals('MYSUPERPAGE--ANNECY-233', + $this->_page->getNotice()->getClefOeuvre()); + } + + /** @test */ public function recordTitleShouldBeMySuperPage() { $this->assertEquals('My super page', $this->_record->getTitrePrincipal());