diff --git a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml index ed283d33f09c1c83a4f0e4921441d268f78b2842..354c53c86e7dc737e89aa28e765b15217a4ac357 100644 --- a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml +++ b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml @@ -18,7 +18,7 @@ if ($this->is_pertinence) { ?> <div class="print"> <?php -echo $this->tagPrintLink($this->list, 'recherche'); +echo $this->tagPrintLink($this->liste, 'recherche'); ?> </div> <div class="resultats_page"> diff --git a/library/ZendAfi/View/Helper/TagPrintLink.php b/library/ZendAfi/View/Helper/TagPrintLink.php index 7bef27b3ee265dbe2d293ab24cf30c30ae0535fb..f1f6e777854fc88dd47dcfbc0e3b12f8a6c46788 100644 --- a/library/ZendAfi/View/Helper/TagPrintLink.php +++ b/library/ZendAfi/View/Helper/TagPrintLink.php @@ -23,7 +23,9 @@ class ZendAfi_View_Helper_TagPrintLink extends Zend_View_Helper_HtmlElement { public function tagPrintLink($models, $strategy) { - xdebug_break(); + if(!$models) + return ''; + if(!$model_fusion = Class_ModeleFusion::getFusionForStrategy($strategy)) return ''; diff --git a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php index 6862d9c3824080517c833112e38a087f1246335e..7f79c1385ab696b3f124198c368c6a4da9a10e9a 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php @@ -20,10 +20,10 @@ */ class RechercheControllerPrintActionLinkTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); - Storm_Model_Loader::defaultToVolatile(); $this->fixture('Class_ModeleFusion', ['id' => 1, 'nom' => 'recherche', @@ -35,23 +35,32 @@ class RechercheControllerPrintActionLinkTest extends AbstractControllerTestCase 'libelle' => 'Nouveautés', 'auteur' => 'Paul']); + $mock_sql = $this->mock() + ->whenCalled('fetchAllByColumn') + ->answers([1]) + ->whenCalled('fetchOne') + ->answers(1) + ->whenCalled('fetchAll') + ->answers([$this->fixture('Class_Notice', + ['id' => 1])->toArray()]); + Zend_Registry::set('sql', $mock_sql); $this->dispatch('/recherche/simple/id_catalogue/3/id_module/9/aleatoire/1', true); } /** @test */ public function printLinkShouldBePresent() { - $this->assertXPathContentContains('//a[contains(@href, "/recherche/print/id_catalogue/3/id_module/9/aleatoire/1/strategy/recherche/modele_fusion/1")]', 'Imprimer', $this->_response->getBody()); + $this->assertXPathContentContains('//a[contains(@href, "/recherche/print/id_catalogue/3/id_module/9/aleatoire/1/ids/1/strategy/recherche/modele_fusion/1")]', 'Imprimer'); } } class RechercheControllerPrintActionWithRecordsTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); - Storm_Model_Loader::defaultToVolatile(); $this->fixture('Class_ModeleFusion', ['id' => 1, 'nom' => 'recherche', @@ -71,15 +80,23 @@ class RechercheControllerPrintActionWithRecordsTest extends AbstractControllerTe 'notice' => new Class_Notice(), 'type_doc_id' => Class_TypeDoc::ARTICLE])); - $this->dispatch("/recherche/print/expressionRecherche/pomme/strategy/notice/ids/1%3B2/modele_fusion/1",true); + $this->dispatch("/recherche/print/expressionRecherche/pomme/strategy/recherche/ids/1%3B2/modele_fusion/1",true); } - public function tearDown() { - Storm_Model_Loader::defaultToDb(); - parent::tearDown(); + + /** @test */ + public function articlePommeShouldBeIndexed() { + $this->assertNotNull(Class_Notice::findFirstBy(['titres' => 'POMME'])); } + /** @test */ + public function recordPommeShouldBeLinkedToPommeArticle() { + $this->assertNotNull(Class_Notice::findFirstBy(['titres' => 'POMME'])->getArticle()); + } + + + /** @test */ public function displayShouldprintContent() { $this->assertXPathContentContains("//div//p", "bd", $this->_response->getBody());