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

dev #14141 fix fatal error in test

parent fb2e947f
Branches
Tags
4 merge requests!2080Sandbox detach zf from storm,!2061Master,!1954Dev#14141 record availability on search result,!1949Dev#14141 record availability on search result
......@@ -22,11 +22,15 @@
class ZendAfi_View_Helper_SuggestsTest extends ViewHelperTestCase {
protected
$_html,
$_storm_default_to_volatile = true;
$_storm_default_to_volatile = true,
$_engine;
public function setUp() {
parent::setUp();
$this->_engine = $this->mock()
->whenCalled('getCriteresRecherche')
->answers(new Class_CriteresRecherche());
$this->_helper = new ZendAfi_View_Helper_Suggests();
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
......@@ -35,21 +39,25 @@ class ZendAfi_View_Helper_SuggestsTest extends ViewHelperTestCase {
/** @test */
public function withEmptySuggestsShouldReturnEmptyString() {
$this->_engine->whenCalled('fetchFacetsAndTags')
->answers(['suggests' => []]);
$this->assertSame('',
$this->_helper->suggests([], new Class_CriteresRecherche()));
$this->_helper->suggests($this->_engine));
}
/** @test */
public function withSuggestResultPommesShouldH2WithSuggestions() {
$html = $this->_helper->suggests([
['id' => 'M87',
'label' => 'Pomme (sujet)'],
['id' => 'A43',
'label' => 'Pomme d\'API (auteur)'],
],
new Class_CriteresRecherche());
$this->_engine->whenCalled('fetchFacetsAndTags')
->answers(['suggests' => [
['id' => 'M87',
'label' => 'Pomme (sujet)'],
['id' => 'A43',
'label' => 'Pomme d\'API (auteur)'],
]]);
$html = $this->_helper->suggests($this->_engine);
$this->assertXPathContentContains($html, '//div[@class="suggests_outer facette_outer"]/h2', 'Suggestions');
return $html;
}
......
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