Skip to content
Snippets Groups Projects
Commit f1367143 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #75882 fix failures + add tests

parent 2ea1c5e8
Branches
Tags
3 merge requests!2711Dev#75882 minsoc faire des filtres sur des facettes et des domaines au moment de la recherche s2,!2707Tessadoc lost pass,!2699Dev#75882 minsoc faire des filtres sur des facettes et des domaines au moment de la recherche s2
Pipeline #4367 failed with stage
in 3 minutes and 30 seconds
......@@ -119,4 +119,8 @@ class Class_CodifAuteur extends Storm_Model_Abstract {
'mots_renvois' => '',
'id_bnf' => '',
'date_creation' => ''];
public function getCategorie() {
return;
}
}
\ No newline at end of file
......@@ -45,10 +45,6 @@ abstract class ZendAfi_Controller_Action_Helper_AbstractListViewMode extends Zen
if ($this->isSearching())
return;
$labelWithCount = function($model, $attrib) {
return $this->_renderCategory($model, $attrib);
};
$description = (new Class_TableDescription('categories_' . get_class($this->getModel())));
return $this->_describeCategoriesIn($description)
->addRowAction(function($model)
......@@ -199,7 +195,7 @@ abstract class ZendAfi_Controller_Action_Helper_AbstractListViewMode extends Zen
}
protected function getItems() {
public function getItems() {
return [];
}
......
......@@ -21,6 +21,8 @@
class ZendAfi_Controller_Action_Helper_AuthorListViewMode extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
public function authorListViewMode($params) {
$this->_params = $params;
return $this;
......@@ -32,6 +34,24 @@ class ZendAfi_Controller_Action_Helper_AuthorListViewMode extends ZendAfi_Contro
}
protected function _describeCategoriesIn($description) {
return $description;
}
protected function _describeItemsIn($description) {
return $description
->addColumn($this->_('Nom prénom'), ['attribute' => 'libelle',
'callback' => function($model, $attrib)
{
return $this->_renderItem($model, $attrib);
}])
->addColumn($this->_('Code facette'), ['attribute' => 'facet_code',
'sort_attribute' => 'id_auteur'])
->setSorterServer();
}
public function getBreadcrumb() {
return [['url' => ['module' => 'admin',
'controller' => 'codification-browser',
......
......@@ -21,6 +21,8 @@
class ZendAfi_Controller_Action_Helper_CodificationListViewMode extends ZendAfi_Controller_Action_Helper_AbstractListViewMode {
public function codificationListViewMode($params) {
$this->_params = $params;
return $this;
......@@ -32,6 +34,21 @@ class ZendAfi_Controller_Action_Helper_CodificationListViewMode extends ZendAfi_
}
protected function _describeCategoriesIn($description) {
return $description
->addColumn($this->_('Codification'), ['attribute' => 'libelle',
'callback' => function($model, $attrib)
{
return $this->_renderCategory($model, $attrib);
}]);
}
protected function _describeItemsIn($description) {
return $description;
}
public function getBreadcrumb() {
return [['url' => ['module' => 'admin',
'controller' => 'codification-browser',
......
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class AuthorBrowserTestCase extends Admin_AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_erroc;
public function setUp() {
parent::setUp();
$this->_erroc = $this->fixture('Class_CodifAuteur',
['id' => 15,
'libelle' => 'Erroc']);
}
}
class AuthorBrowserIndexDispatchTest extends AuthorBrowserTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/author-browser', true);
}
/** @test */
public function linkToCodificationBrowserShouldBePresent() {
$this->assertXPathContentContains('//a[@href="/admin/codification-browser"]', 'Racine');
}
/** @test */
public function linkToSearchWithFacetA15ShouldBePresent() {
$this->assertXPath('//td//a[contains(@href, "/recherche/simple/facette/A15")]');
}
}
class AuthorBrowserSearchTest extends AuthorBrowserTestCase {
public function setUp() {
parent::setUp();
$_SERVER['HTTP_REFERER'] = 'http://test.org/admin/author-browser/index';
}
/** @test */
public function searchShouldRedirect() {
$this->postDispatch('/admin/author-browser/index',
['title_search' => 'Erroc']);
$this->assertRedirectTo('/admin/author-browser/index/title_search/Erroc/page/1/order/libelle');
}
/** @test */
public function redirectedShouldDisplayResult() {
$this->onLoaderOfModel('Class_CodifAuteur')
->whenCalled('findAllBy')
->with(['where' => "(libelle like '%Erroc%') or (id_auteur like '%Erroc%')",
'order' => "libelle",
'limitPage' => ["1", 25]])
->answers([$this->_erroc])
->whenCalled('countBy')
->with(['where' => "(libelle like '%Erroc%') or (id_auteur like '%Erroc%')",
'order' => "libelle"])
->answers(1)
->beStrict();
$this->dispatch('/admin/author-browser/index/title_search/Erroc/page/1/order/libelle', true);
$this->assertXpathContentContains('//table', 'Erroc');
}
}
class AuthorBrowserIndexOrderTest extends AuthorBrowserTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/author-browser/index/order/id_auteur', true);
}
/** @test */
public function codeFacetOrderLinkShouldDesc() {
$this->assertXpathContentContains('//table//a[contains(@href, "order/id_auteur+desc")]', 'Code facette');
}
}
\ No newline at end of file
......@@ -47,34 +47,4 @@ class CodificationBrowserIndexDispatchTest extends Admin_AbstractControllerTestC
public function authorsShouldBeInTable() {
$this->assertXPathContentContains('//td//a[@href="/admin/author-browser"]', 'Auteurs');
}
}
class CodificationBrowserAuthorIndexDispatchTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->fixture('Class_CodifAuteur',
['id' => 15,
'libelle' => 'Erroc']);
$this->dispatch('/admin/author-browser', true);
}
/** @test */
public function linkToCodificationBrowserShouldBePresent() {
$this->assertXPathContentContains('//a[@href="/admin/codification-browser"]', 'Racine');
}
/** @test */
public function linkToSearchWithFacetA15ShouldBePresent() {
$this->assertXPath('//td//a[contains(@href, "/recherche/simple/facette/A15")]');
}
}
\ No newline at end of file
......@@ -140,6 +140,8 @@ class ThesauriIndexChildrenTest extends ThesauriTestCase {
}
class ThesauriIndexChildrenSearchTest extends ThesauriTestCase {
public function setUp() {
parent::setUp();
......
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