Skip to content
Snippets Groups Projects
Commit a608563b authored by Ghislain Loas's avatar Ghislain Loas
Browse files

sandbox fix RechercheControllerPrintActionTest

parent 1e6f8482
Branches
Tags
5 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1079Dev #17782 merge print fusion,!1073Dev#17782 bonus 1 imprimer la liste des notices,!1062Sandbox fusion search result and print
......@@ -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">
......
......@@ -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 '';
......
......@@ -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());
......
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