diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 3dab132da37064174f3e1f3ccf2b16647b427207..b1d50761dff6e7f542fd1e5eeffe3346367ceb0f 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'AbstractControllerTestCase.php'; @@ -44,18 +44,18 @@ abstract class AdminCatalogueControllerTestCase extends AbstractControllerTestCa ->whenCalled('findAll') ->answers([$this->bib_annecy, $this->bib_cran]); - $panier_jeunesse_dupont = Class_PanierNotice::newInstanceWithId(3, + $panier_jeunesse_dupont = Class_PanierNotice::newInstanceWithId(3, ['libelle' => 'selection jeunesse', 'user' => Class_Users::newInstanceWithId(45, ['nom' => 'Dupont']), 'catalogues' => []]); $duchamp = Class_Users::newInstanceWithId(98, ['nom' => 'Duchamp']); - $panier_adulte_duchamp = Class_PanierNotice::newInstanceWithId(8, + $panier_adulte_duchamp = Class_PanierNotice::newInstanceWithId(8, ['libelle' => 'selection adulte', 'user' => $duchamp, 'catalogues' => []]); - $panier_senior_duchamp = Class_PanierNotice::newInstanceWithId(9, + $panier_senior_duchamp = Class_PanierNotice::newInstanceWithId(9, ['libelle' => 'selection senior', 'user' => $duchamp, 'catalogues' => []]); @@ -68,7 +68,7 @@ abstract class AdminCatalogueControllerTestCase extends AbstractControllerTestCa Storm_Test_ObjectWrapper::onLoaderOfModel('Class_PanierNoticeCatalogue') ->whenCalled('delete')->answers(true) ->whenCalled('save')->answers(true); - + $this->_catalogue_adultes = Class_Catalogue::newInstanceWithId(6, ['libelle' => 'Adultes', 'description' => 'Mon catalogue', @@ -81,11 +81,11 @@ abstract class AdminCatalogueControllerTestCase extends AbstractControllerTestCa 'sous_domaines' => [], 'bibliotheque' => 1, 'paniers' => []]); - + $this->user_referent=Class_Users::newInstanceWithId(2,['login' => 'referent', 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL, 'pseudo' => 'referent']); - $histoire = Class_Catalogue::newInstanceWithId(100, + $histoire = Class_Catalogue::newInstanceWithId(100, [ 'libelle' => 'Histoire', 'sous_domaines' => [ Class_Catalogue::newInstanceWithId(200, [ 'libelle' => 'Politique', @@ -93,7 +93,7 @@ abstract class AdminCatalogueControllerTestCase extends AbstractControllerTestCa 'dewey' =>78308, 'paniers' => [] ]), - + Class_Catalogue::newInstanceWithId(300, [ 'libelle'=>'Moyen-age', 'user' => $this->user_referent, 'parent_id' => 100, @@ -266,7 +266,7 @@ class CatalogueControllerWithAdminBibAndRightTotalAccessTest extends AdminCatalo /** @test */ public function editCatalogueShouldShowValiderButton() { $this->dispatch('/admin/catalogue/edit/id_catalogue/300'); - $this->assertXPathContentContains('//td', 'Valider'); + $this->assertXPathContentContains('//td', 'Valider'); } } @@ -350,7 +350,7 @@ class CatalogueControllerWithModoPortailIndexTest extends AdminCatalogueControll /** @test */ public function pageShouldDisplayOAIBaseUrl() { - $this->assertXPath(sprintf('//input[@class="permalink"][@readonly="true"][@value="http://localhost%s/opac/oai/request"]', + $this->assertXPath(sprintf('//input[@class="permalink"][@readonly="true"][@value="http://localhost%s/opac/oai/request"]', BASE_URL)); } } @@ -499,14 +499,14 @@ class CatalogueControllerActionTesterTest extends AdminCatalogueControllerTestCa ->with("select id_notice from notices where MATCH(facettes) AGAINST(' +(B1) +( D78308*)' IN BOOLEAN MODE) and type_doc IN (1, 3, 4, 5) and annee >= '2012' and annee <= '2012' order by alpha_titre LIMIT 5000") ->answers([ ['id_notice' => 2] ]); - + $this->dispatch('admin/catalogue/tester/id_catalogue/6', true); } /** @test */ public function pageShouldDisplayRequest() { - $this->assertContains("select * from notices where MATCH(facettes) AGAINST(' +(B1) +( D78308*)' IN BOOLEAN MODE) and type_doc IN (1, 3, 4, 5) and annee >= '2012' and annee <= '2012' order by alpha_titre LIMIT 0,20", + $this->assertContains("select * from notices where MATCH(facettes) AGAINST(' +(B1) +( D78308*)' IN BOOLEAN MODE) and type_doc IN (1, 3, 4, 5) and annee >= '2012' and annee <= '2012' order by alpha_titre LIMIT 0,20", $this->_response->getBody()); } @@ -525,7 +525,7 @@ class CatalogueControllerActionTesterTest extends AdminCatalogueControllerTestCa $this->assertEquals('alpha_titre', $params['order']); } - + /** @test */ public function modifyLinkShouldContainsSlashes() { $this->assertXPathContentContains('//a[contains(@href, "/admin/catalogue/edit/id_catalogue/6")]', "Modifier la définition du catalogue"); @@ -535,10 +535,10 @@ class CatalogueControllerActionTesterTest extends AdminCatalogueControllerTestCa -class CatalogueControllerEditUnknownCatalogueTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditUnknownCatalogueTest extends AdminCatalogueControllerTestCase { /** @test */ public function responseShouldRedirectToPageIndex() { - $this->dispatch('/admin/catalogue/edit/id_catalogue/1293234'); + $this->dispatch('/admin/catalogue/edit/id_catalogue/1293234'); $this->assertRedirectTo('/admin/catalogue/index'); } } @@ -546,7 +546,7 @@ class CatalogueControllerEditUnknownCatalogueTest extends AdminCatalogueControll -class CatalogueControllerEditCatalogueTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditCatalogueTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->fixture('Class_CodifAnnexe', ['id' => 1, 'code' => 12, 'libelle' => 'Annexe 12']); @@ -659,7 +659,7 @@ class CatalogueControllerEditCatalogueTest extends AdminCatalogueControllerTestC -class CatalogueControllerEditCatalogueInPopupTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditCatalogueInPopupTest extends AdminCatalogueControllerTestCase { protected $_json; @@ -671,8 +671,8 @@ class CatalogueControllerEditCatalogueInPopupTest extends AdminCatalogueControll } - /** - * @test + /** + * @test * @pagetitles */ public function titleShouldBeModificationDuDomaine() { @@ -683,7 +683,7 @@ class CatalogueControllerEditCatalogueInPopupTest extends AdminCatalogueControll /** @test */ public function boutonRetourShouldCloseThePopup() { $xpath = new Storm_Test_XPath(); - $xpath->assertXPath($this->_json->content, + $xpath->assertXPath($this->_json->content, '//div[@class="bouton"][contains(@onclick, "opacDialogClose")][not(contains(@onclick, "window.replace"))]'); } } @@ -691,7 +691,7 @@ class CatalogueControllerEditCatalogueInPopupTest extends AdminCatalogueControll -class CatalogueControllerEditCatalogueWithOAIServerTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditCatalogueWithOAIServerTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); @@ -712,7 +712,7 @@ class CatalogueControllerEditCatalogueWithOAIServerTest extends AdminCatalogueCo -class CatalogueControllerEditCataloguePostTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditCataloguePostTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->postDispatch('/admin/catalogue/edit/id_catalogue/6', array('libelle' => 'Jeunes', @@ -742,8 +742,8 @@ class CatalogueControllerEditCataloguePostTest extends AdminCatalogueControllerT -abstract class CatalogueControllerEditInPopupTestCase extends AdminCatalogueControllerTestCase { - protected +abstract class CatalogueControllerEditInPopupTestCase extends AdminCatalogueControllerTestCase { + protected $_json, $_xpath; @@ -756,11 +756,11 @@ abstract class CatalogueControllerEditInPopupTestCase extends AdminCatalogueCont -class CatalogueControllerEditInPopupPostTest extends CatalogueControllerEditInPopupTestCase { +class CatalogueControllerEditInPopupPostTest extends CatalogueControllerEditInPopupTestCase { public function setUp() { parent::setUp(); $_SERVER['HTTP_REFERER'] = 'opac/index'; - $this->postDispatch('/admin/catalogue/edit/id_catalogue/6/render/popup', + $this->postDispatch('/admin/catalogue/edit/id_catalogue/6/render/popup', ['libelle' => 'Jeunes', 'pcdm4' => '5']); $this->_json = json_decode($this->_response->getBody()); @@ -775,8 +775,8 @@ class CatalogueControllerEditInPopupPostTest extends CatalogueControllerEditInPo /** @test */ public function responseShouldBeARedirectWithJavascript() { - $this->_xpath->assertXPathContentContains($this->_json->content, - '//script', + $this->_xpath->assertXPathContentContains($this->_json->content, + '//script', 'window.location="opac/index"'); } } @@ -784,10 +784,10 @@ class CatalogueControllerEditInPopupPostTest extends CatalogueControllerEditInPo -class CatalogueControllerAddCatalogueInPopupPostTest extends CatalogueControllerEditInPopupTestCase { +class CatalogueControllerAddCatalogueInPopupPostTest extends CatalogueControllerEditInPopupTestCase { public function setUp() { parent::setUp(); - $this->postDispatch('/admin/catalogue/add/render/popup', + $this->postDispatch('/admin/catalogue/add/render/popup', ['libelle' => 'Geeks', 'pcdm4' => '5', 'annee_debut' => '20', @@ -804,8 +804,8 @@ class CatalogueControllerAddCatalogueInPopupPostTest extends CatalogueController /** @test */ public function responseShouldBeARedirectWithJavascript() { - $this->_xpath->assertXPathContentContains($this->_json->content, - '//script', + $this->_xpath->assertXPathContentContains($this->_json->content, + '//script', 'window.location="opac/index"'); } } @@ -813,7 +813,7 @@ class CatalogueControllerAddCatalogueInPopupPostTest extends CatalogueController -class CatalogueControllerDuplicateCatalogueTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerDuplicateCatalogueTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->dispatch('/admin/catalogue/duplicate/id_catalogue/200'); @@ -844,7 +844,7 @@ class CatalogueControllerDuplicateCatalogueTest extends AdminCatalogueController -class CatalogueControllerDuplicateCataloguePostTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerDuplicateCataloguePostTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->postDispatch('/admin/catalogue/duplicate/id_catalogue/6', array('libelle' => 'Jeunes', @@ -874,7 +874,7 @@ class CatalogueControllerDuplicateCataloguePostTest extends AdminCatalogueContro -class CatalogueControllerAddCatalogueTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerAddCatalogueTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->dispatch('/admin/catalogue/add/id_catalogue/100', true); @@ -922,7 +922,7 @@ class CatalogueControllerAddCatalogueTest extends AdminCatalogueControllerTestCa -class CatalogueControllerAddCataloguePostTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerAddCataloguePostTest extends AdminCatalogueControllerTestCase { protected $_new_catalogue; public function setUp() { @@ -984,7 +984,7 @@ class CatalogueControllerAddCataloguePostTest extends AdminCatalogueControllerTe -class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueControllerTestCase { protected $_new_catalogue; public function setUp() { @@ -996,7 +996,7 @@ class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueCon 'modules' => [ '10' => ['division' => '2', 'type_module' => 'KIOSQUE']], - + 'options' => []]); @@ -1007,7 +1007,7 @@ class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueCon }); - $this->postDispatch('/admin/catalogue/add/id_module/10', + $this->postDispatch('/admin/catalogue/add/id_module/10', ['libelle' => 'Geeks', 'pcdm4' => '5', 'annee_debut' => '20', @@ -1027,7 +1027,7 @@ class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueCon /** @test **/ public function boiteKiosqueShouldBeUpdatedToNewCatalogue78() { $this->assertEquals( - 78, + 78, Class_Profil::getCurrentProfil() ->getModuleAccueilPreferences(10, 'KIOSQUE')['id_catalogue']); } @@ -1036,7 +1036,7 @@ class CatalogueControllerAddCatalogueToAdultesPostTest extends AdminCatalogueCon -class CatalogueControllerAddCatalogueInvalidePostTest extends AdminCatalogueControllerTestCase { +class CatalogueControllerAddCatalogueInvalidePostTest extends AdminCatalogueControllerTestCase { protected $_new_catalogue; public function setUp() { @@ -1051,27 +1051,27 @@ class CatalogueControllerAddCatalogueInvalidePostTest extends AdminCatalogueCont /** @test */ public function pageShouldDisplayErrorsLibelleRequis() { $this->assertXPathContentContains('//p[@class="error"]', 'Le libellé est requis'); - } + } /** @test */ public function pageShouldDisplayErrorAnneeFinSuperieurAnneeDebut() { $this->assertXPathContentContains('//p[@class="error"]', "L'année de début doit être inférieure ou égale à l'année de fin"); - } + } } -class CatalogueControllerDeleteAction extends AdminCatalogueControllerTestCase { +class CatalogueControllerDeleteAction extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); $this->dispatch('/admin/catalogue/delete/id_catalogue/6'); } - + /** @test */ public function responseShouldRedirectToIndex() { - $this->assertRedirectTo('/admin/catalogue/index'); + $this->assertRedirectTo('/admin/catalogue/index'); } @@ -1084,7 +1084,7 @@ class CatalogueControllerDeleteAction extends AdminCatalogueControllerTestCase { -class CatalogueControllerDeleteActionForReferent extends AdminCatalogueControllerTestCase { +class CatalogueControllerDeleteActionForReferent extends AdminCatalogueControllerTestCase { protected function _loginHook($account) { $account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL; $account->ROLE = 'referent'; @@ -1096,10 +1096,10 @@ class CatalogueControllerDeleteActionForReferent extends AdminCatalogueControlle $this->dispatch('/admin/catalogue/delete/id_catalogue/6'); } - + /** @test */ public function responseShouldRedirectToIndex() { - $this->assertRedirectTo('/admin/catalogue/index'); + $this->assertRedirectTo('/admin/catalogue/index'); } @@ -1112,7 +1112,7 @@ class CatalogueControllerDeleteActionForReferent extends AdminCatalogueControlle -class CatalogueControllerEditActionForReferent extends AdminCatalogueControllerTestCase { +class CatalogueControllerEditActionForReferent extends AdminCatalogueControllerTestCase { protected function _loginHook($account) { $account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL; @@ -1124,17 +1124,17 @@ class CatalogueControllerEditActionForReferent extends AdminCatalogueControllerT $this->addUserToRightsReferent($this->user_referent); } - + /** @test */ public function withReferentShouldHideValiderButtonIfNotCreator() { $this->dispatch('/admin/catalogue/edit/id_catalogue/6'); - $this->assertNotXPathContentContains('//td', 'Valider'); + $this->assertNotXPathContentContains('//td', 'Valider'); } /** @test */ public function withReferentShouldShowValiderButtonIfCreator() { $this->dispatch('/admin/catalogue/edit/id_catalogue/300'); - $this->assertXPathContentContains('//td', 'Valider'); + $this->assertXPathContentContains('//td', 'Valider'); } } @@ -1172,7 +1172,7 @@ class CatalogueControllerPaniersHistoireTest extends AdminCatalogueControllerTes $this->assertXPathContentContains('//li', 'selection jeunesse - Dupont'); } - + /** @test */ public function formShouldContainsSelectWithAllPaniersAdmin() { $this->assertXPathContentContains('//form//select[@name="id_panier"]//option[@value="9"]', @@ -1198,7 +1198,7 @@ class CatalogueControllerPaniersHistoireTest extends AdminCatalogueControllerTes class CatalogueControllerPaniersHistoirePostPanierSelectionSenorTest extends AdminCatalogueControllerTestCase { public function setUp() { parent::setUp(); - $this->postDispatch('admin/catalogue/paniers/id_catalogue/100', + $this->postDispatch('admin/catalogue/paniers/id_catalogue/100', ['id_panier' => 9], true); } @@ -1210,7 +1210,7 @@ class CatalogueControllerPaniersHistoirePostPanierSelectionSenorTest extends Adm Class_Catalogue::find(100)->getPanierNotices()); } - + /** @test */ public function answerShouldRedirectToCataloguePanier100() { $this->assertRedirectTo('/admin/catalogue/paniers/id_catalogue/100'); @@ -1255,7 +1255,7 @@ class CatalogueControllerPaniersHistoireRemovePanierJeunesseTest extends AdminCa class CatalogueControllerDomaintePaniersJsonActionTest extends AbstractControllerTestCase { - + public function setup() { parent::setup(); @@ -1267,12 +1267,12 @@ class CatalogueControllerDomaintePaniersJsonActionTest extends AbstractControlle ->answers([]); } - + /** @test */ function withDomainesPaniersTreeShouldRenderArtJSON() { $this->dispatch('admin/catalogue/domaines-paniers-json',true); - - $expectedJSON = + + $expectedJSON = [ ['id' => 'panier_for_user', 'label' => 'Mes paniers', @@ -1293,7 +1293,7 @@ class CatalogueControllerDomaintePaniersJsonActionTest extends AbstractControlle 'items' => [], 'options' => ['multipleSelection' => false]]]; - + $this->assertJsonStringEqualsJsonString(json_encode($expectedJSON), $this->_response->getBody(),json_encode($this->_response->getBody())); @@ -1305,16 +1305,16 @@ class CatalogueControllerDomaintePaniersJsonActionTest extends AbstractControlle class AdminCatalogueControllerEditCatalogueWithWrongGenre extends AbstractControllerTestCase { public function setup() { parent::setup(); - + Class_CodifGenre::beVolatile(); - + $this->fixture('Class_Catalogue', ['id' => 15, 'libelle' => 'Mon Cata', 'description' => 'Mon catalogue', 'genre' => 2]); - $this->dispatch('/admin/catalogue/edit/id_catalogue/15'); + $this->dispatch('/admin/catalogue/edit/id_catalogue/15'); } diff --git a/tests/application/modules/opac/controllers/JavaControllerTest.php b/tests/application/modules/opac/controllers/JavaControllerTest.php index b20a6ac1e413bf5326b7e9c81b209bd2da4239ff..06fa6598cf1fc825919b4633be1982c16a977cb0 100644 --- a/tests/application/modules/opac/controllers/JavaControllerTest.php +++ b/tests/application/modules/opac/controllers/JavaControllerTest.php @@ -174,7 +174,7 @@ class JavaControllerKiosqueSlideShowWidthWrongParamsTest extends AbstractControl $this->mock_sql ->whenCalled('fetchAll') - ->with("select notices.id_notice, notices.editeur, notices.annee, notices.date_creation, notices.date_maj, notices.facettes, notices.clef_oeuvre from notices where url_vignette > '' and url_vignette != 'NO' order by date_creation DESC LIMIT 0,50", + ->with("select notices.id_notice, notices.editeur, notices.annee, notices.date_creation, notices.date_maj, notices.facettes, notices.clef_oeuvre from notices where url_vignette > '' and url_vignette != 'NO' order by date_creation DESC LIMIT 0,50", false) ->answers([]) ->beStrict();