diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index 89f7a00b6f44250fdb2600d16fed6aaac70bc681..91c0d91d2537076787aeb531f165868676a806b2 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -20,6 +20,7 @@ */ require_once 'AbstractControllerTestCase.php'; + class NoticeAjaxControllerNonRegressionTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -62,22 +63,23 @@ class NoticeAjaxControllerNonRegressionTest extends AbstractControllerTestCase { class NoticeAjaxControllerNoticeWithGamUrlTestCase extends AbstractControllerTestCase { protected $_wesley; + public function setUp() { parent::setUp(); $this->_wesley = $this->fixture( - 'Class_Notice', - ['id' => 1, - 'facettes' => 'A1', - 'isbn' => '', - 'ean' => '', - 'type_doc' => 1, - 'tome_alpha' => '', - 'clef_alpha' => 'Wesley', - 'unimarc' => "02502njm0 22007331 450 00100060000007100370000610000410004310100080008412700100009220000450010220000030014721000390015021500090018932700030019834500420020146400030024346400030024646400030024946400030025246400030025546400030025846400030026146400030026446400030026746400030027046400030027346400030027646400030027946400190028246400210030146400160032246400100033846400240034846400250037246400110039746400250040846400290043346400280046246400180049046400150050846400170052368600290054070000320056970000030060170100320060470200400063670200340067670200330071070200380074370200440078170200350082570200360086070200310089671100030092780100220093085601320095293301470108498401320123198500820136398500840144598500790152998500730160898500870168134793100a2784087bHIP-OSelect.com/Polydor a20130311d2011 u y0frey0103 ba0 aeng a53:221 aThe Lost album featuring Watermelon man 1 cUniversal RecordsdRÂeedition 2011 a1 cd1 b0602527840871cdisque compactd7,48 E 1 1 1 1 1 1 1 1 1 1 1 1 1 tWatermelon man tSweet loneliness tSecret love tSeulb tYou've got a friend tTransmograpification tUse me tGet on the good foot tEverybody plays the fool tAlone again (Naturally) tBack stabbers tJ.B. shout tFunky & some a1.382tJazz funky2PCDM4 1aWesleybFred40006trombone 1 1aThe JB's 40006ens. instr. 1aFarrellbJoe40006saxophone tÂenor 1aStammbMarvin4btr6trompette 1aBrownbCharlie40006guitare 1aCranshawbBob4MBS6basse guitare 1aBreckerbMichael40006saxophone tÂenor 1aBreckerbRandy4btr6trompette 1aCarterbRon4MBS6basse guitare 1aGaddbSteve4PDS6batterie02 0aFRbGAMc201303114 uhttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgzFred Wesley / Lost album featuring Watermelon man (The) 3http://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgahttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpg ahttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgbFred Wesley / Lost album featuring Watermelon man (The) ahttp://www.gamannecy.com/polysson/201205/01-0602527840871.mp3bWatermelon man ahttp://www.gamannecy.com/polysson/201205/02-0602527840871.mp3bSweet loneliness ahttp://www.gamannecy.com/polysson/201205/03-0602527840871.mp3bSecret love ahttp://www.gamannecy.com/polysson/201205/04-0602527840871.mp3bSeulb ahttp://www.gamannecy.com/polysson/201205/05-0602527840871.mp3bYou've got a friend", - 'annee' => '2000', - 'url_vignette' => 'wesley_small.png', - 'url_image' => 'wesley.png']); + 'Class_Notice', + ['id' => 1, + 'facettes' => 'A1', + 'isbn' => '', + 'ean' => '', + 'type_doc' => 1, + 'tome_alpha' => '', + 'clef_alpha' => 'Wesley', + 'unimarc' => "02502njm0 22007331 450 00100060000007100370000610000410004310100080008412700100009220000450010220000030014721000390015021500090018932700030019834500420020146400030024346400030024646400030024946400030025246400030025546400030025846400030026146400030026446400030026746400030027046400030027346400030027646400030027946400190028246400210030146400160032246400100033846400240034846400250037246400110039746400250040846400290043346400280046246400180049046400150050846400170052368600290054070000320056970000030060170100320060470200400063670200340067670200330071070200380074370200440078170200350082570200360086070200310089671100030092780100220093085601320095293301470108498401320123198500820136398500840144598500790152998500730160898500870168134793100a2784087bHIP-OSelect.com/Polydor a20130311d2011 u y0frey0103 ba0 aeng a53:221 aThe Lost album featuring Watermelon man 1 cUniversal RecordsdRÂeedition 2011 a1 cd1 b0602527840871cdisque compactd7,48 E 1 1 1 1 1 1 1 1 1 1 1 1 1 tWatermelon man tSweet loneliness tSecret love tSeulb tYou've got a friend tTransmograpification tUse me tGet on the good foot tEverybody plays the fool tAlone again (Naturally) tBack stabbers tJ.B. shout tFunky & some a1.382tJazz funky2PCDM4 1aWesleybFred40006trombone 1 1aThe JB's 40006ens. instr. 1aFarrellbJoe40006saxophone tÂenor 1aStammbMarvin4btr6trompette 1aBrownbCharlie40006guitare 1aCranshawbBob4MBS6basse guitare 1aBreckerbMichael40006saxophone tÂenor 1aBreckerbRandy4btr6trompette 1aCarterbRon4MBS6basse guitare 1aGaddbSteve4PDS6batterie02 0aFRbGAMc201303114 uhttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgzFred Wesley / Lost album featuring Watermelon man (The) 3http://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgahttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpg ahttp://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpgbFred Wesley / Lost album featuring Watermelon man (The) ahttp://www.gamannecy.com/polysson/201205/01-0602527840871.mp3bWatermelon man ahttp://www.gamannecy.com/polysson/201205/02-0602527840871.mp3bSweet loneliness ahttp://www.gamannecy.com/polysson/201205/03-0602527840871.mp3bSecret love ahttp://www.gamannecy.com/polysson/201205/04-0602527840871.mp3bSeulb ahttp://www.gamannecy.com/polysson/201205/05-0602527840871.mp3bYou've got a friend", + 'annee' => '2000', + 'url_vignette' => 'wesley_small.png', + 'url_image' => 'wesley.png']); $mock_sql = Storm_Test_ObjectWrapper::on(Zend_Registry::get('sql')); Zend_Registry::set('sql', $mock_sql); @@ -101,8 +103,9 @@ class NoticeAjaxControllerNoticeWithGamUrlTestCase extends AbstractControllerTes - class NoticeAjaxControllerNoticeWithCustomLinks extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); @@ -121,11 +124,13 @@ class NoticeAjaxControllerNoticeWithCustomLinks extends AbstractControllerTestCa $this->dispatch('/opac/noticeajax/detail/id_notice/999', true); } + /** @test */ public function detailsShouldContainPrice() { $this->assertXPathContentContains('//dt[contains(@class, "prix")]/following-sibling::dd', '18,80'); } + /** @test */ public function linkToPageDesLibrairesFrShouldBePresent() { $this->assertXPathContentContains('//a[contains(@href, "www.pagedeslibraires.fr/livre-6236/la-terreur.html")]', @@ -147,6 +152,7 @@ class NoticeAjaxControllerNoticeWithCustomLinks extends AbstractControllerTestCa abstract class NoticeAjaxControllerNoticeSouleymaneTestCase extends AbstractControllerTestCase { protected $_souleymane; + public function setUp() { parent::setUp(); @@ -155,7 +161,7 @@ abstract class NoticeAjaxControllerNoticeSouleymaneTestCase extends AbstractCont $this->fixture('Class_CodifAuteur', ['id' => 1, - 'libelle' => 'Souleymane Cisse']); + 'libelle' => 'Souleymane Cisse']); $this->_souleymane = Class_Notice::newInstanceWithId(1, ['facettes' => 'A1', @@ -175,7 +181,6 @@ abstract class NoticeAjaxControllerNoticeSouleymaneTestCase extends AbstractCont - class NoticeAjaxControllerDetailActionTest extends NoticeAjaxControllerNoticeSouleymaneTestCase { /** @test */ public function withNoticeFoundResponseShouldContainsTitleLaJeuneFille() { @@ -192,8 +197,9 @@ class NoticeAjaxControllerDetailActionTest extends NoticeAjaxControllerNoticeSou - class NoticeAjaxControllerNoticeSimilairesSouleymaneTest extends NoticeAjaxControllerNoticeSouleymaneTestCase { + + public function setUp() { parent::setUp(); @@ -263,8 +269,9 @@ class NoticeAjaxControllerNoticeSimilairesSouleymaneTest extends NoticeAjaxContr - class NoticeAjaxControllerResNumeriquesTest extends AbstractControllerTestCase { + + public function setup() { parent::setup(); $this->fixture('Class_Notice', ['id' => 123, @@ -311,8 +318,9 @@ class NoticeAjaxControllerResNumeriquesTest extends AbstractControllerTestCase { - abstract class NoticeAjaxControllerResNumeriquesFromFrbrLinkTestCase extends AbstractControllerTestCase { + + public function setup() { parent::setup(); $this->fixture('Class_Notice', ['id' => 123, 'clef_alpha' => 'ACESHIGH--IRONM---1984-1']); @@ -356,13 +364,14 @@ abstract class NoticeAjaxControllerResNumeriquesFromFrbrLinkTestCase extends Abs 'type_id' => 2, 'target' => ROOT_URL . BASE_URL . '/recherche/viewnotice/clef/ACESHIGH--IRONM---1984-1', 'source' => ROOT_URL . BASE_URL . '/bib-numerique/notice/id/43']); - } } class NoticeAjaxControllerResNumeriquesFromFrbrLinkTest extends NoticeAjaxControllerResNumeriquesFromFrbrLinkTestCase { + + public function setup() { parent::setup(); @@ -414,11 +423,13 @@ class NoticeAjaxControllerResNumeriquesFromFrbrLinkTest extends NoticeAjaxContro - class NoticeAjaxControllerResNumeriquesFromFrbrLinkNonAdminTest extends NoticeAjaxControllerResNumeriquesFromFrbrLinkTestCase { + + public function _login() { } + public function setup() { parent::setup(); @@ -433,31 +444,35 @@ class NoticeAjaxControllerResNumeriquesFromFrbrLinkNonAdminTest extends NoticeAj } + class NoticeAjaxControllerBandeAnnonceTest extends AbstractControllerTestCase { + /** @test */ public function shouldContainsSourceTitle() { Class_WebService_AllServices::setHttpClient( - Storm_Test_ObjectWrapper::mock() - ->whenCalled('open_url') - ->answers(json_encode(['source' => 'Testing', 'player' => 'toto']))); + Storm_Test_ObjectWrapper::mock() + ->whenCalled('open_url') + ->answers(json_encode(['source' => 'Testing', 'player' => 'toto']))); $this->dispatch('noticeajax/bandeannonce', true); $this->assertXPathContentContains('//h3', 'Source : Testing', $this->_response->getBody()); } - } + abstract class NoticeAjaxControllerLastFmTestCase extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); $this->lastfm = $this->mock(); Class_WebService_Lastfm::setInstance($this->lastfm); $this->fixture('Class_Notice', ['id' => 777]) - ->setAuteurPrincipal('Frodo') - ->setTypeDoc('3') - ->save(); + ->setAuteurPrincipal('Frodo') + ->setTypeDoc('3') + ->save(); } @@ -474,6 +489,7 @@ abstract class NoticeAjaxControllerLastFmTestCase extends AbstractControllerTest } + class NoticeAjaxControllerPhotosTest extends NoticeAjaxControllerLastFmTestCase { public function setUp() { parent::setUp(); @@ -483,28 +499,31 @@ class NoticeAjaxControllerPhotosTest extends NoticeAjaxControllerLastFmTestCase } + class NoticeAjaxControllerBibliographiesTest extends NoticeAjaxControllerLastFmTestCase { public function setUp() { parent::setUp(); $this->lastfm->whenCalled('getDiscographie')->with('Frodo') - ->answers([['vignette' => '', 'titre' => '']]); + ->answers([['vignette' => '', 'titre' => '']]); $this->dispatch('noticeajax/bibliographie?id_notice=777', true); } } class NoticeAjaxControllerInterviewsTest extends AbstractControllerTestCase { + + /** @test */ public function shouldContainsTitle() { $this->fixture('Class_Notice', ['id' => 777]) - ->setAuteurPrincipal('Frodo') - ->save(); + ->setAuteurPrincipal('Frodo') + ->save(); Class_WebService_AllServices::setHttpClient( - Storm_Test_ObjectWrapper::mock() - ->whenCalled('open_url')->answers(json_encode(['source' => 'Testing', - 'videos' => [['titre' => '', - 'contenu' => '']]]))); + Storm_Test_ObjectWrapper::mock() + ->whenCalled('open_url')->answers(json_encode(['source' => 'Testing', + 'videos' => [['titre' => '', + 'contenu' => '']]]))); $this->dispatch('noticeajax/videos?id_notice=777', true); $this->assertXPath('//h3'); @@ -515,6 +534,8 @@ class NoticeAjaxControllerInterviewsTest extends AbstractControllerTestCase { /** @see http://forge.afi-sa.fr/issues/16741 */ class NoticeAjaxControllerResumeGamWidgetTest extends AbstractControllerTestCase { + + /** @test */ public function shouldDisplayGamWidget() { $this->fixture('Class_Notice', @@ -585,6 +606,7 @@ class NoticeAjaxControllerResumeAlbumTest extends AbstractControllerTestCase { abstract class NoticeAjaxControllerExemplairesTestCase extends AbstractControllerTestCase { protected $_notice; + public function setUp() { parent::setUp(); @@ -626,17 +648,15 @@ abstract class NoticeAjaxControllerExemplairesTestCase extends AbstractControlle 'comm_sigb' => Class_IntBib::COM_NANOOK, 'comm_params' => serialize(['url_serveur' => ''])]); $this->fixture('Class_bib', - ['id' => 99, - ]); - - - + ['id' => 99]); } } class NoticeAjaxControllerExemplairesSameWorkTest extends NoticeAjaxControllerExemplairesTestCase { + + public function setUp() { parent::setUp(); @@ -649,44 +669,47 @@ class NoticeAjaxControllerExemplairesSameWorkTest extends NoticeAjaxControllerEx $this->assertXPathContentContains('//td', '1'); } -/** @test */ + + /** @test */ public function iconShouldBeLinkToAnotherNotice() { $this->assertXPath('//a[@href="/recherche/viewnotice/id/125"]//img[contains(@src,"loupe.gif")]' ,$this->_response->getBody()); - } } class NoticeAjaxControllerExemplairesWithIdBibs extends NoticeAjaxControllerExemplairesTestCase { + public function setUp() { parent::setUp(); $this->_notice->addExemplaire( - $this->fixture('Class_Exemplaire', - ['id' =>777, - 'id_bib' => 77, - 'id_int_bib' => 0, - 'id_notice' => 123, - 'annexe' => 'MOUL', - 'section' => 'A9', - 'emplacement' => 'emplacement de test', - 'cote' => 'VOD-T-II', - 'dispo' => 'Disponible', - 'date_retour' => 'En mai', - 'reservable' => true, - 'code_barres' => '7777734343488'])); + $this->fixture('Class_Exemplaire', + ['id' =>777, + 'id_bib' => 77, + 'id_int_bib' => 0, + 'id_notice' => 123, + 'annexe' => 'MOUL', + 'section' => 'A9', + 'emplacement' => 'emplacement de test', + 'cote' => 'VOD-T-II', + 'dispo' => 'Disponible', + 'date_retour' => 'En mai', + 'reservable' => true, + 'code_barres' => '7777734343488'])); $this->_notice->save(); Zend_Registry::get('session')->id_bibs=[77]; $this->dispatch('noticeajax/exemplaires/id/123/id_notice/8', true); } + /** @test */ public function coteVODTIIShouldBeInExemplaire() { $this->assertXPathContentContains('//td[@class="cote"]','VOD-T-II'); } + /** @test */ public function coteVODTShouldBeNotBeInExemplaire() { $this->assertNotXPathContentContains('//td[@class="cote"]','VOD-T-DLJ'); @@ -695,7 +718,10 @@ class NoticeAjaxControllerExemplairesWithIdBibs extends NoticeAjaxControllerExem } + class NoticeAjaxControllerExemplairesTest extends NoticeAjaxControllerExemplairesTestCase { + + public function setUp() { parent::setUp(); @@ -714,6 +740,7 @@ class NoticeAjaxControllerExemplairesTest extends NoticeAjaxControllerExemplaire $this->assertXPathContentContains('//td', 'VOD-T-DLJ'); } + /** @test */ public function shouldHaveClassDisponble() { $this->assertXPath('//td[@class="dispo disponible"]'); @@ -725,6 +752,7 @@ class NoticeAjaxControllerExemplairesTest extends NoticeAjaxControllerExemplaire $this->assertNotXPath('//a[contains(@href, "/admin/modulesnotice/exemplaires")]', $this->_response->getBody()); } + /** @test */ public function fonctionsAdminShouldBeVisibleIfCurrentUserIsAdmin() { $this->bootstrap(); @@ -748,6 +776,8 @@ class NoticeAjaxControllerExemplairesTest extends NoticeAjaxControllerExemplaire class NoticeAjaxControllerBabelthequeTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); @@ -789,8 +819,9 @@ class NoticeAjaxControllerBabelthequeTest extends AbstractControllerTestCase { - class NoticeAjaxControllerBabelthequeWithoutOptionTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); @@ -811,13 +842,15 @@ class NoticeAjaxControllerBabelthequeWithoutOptionTest extends AbstractControlle class NoticeAjaxControllerFrbrNotFoundTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') - ->whenCalled('find') - ->with(777) - ->answers(null); + ->whenCalled('find') + ->with(777) + ->answers(null); $this->dispatch('/opac/noticeajax/frbr?id_notice=777', true); } @@ -836,10 +869,12 @@ class NoticeAjaxControllerFrbrNotFoundTest extends AbstractControllerTestCase { } + abstract class NoticeAjaxControllerFrbrWithLinksTestCase extends AbstractControllerTestCase { private $_lesGrandsTextes; private $_moiCEstQuoi; + public function setUp() { parent::setUp(); Storm_Model_Loader::defaultToVolatile(); @@ -900,7 +935,7 @@ abstract class NoticeAjaxControllerFrbrWithLinksTestCase extends AbstractControl protected function _getUrlForKey($key) { return 'http://localhost' . BASE_URL . '/recherche/viewnotice/clef/' . $key - . '?id_profil=1&type_doc=1'; + . '?id_profil=1&type_doc=1'; } @@ -939,6 +974,7 @@ abstract class NoticeAjaxControllerFrbrWithLinksTestCase extends AbstractControl $this->assertXPath('//a[contains(@href, "/viewnotice/clef/' . $this->_moiCEstQuoi . '")]',$this->_response->getBody()); } + /** @test */ public function vignetteForMoiCestQuoiShouldMoiCestQuoiDotJpg() { $this->assertXPath('//img[contains(@src, "moi_c_est_quoi.jpg")]'); @@ -954,6 +990,8 @@ abstract class NoticeAjaxControllerFrbrWithLinksTestCase extends AbstractControl class NoticeAjaxControllerFrbrWithLinksTest extends NoticeAjaxControllerFrbrWithLinksTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/frbr?id_notice=777', true); @@ -963,6 +1001,8 @@ class NoticeAjaxControllerFrbrWithLinksTest extends NoticeAjaxControllerFrbrWith class NoticeAjaxControllerFrbrWithLinksAndNInIdTest extends NoticeAjaxControllerFrbrWithLinksTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/frbr?id_notice=N777', true); @@ -971,8 +1011,9 @@ class NoticeAjaxControllerFrbrWithLinksAndNInIdTest extends NoticeAjaxController - class NoticeAjaxControllerNoticeActionTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); $this->notice = Class_Notice::getLoader()->findFirstBy([]); @@ -986,6 +1027,7 @@ class NoticeAjaxControllerNoticeActionTest extends AbstractControllerTestCase { $this->assertXPathContentContains('//h1', 'Bending new corners'); } + /** @test */ public function shouldContainsTitle() { $this->assertXPath('//div[contains(@class, "notice_bloc_titre") and h2]'); @@ -994,8 +1036,9 @@ class NoticeAjaxControllerNoticeActionTest extends AbstractControllerTestCase { - class NoticeAjaxControllerVideoMorceauTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/videomorceau?auteur=The%20Beatles&titre=Come%20together&width=300', true); @@ -1022,8 +1065,9 @@ class NoticeAjaxControllerVideoMorceauTest extends AbstractControllerTestCase { - class NoticeAjaxControllerResumeNoticeTest extends AbstractControllerTestCase { + + /** @test */ public function withResumeNoticeShouldRenderHistoireDeLHomme() { Class_Notice::newInstanceWithId(123, @@ -1035,7 +1079,6 @@ class NoticeAjaxControllerResumeNoticeTest extends AbstractControllerTestCase { } - /** @test */ public function withoutResumeNoticeShouldRenderAucunResume() { Class_Notice::newInstanceWithId(123, @@ -1048,38 +1091,35 @@ class NoticeAjaxControllerResumeNoticeTest extends AbstractControllerTestCase { - - - class NoticeAjaxControllerDVDSeriesTest extends AbstractControllerTestCase { /** @test */ public function withSeriesNoticeShouldOzSeason3() { $oz_season1=Class_Notice::newInstanceWithId(234, - ['titre_principal' => 'Oz Season 1', - 'clef_chapeau' => 'OZ', - 'tome_alpha' => '4', - 'type_doc' => Class_TypeDoc::DVD, - 'resume' => 'Serie TV']); + ['titre_principal' => 'Oz Season 1', + 'clef_chapeau' => 'OZ', + 'tome_alpha' => '4', + 'type_doc' => Class_TypeDoc::DVD, + 'resume' => 'Serie TV']); $oz_season1->set_subfield('461','t', 'OZ'); $oz_season3 = Class_Notice::newInstanceWithId(2345, - ['titre_principal' => 'Oz saison 3', - - 'clef_chapeau' => 'OZ', - 'type_doc' => Class_TypeDoc::DVD, - 'tome_alpha' => '3', - 'url_vignette' => '', - 'url_image' => '', - 'resume' => 'Serie TV']); + ['titre_principal' => 'Oz saison 3', + + 'clef_chapeau' => 'OZ', + 'type_doc' => Class_TypeDoc::DVD, + 'tome_alpha' => '3', + 'url_vignette' => '', + 'url_image' => '', + 'resume' => 'Serie TV']); $oz_season3->set_subfield('461','t', 'OZ'); $oz_season2 = Class_Notice::newInstanceWithId(23456, - ['titre_principal' => 'Oz saison 2', - 'clef_chapeau' => 'OZ', - 'tome_alpha' => '3', - 'url_vignette' => '', - 'url_image' => '', - 'type_doc' => Class_TypeDoc::DVD, - 'resume' => 'Serie TV']); + ['titre_principal' => 'Oz saison 2', + 'clef_chapeau' => 'OZ', + 'tome_alpha' => '3', + 'url_vignette' => '', + 'url_image' => '', + 'type_doc' => Class_TypeDoc::DVD, + 'resume' => 'Serie TV']); $oz_season2->set_subfield('461','t', 'OZ'); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') ->whenCalled('findAllBy') @@ -1095,8 +1135,9 @@ class NoticeAjaxControllerDVDSeriesTest extends AbstractControllerTestCase { - class NoticeAjaxControllerPeriodiqueSerieTest extends AbstractControllerTestCase { + + /** @test */ public function withPeriodiqueNoticeShouldDisplayTousLesNumerosDeFakir() { Class_Notice::newInstanceWithId(234, @@ -1109,23 +1150,23 @@ class NoticeAjaxControllerPeriodiqueSerieTest extends AbstractControllerTestCase $fakir57= Class_Notice::newInstanceWithId(2345, - ['titre_principal' => 'Fakir 57 septembre-novembre 2012', - 'unimarc' => '00179nas0 2200085 450 0010008000001000018000082000039000262100009000654610019000743037025 a|||||||||2012 aFakirh57iSeptembre-Novembre 2012 d2012 032979322tFakir', - 'clef_chapeau' => 'FAKIR', - 'type_doc' => Class_TypeDoc::PERIODIQUE, - 'tome_alpha' => '57', - 'url_vignette' => '', - 'url_image' => '', - 'resume' => 'Fakir hebdo']); + ['titre_principal' => 'Fakir 57 septembre-novembre 2012', + 'unimarc' => '00179nas0 2200085 450 0010008000001000018000082000039000262100009000654610019000743037025 a|||||||||2012 aFakirh57iSeptembre-Novembre 2012 d2012 032979322tFakir', + 'clef_chapeau' => 'FAKIR', + 'type_doc' => Class_TypeDoc::PERIODIQUE, + 'tome_alpha' => '57', + 'url_vignette' => '', + 'url_image' => '', + 'resume' => 'Fakir hebdo']); $fakir56 = Class_Notice::newInstanceWithId(23456, - ['titre_principal' => 'juillet Fakir 56', - 'unimarc' => '00168nas0 2200085 450 0010008000001000018000082000028000262100009000544610019000633025081 a|||||||||2012 aFakirh56iJuillet 2012 d2012 032979322tFakir', - 'clef_chapeau' => 'FAKIR', - 'tome_alpha' => '56', - 'url_vignette' => '', - 'url_image' => '', - 'type_doc' => Class_TypeDoc::PERIODIQUE, - 'resume' => 'Fakir hebdo']); + ['titre_principal' => 'juillet Fakir 56', + 'unimarc' => '00168nas0 2200085 450 0010008000001000018000082000028000262100009000544610019000633025081 a|||||||||2012 aFakirh56iJuillet 2012 d2012 032979322tFakir', + 'clef_chapeau' => 'FAKIR', + 'tome_alpha' => '56', + 'url_vignette' => '', + 'url_image' => '', + 'type_doc' => Class_TypeDoc::PERIODIQUE, + 'resume' => 'Fakir hebdo']); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') ->whenCalled('findAllBy') @@ -1141,9 +1182,9 @@ class NoticeAjaxControllerPeriodiqueSerieTest extends AbstractControllerTestCase +abstract class NoticeAjaxMemeAuteurTest extends AbstractControllerTestCase { -abstract class NoticeAjaxMemeAuteurTest extends AbstractControllerTestCase { /** @test */ public function withAuteurNoticeShouldOzSeason3() { Class_Notice::newInstanceWithId(234, @@ -1157,13 +1198,6 @@ abstract class NoticeAjaxMemeAuteurTest extends AbstractControllerTestCase { 'alpha_auteur' => 'HENRI LABORIT', 'resume' => '']); -/* Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') - ->whenCalled('findAllBy') - ->with(['clef_chapeau' => 'OZ', - 'order' => 'tome_alpha']) - ->answers([$oz_season2, $oz_season3]); -*/ - $this->dispatch('/noticeajax/auteur?id_notice=234',true); $this->assertXPathContentContains('//body', 'nouvelle grille',$this->_response->getBody()); } @@ -1181,12 +1215,14 @@ abstract class NoticeAjaxMemeAuteurTest extends AbstractControllerTestCase { } + class NoticeAjaxControllerDisponibiliteNoticeTest extends AbstractControllerTestCase { protected $_notice, $_exemplaire, $_sigb_exemplaire; + public function setUp() { parent::setUp(); $this->_sigb_exemplaire = Storm_Test_ObjectWrapper::mock(); @@ -1224,6 +1260,7 @@ class NoticeAjaxControllerDisponibiliteNoticeTest extends AbstractControllerTest $this->assertDispoNoticeHtmlContains('false'); } + /** @test */ public function withNonAvailableExemplaireShouldNotBeAvailable() { $this->_sigb_exemplaire->whenCalled('isDisponible') @@ -1231,6 +1268,7 @@ class NoticeAjaxControllerDisponibiliteNoticeTest extends AbstractControllerTest $this->assertDispoNoticeHtmlContains('false'); } + /** @test */ public function withAvailableExemplaireShouldBeAvailable() { $this->_sigb_exemplaire->whenCalled('isDisponible') @@ -1252,6 +1290,7 @@ class NoticeAjaxControllerDisponibiliteNoticeTest extends AbstractControllerTest return $this->_notice; } + /** * @test * @depends assertNoticeShouldBeUpdatedWithAvailabilityTrue @@ -1289,8 +1328,9 @@ class NoticeAjaxControllerDisponibiliteNoticeTest extends AbstractControllerTest - abstract class NoticeAjaxControllerNoticeWithAvisTestCase extends AbstractControllerTestCase { + + public function setup() { parent::setup(); @@ -1346,6 +1386,7 @@ class NoticeAjaxControllerNoticeWithAvisEditLinkGuestLoggedTest extends NoticeAj } + /** @test */ public function editLinkShouldNotBePresent() { $this->dispatch('/opac/noticeajax/avis/id_notice/34/page/0/onglet/bloc', true); @@ -1361,6 +1402,7 @@ class NoticeAjaxControllerNoticeWithAvisEditLinkModoLoggedTest extends NoticeAja $account->ROLE = 'modo_bib'; } + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/avis/id_notice/34/page/0/onglet/bloc', true); @@ -1388,6 +1430,8 @@ class NoticeAjaxControllerNoticeWithAvisEditLinkModoLoggedTest extends NoticeAja class NoticeAjaxControllerAvisNoticeNotFoundTest extends AbstractControllerTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/avis/id_notice/-1', true); @@ -1404,6 +1448,8 @@ class NoticeAjaxControllerAvisNoticeNotFoundTest extends AbstractControllerTestC class NoticeAjaxControllerNoticeWithAvisAvisAbonneTest extends NoticeAjaxControllerNoticeWithAvisTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('/opac/noticeajax/avis-abonne/id_notice/34', true); @@ -1427,7 +1473,6 @@ class NoticeAjaxControllerNoticeWithAvisAvisAbonneTest extends NoticeAjaxControl - class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNoticeWithAvisTestCase { public function setUp() { parent::setUp(); @@ -1436,7 +1481,7 @@ class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNot ['id' => 1, 'login' => 'pom', 'password' => '123', - ]); + ]); $user->setRoleLevel(ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL)->save(); ZendAfi_Auth::getInstance()->logUser($user); @@ -1447,7 +1492,6 @@ class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNot } - /** @test */ public function linkAddAvisShouldBePopup() { $this->assertXPathContentContains('//a[contains(@href, "/noticeajax/add-avis/id_notice/34")][@data-popup="true"]', @@ -1456,7 +1500,10 @@ class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNot } + abstract class NoticeAjaxControllerCvsSearchtest extends AbstractControllerTestCase { + + public function setup() { parent::setup(); RessourcesNumeriquesFixtures::activateCVS(); @@ -1465,13 +1512,17 @@ abstract class NoticeAjaxControllerCvsSearchtest extends AbstractControllerTestC 'login' => 'polo', 'password' => '456', 'pseudo' => 'polo']) - ->beAbonneSIGB(); + ->beAbonneSIGB(); ZendAfi_Auth::getInstance()->logUser($polo); } } + + class NoticeAjaxControllerCvsSearchWithNoRecordTest extends NoticeAjaxControllerCvsSearchtest { + + public function setUp() { parent::setUp(); @@ -1501,14 +1552,15 @@ class NoticeAjaxControllerCvsWithRecordsSearchTest extends NoticeAjaxControllerC protected $_cvs; protected $_http_client; + public function setUp() { parent::setUp(); Class_Profil::getCurrentProfil() ->setCfgModules(['recherche' => ['resultatsimple' => [ 'cvs_display_position' => '1', - 'liste_format' => 3, - 'cvs_nb_result' => 2]]]); + 'liste_format' => 3, + 'cvs_nb_result' => 2]]]); RessourcesNumeriquesFixtures::activateCVS(); @@ -1560,8 +1612,6 @@ class NoticeAjaxControllerCvsWithRecordsSearchTest extends NoticeAjaxControllerC - - class NoticeAjaxControllerErrorTagsTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -1593,8 +1643,9 @@ abstract class NoticeAjaxControllerBiographieTestCase extends AbstractController - class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieTestCase { + + public function setUp() { parent::setUp(); @@ -1612,9 +1663,9 @@ class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieT 'vignette' => 'rowling.jpg', 'image' => 'rowling_big.jpg', 'biographie' => [ - ['texte' => 'Auteur de H.Potter'] - ] - ]))); + ['texte' => 'Auteur de H.Potter'] + ] + ]))); $this->dispatch('/opac/noticeajax/biographie/id_notice/23', true); } @@ -1642,16 +1693,19 @@ class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieT $this->assertXPathContentContains('//a', 'Modifier la biographie'); } + /** @test */ public function shouldContainTitle() { $this->assertXPath('//h3'); } + /** @test */ public function tdShouldContainTitle() { $this->assertXPath('//td[contains(@class, "notice_info_titre") and h3]'); } + /** @test */ public function asAbonneLienModifierShouldNotBeVisible() { $this->bootstrap(); @@ -1666,8 +1720,9 @@ class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieT - class NoticeAjaxControllerBiographieNonTrouveeTest extends NoticeAjaxControllerBiographieTestCase { + + public function setUp() { parent::setUp(); @@ -1678,7 +1733,7 @@ class NoticeAjaxControllerBiographieNonTrouveeTest extends NoticeAjaxControllerB 'vignette' => '', 'image' => '', 'biographie' => '' - ]))); + ]))); $this->dispatch('/opac/noticeajax/biographie/id_notice/23', true); } @@ -1691,7 +1746,6 @@ class NoticeAjaxControllerBiographieNonTrouveeTest extends NoticeAjaxControllerB - abstract class NoticeAjaxControllerLocalisationTestCase extends AbstractControllerTestCase { protected $_json; @@ -1743,11 +1797,14 @@ abstract class NoticeAjaxControllerLocalisationTestCase extends AbstractControll class NoticeAjaxControllerNoLocalisationTest extends NoticeAjaxControllerLocalisationTestCase { + + public function setUp() { parent::setUp(); $this->dispatch('noticeajax/localisation/id_bib/1', true); } + /** @test */ public function errorMessageShouldBeAsExpected() { $this->assertEquals('{"erreur":"Aucune donn\u00e9e de localisation trouv\u00e9e pour cet exemplaire"}', $this->_response->getBody()); @@ -1757,6 +1814,8 @@ class NoticeAjaxControllerNoLocalisationTest extends NoticeAjaxControllerLocalis class NoticeAjaxControllerNoLocaltionForExemplaireTest extends NoticeAjaxControllerLocalisationTestCase { + + public function setUp() { parent::setUp(); @@ -1783,8 +1842,9 @@ class NoticeAjaxControllerNoLocaltionForExemplaireTest extends NoticeAjaxControl - class NoticeAjaxControllerWithLocalisationTest extends NoticeAjaxControllerLocalisationTestCase { + + public function setUp() { parent::setUp(); @@ -1819,8 +1879,9 @@ class NoticeAjaxControllerWithLocalisationTest extends NoticeAjaxControllerLocal - class NoticeAjaxControllerWithMultipleSelectorLocalisationTest extends NoticeAjaxControllerLocalisationTestCase { + + public function setUp() { parent::setUp(); @@ -1858,6 +1919,8 @@ class NoticeAjaxControllerWithMultipleSelectorLocalisationTest extends NoticeAja class NoticeAjaxControllerLocalisationWithCoteTest extends NoticeAjaxControllerLocalisationTestCase { + + public function setUp() { parent::setUp(); $this->fixture('Class_Exemplaire', @@ -1890,9 +1953,9 @@ class NoticeAjaxControllerLocalisationWithCoteTest extends NoticeAjaxController +class NoticeAjaxControllerLocalisationWithStartedCoteTest extends NoticeAjaxControllerLocalisationTestCase { -class NoticeAjaxControllerLocalisationWithStartedCoteTest extends NoticeAjaxControllerLocalisationTestCase { public function setUp() { parent::setUp(); $this->fixture('Class_Exemplaire', @@ -1925,7 +1988,6 @@ class NoticeAjaxControllerLocalisationWithStartedCoteTest extends NoticeAjaxCon - class NoticeAjaxControllerLocalisationWithEndCoteTest extends NoticeAjaxControllerLocalisationTestCase { public function setUp() { parent::setUp();