Skip to content
Snippets Groups Projects
Commit 2d34ec5a authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

Merge branch 'hotline#128879_cartes_postales_sur_carte' into 'hotline'

hotline: #128879 : settings with display more than 100 notices

See merge request !4146
parents 64173db2 8637b08b
Branches
Tags
2 merge requests!4151hotline#139455: fix install skin button,!4146hotline: #128879 : settings with display more than 100 notices
Pipeline #14299 passed with stage
in 50 minutes and 19 seconds
- ticket #128879 : Accueil : Corrections, permettre l'affichage de plus de 100 éléments dans une carte
\ No newline at end of file
......@@ -36,7 +36,7 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_
'url_image=""',
$order]);
$params = ['limit' => 100,
$params = ['limit' => $this->_getSize(),
'order' => new Class_MoteurRecherche_OrderCriteria(implode(', ', $order))];
$records = $this->_findRecords($params);
......@@ -89,10 +89,7 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_
return [];
return Class_Notice::findAllByRequeteRecherche($request_ids,
($this->_settings->isDisplayRandom()
? 100
: $this->_settings->getSize()),
1);
$this->_getSize(), 1);
}
......@@ -143,4 +140,11 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_
? (new Intonation_Library_Widget_Carousel_VolatileLoader)->memoize($this)->getId()
: '';
}
protected function _getSize() {
return ($size = $this->_settings->getSize())
? $size
: 100;
}
}
......@@ -141,3 +141,111 @@ class NumelKioskMapTest extends NumelKioskMapTestCase {
$this->assertXPathContentContains('//script', 'openStreetMap()');
}
}
/* hotline: #128879 */
class NumelKioskMapLimit1000Test extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_mock_sql;
public function setUp() {
parent::setUp();
$notice_pomme = $this->fixture(Class_Notice::class,
['id' => 50,
'clef_alpha' => 'CARTESPOSTALES',
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '1111')
->zoneWithChildren('200', ['a' => 'Rue Pomme'])
->zoneWithChildren('123', ['d' => '2.65',
'f' => '48.53'])
->render()]);
$notice_fier = $this->fixture(Class_Notice::class,
['id' => 550,
'clef_alpha' => 'CARTESPOSTALES',
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '1111')
->zoneWithChildren('200', ['a' => 'Rue Fier'])
->zoneWithChildren('123', ['d' => '4.65',
'f' => '58.53'])
->render()]);
$notices_ids = [];
for ($pos = 0; $pos < 1000; $pos++)
$notices_ids [] = $pos;
$notices_100_ids = array_slice($notices_ids, 0, 100);
$this->_mock_sql = $this->mock()
->whenCalled('fetchAllByColumn')
->with('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\'Q444\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="" LIMIT 0,1000')
->answers($notices_ids);
Zend_Registry::set('sql', $this->_mock_sql);
Storm_Test_ObjectWrapper::onLoaderOfModel(Class_Notice::class)
->whenCalled('findAllBy')
->with(['id_notice' => $notices_100_ids,
'order' => 'FIELD(id_notice, ' . implode(',', $notices_100_ids) . ')'])
->answers([$notice_fier])
->whenCalled('findAllBy')
->with(['id_notice' => $notices_ids,
'order' => 'FIELD(id_notice, ' . implode(',', $notices_ids) . ')'])
->answers([$notice_pomme, $notice_fier]);
$this->fixture(Class_NoticeDomain::class,
['id' => 111,
'domain_id' => 444,
'record_alpha_key' => 'CARTESPOSTALES']);
$this->fixture(Class_Catalogue::class,
['id' => 444,
'libelle' => 'Cartes postales']);
$preferences = ['layout' => Intonation_Library_Widget_Carousel_Definition::MAP,
'rendering' => 'card',
'size' => 1000,
'id_catalogue' => 444,
'titre' => 'Les cartes postales sur la carte',
'order' => 'RAND()'
];
$this->_buildTemplateProfil(['id' => 1,
'libelle' => 'numel'])
->setBoiteOfTypeInDivision(2,
Intonation_Library_Widget_Carousel_Record_Definition::CODE,
$preferences)
->assertSave();
$this->dispatch('/opac/index');
}
/** @test */
public function fetchAllByColumnWillBeCalledWithLimit1000() {
$this->assertEquals('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\'Q444\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="" LIMIT 0,1000', $this->_mock_sql->getFirstAttributeForLastCallOn('fetchAllByColumn'));
}
/** @test */
public function noticeFierShouldBePresentInOSMmap() {
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "58.53")]');
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "4.65")]');
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "\/recherche\/viewnotice\/clef\/CARTESPOSTALES\/id\/550\/tri\/RAND%28%29\/id_catalogue\/444")]');
}
/** @test */
public function noticePommeShouldBePresentInOSMmap() {
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "48.53")]');
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "2.65")]');
$this->assertXPath('//div[@id="osm_map_1"][contains(@data-osm, "\/recherche\/viewnotice\/clef\/CARTESPOSTALES\/id\/50\/tri\/RAND%28%29\/id_catalogue\/444")]');
}
}
......@@ -354,7 +354,7 @@ class TemplatesUserSettingsSearchSaveChiliAndDomainBDAndWidgetDomainTest extends
/** @test */
public function orderForCarouselShouldBeTitleAsc() {
$this->dispatch('/recherche/simple/tri/alpha_auteur+desc/id_catalogue/2');
$this->assertEquals('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\' +( A1)\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,100',
$this->assertEquals('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\' +( A1)\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,9',
Zend_Registry::get('sql')->getFirstAttributeForLastCallOn('fetchAllByColumn'));
}
......@@ -366,7 +366,7 @@ class TemplatesUserSettingsSearchSaveChiliAndDomainBDAndWidgetDomainTest extends
->save();
$this->dispatch('/recherche/simple/tri/alpha_auteur+desc/id_catalogue/2');
$this->assertEquals('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\' +( A1)\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,100',
$this->assertEquals('select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\' +( A1)\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,9',
Zend_Registry::get('sql')->getFirstAttributeForLastCallOn('fetchAllByColumn'));
}
}
\ No newline at end of file
}
......@@ -1618,7 +1618,7 @@ class TemplatesWidgetCarouselWithDomainTest extends TemplatesWidgetCarouselWithD
/** @test */
public function recordsIdsShouldHaveBeenSelectedWithFacetQ3AndTypeBiblio() {
$this->assertEquals(['select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\'Q3\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,100',
$this->assertEquals(['select notices.id_notice from notices Where (MATCH(facettes) AGAINST(\'Q3\' IN BOOLEAN MODE)) and type=1 order by url_image="no", url_image="", alpha_titre asc LIMIT 0,9',
9,
1],
Class_Notice::getAttributesForLastCallOn('findAllByRequeteRecherche'));
......@@ -1640,6 +1640,7 @@ class TemplatesWidgetCarouselWithDomainFindByIdsTest extends TemplatesWidgetCaro
parent::setUp();
$params = ['rendering' => 'card',
'size' => null,
'id_catalogue' => 3,
'order' => Class_CriteresRecherche::SORT_RANDOM,
'layout' => Intonation_Library_Widget_Carousel_Definition::GRID];
......
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