diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index f49f2e86ab336491239286160323d536acb0ceb6..21d62b60279ba3dfe6a6e4ab0f300c1590ad1685 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -510,12 +510,14 @@ class AuthControllerPostTest extends AuthControllerNobodyLoggedTestCase { $this->assertRedirectTo($this->_referer); } - /** @test */ - public function validAjaxAuthenticationShouldARedirect() { + + /** @test */ + public function validAjaxAuthenticationShouldRedirectToReferrer() { $this->ajaxLoggingWithCorrectInformation(); - $this->assertXPathContentContains('//script' , 'var url= window.parent.location.href;',$this->_response->getBody()); + $this->assertRedirectTo($this->_referer); } + /** @test */ public function validAuthenticationTitreBoiteShouldBeVousEtesConnecte () { $this->loggedAsAdmin(); diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index d61f3b3923c4baa51f88e45e09989bf5f205a7be..86dc82895aeb0055caac5d9d46605d17224c6bee 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -744,9 +744,8 @@ class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNot /** @test */ public function linkAddAvisShouldBePopup() { - $this->assertXPathContentContains('//a[contains(@href, "abonne/avis/id_notice/34")][@data-popup="true"]', - 'Donnez ou modifiez votre avis', - $this->_response->getBody()); + $this->assertXPathContentContains('//a[contains(@href, "/noticeajax/add-avis/id_notice/34")][@data-popup="true"]', + 'Donnez ou modifiez votre avis'); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index cdc68a14f9db78ac4bf619d6b63b060fb502811b..c08532373b63b11b964b1f38fc9906b80a0b142c 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -425,6 +425,8 @@ class RechercheControllerViewNoticeAsAdminTest extends RechercheControllerNotice class RechercheControllerReservationPickupAjaxActionTest extends AbstractControllerTestCase { + protected $_json, $_xpath; + public function setUp() { parent::setUp(); @@ -440,35 +442,39 @@ class RechercheControllerReservationPickupAjaxActionTest extends AbstractControl ->setCode('CRN'))); $this->dispatch('recherche/reservation-pickup-ajax?id_bib=2&id_origine=12&code_annexe=ANN'); + $this->_json = json_decode($this->_response->getBody()); + $this->_xpath = new Storm_Test_XPath(); } /** @test */ public function shouldRenderAnnecyCheckedRadio() { - $this->assertXPath('//input[@name="code_annexe"][@value="ANN"][@checked="checked"]'); + $this->_xpath->assertXPath($this->_json->content, + '//input[@name="code_annexe"][@value="ANN"][@checked="checked"]'); } /** @test */ public function shouldRenderCranRadio() { - $this->assertXPath('//input[@name="code_annexe"][@value="CRN"]'); + $this->_xpath->assertXPath($this->_json->content, + '//input[@name="code_annexe"][@value="CRN"]'); } /** @test */ public function layoutShouldBeEmpty() { - $this->assertNotXPath('//div[@id="banniere"]'); + $this->_xpath->assertNotXPath($this->_json->content, '//div[@id="banniere"]'); } } + abstract class RechercheControllerSimpleActionTestCase extends AbstractControllerTestCase { public function setUp() { parent::setUp(); Class_AdminVar::newInstanceWithId('FACETTE_TYPE_DOC_LIBELLE', ['valeur' => 'Type de document']); } - } diff --git a/tests/library/Class/CVSLinkTest.php b/tests/library/Class/CVSLinkTest.php index 1ecc279adf354e32de262e003044dd61e9deb436..309b91dc7b7dd12a2b345f28e27a5a830c8fa57b 100644 --- a/tests/library/Class/CVSLinkTest.php +++ b/tests/library/Class/CVSLinkTest.php @@ -165,37 +165,36 @@ class CVSLinkWithAbonTest extends CVSLinkTestCase { protected function _expectedXML() { - return <<<EOXML -<?xml version="1.0" encoding="utf-8"?> - <albums> - <header> - <bmid>22223</bmid> - <sourceid>22225</sourceid> - <key>d0a1b72e8e6d7af27d400e2009c1a873</key> - <time>1369640315</time> - <adhid>34</adhid> - <action>acces_site</action> - </header><body> - <querystring><![CDATA[]]></querystring> - <affichage>complet</affichage> - </body></albums> -EOXML; + $xml="<?xml version=\"1.0\" encoding=\"utf-8\"?> + <albums> + <header> + <bmid>22223</bmid> + <sourceid>22225</sourceid> + <key>d0a1b72e8e6d7af27d400e2009c1a873</key> + <time>1369640315</time> + <adhid>34</adhid> + <action>acces_site</action> + </header> + <body> + <querystring><![CDATA[]]></querystring> + <affichage>complet</affichage> + </body> + </albums>"; + return $this->_cvs->formatXML($xml); } protected function _returnedXML() { - return <<<EOXML -<?xml version="1.0" encoding="UTF-8"?> -<response> - <success>1</success> - <key>e1205ecb51fcb573303e2a67962e0a1e</key> - <time>1369639886</time> - <action>acces_site</action> - <data> - <url>http://montauban.cvs-mediatheques.com/?ln=musique&con=01255712bd8d68e9e08fe3ff1dadc57a&if=0</url> - </data> -</response> -EOXML; + return "<?xml version=\"1.0\" encoding=\"UTF-8\"?> + <response> + <success>1</success> + <key>e1205ecb51fcb573303e2a67962e0a1e</key> + <time>1369639886</time> + <action>acces_site</action> + <data> + <url>http://montauban.cvs-mediatheques.com/?ln=musique&con=01255712bd8d68e9e08fe3ff1dadc57a&if=0</url> + </data> + </response>"; }