diff --git a/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php b/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php index 0bac0d26fc4230f07aead576feba016c04c541a3..e16a1bb0c3c30e864f3980fed0bd7792e4b09907 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php @@ -77,16 +77,26 @@ abstract class RechercheControllerAtomTestCase extends AbstractControllerTestCas class RechercheControllerAtomEmptyTestCase extends RechercheControllerAtomTestCase { protected function _prepareLoader($loader) { - $loader->whenCalled('findAllByRequeteRecherche')->answers([]); + $loader->whenCalled('findAllByIds') + ->with([], 5, null) + ->answers([]) + ->beStrict(); } protected function _prepareSql($sql) { - $sql->whenCalled('fetchOne') - ->answers(0) + $sql->whenCalled('fetchAll') + ->with("select id_notice, facettes from notices Where MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE) order by (MATCH(alpha_titre) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(alpha_auteur) AGAINST(' HARRY POTTER')) desc", + true, + false) + ->answers([]) - ->whenCalled('execute') - ->answers(true); + ->whenCalled('fetchAll') + ->with("select id_notice, facettes from notices Where MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST(' (HARRY HARRYS ARI) (POTTER POTTERS POT)') and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE) order by (MATCH(alpha_titre) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(alpha_auteur) AGAINST(' HARRY POTTER')) desc", + true, + false) + ->answers([]) + ->beStrict(); } @@ -142,20 +152,18 @@ abstract class RechercheControllerAtomWithTwoNoticesTestCase extends RechercheCo 'url_image' => 'http://media.universcine.com/e7/bc/e7bcedba-743a-11e2-a43d-fb3bf58b5f60.png']); - $loader->whenCalled('findAllByRequeteRecherche') + $loader->whenCalled('findAllByIds') + ->with([234, 10141532]) ->answers([$potter, $rdv]); } protected function _prepareSql($sql) { - $sql->whenCalled('fetchOne') - ->answers(2) - - ->whenCalled('execute') - ->answers(true) - - ->whenCalled('fetchAllByColumn') - ->answers([234, 10141532]); + $sql->whenCalled('fetchAll') + ->answers([ + [234, ''], + [10141532, ''] + ]); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerJsonTest.php b/tests/application/modules/opac/controllers/RechercheControllerJsonTest.php index 9affa42b785d266f6dda164a315e1131d358f3e6..7b7f686bc74273a48c7541ebc9daa0019c6067e6 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerJsonTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerJsonTest.php @@ -20,8 +20,9 @@ */ abstract class RechercheControllerJsonTestCase extends AbstractControllerTestCase { - protected $_storm_default_to_volatile = true; - protected $_json; + protected + $_storm_default_to_volatile = true, + $_json; public function setUp() { parent::setUp(); @@ -55,21 +56,17 @@ abstract class RechercheControllerJsonTestCase extends AbstractControllerTestCas class RechercheControllerJsonEmptyResultTest extends RechercheControllerJsonTestCase { protected function _prepareLoader($loader) { - $loader->whenCalled('findAllByRequeteRecherche') - ->with('Select id_notice from notices', 10, null) + $loader->whenCalled('findAllByIds') + ->with([], 10, null) ->answers([]) ->beStrict(); } protected function _prepareSql($sql) { - $sql->whenCalled('fetchOne') - ->with('Select count(*) from notices') - ->answers(0) - - ->whenCalled('execute') - ->answers(true) - ; + $sql->whenCalled('fetchAll') + ->with('select id_notice, facettes from notices', true, false) + ->answers([]); } @@ -134,17 +131,20 @@ class RechercheControllerJsonWithResultTest extends RechercheControllerJsonTestC 'url_image' => 'http://media.universcine.com/e7/bc/e7bcedba-743a-11e2-a43d-fb3bf58b5f60.png']); - $loader->whenCalled('findAllByRequeteRecherche') - ->with('Select id_notice from notices', 5, null) + $loader->whenCalled('findAllByIds') + ->with([234, 10141532], 5, null) ->answers([$potter, $rdv]) ->beStrict(); } protected function _prepareSql($sql) { - $sql->whenCalled('fetchOne') - ->with('Select count(*) from notices') - ->answers(2) + $sql->whenCalled('fetchAll') + ->with('select id_notice, facettes from notices', true, false) + ->answers([ + ['234', ''], + ['10141532', ''] + ]) ->whenCalled('execute') ->answers(true)