From c3f8245971964aef0df0aadf8ad2de41dcd0adb8 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@afi-sa.fr> Date: Wed, 3 Feb 2016 15:14:11 +0100 Subject: [PATCH] dev #37100 test fix --- .../controllers/RechercheControllerTest.php | 35 ------------------- .../SocialNetworkControllerTest.php | 28 +-------------- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 6ea3758e04e..e5af13439f9 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -137,41 +137,6 @@ class RechercheControllerPrintTest extends RechercheControllerNoticeTestCase { - -class RechercheControllerReseauTest extends RechercheControllerNoticeTestCase { - public function setUp() { - ZendAfi_View_Helper_ShareUrl::setDefaultWebClient(Storm_Test_ObjectWrapper::mock() - ->whenCalled('open_url') - ->answers(false)); - parent::setUp(); - $this->dispatch(sprintf('recherche/reseau/id_notice/%d/type_doc/1', - $this->notice->getId()), - true); - } - - - public function tearDown() { - parent::tearDown(); - ZendAfi_View_Helper_ShareUrl::setDefaultWebClient(null); - } - - - /** @test */ - public function getResauShouldContainsTwitterGif() { - $this->assertXPath('//img[contains(@src, "twitter.gif")]'); - } - - - /** @test */ - public function getResauShouldContainsTwitterLink() { - $this->assertContains("$.getScript('/social-network/share/id_notice/345/type_doc/1/on/twitter/url", - $this->_response->getBody()); - } -} - - - - class RechercheControllerViewNoticeBabelthequeTest extends RechercheControllerNoticeTestCase { /** @test */ public function withoutBabelthequeJSShouldNotBeLoaded() { diff --git a/tests/application/modules/opac/controllers/SocialNetworkControllerTest.php b/tests/application/modules/opac/controllers/SocialNetworkControllerTest.php index 554e4f372f0..ed8dead0ad7 100644 --- a/tests/application/modules/opac/controllers/SocialNetworkControllerTest.php +++ b/tests/application/modules/opac/controllers/SocialNetworkControllerTest.php @@ -21,37 +21,11 @@ require_once 'AbstractControllerTestCase.php'; class SocialNetworkControllerShareActionTest extends AbstractControllerTestCase { - protected $_mock_web_client; - - public function setUp() { - parent::setUp(); - $this->_mock_web_client = Storm_Test_ObjectWrapper::on(new Class_WebService_SimpleWebClient()); - ZendAfi_View_Helper_ShareUrl::setDefaultWebClient($this->_mock_web_client); - } - - - public function tearDown() { - ZendAfi_View_Helper_ShareUrl::resetDefaultWebClient(); - parent::tearDown(); - } - - - protected function _expectClientOpenUrlWithLongUrlAndAnswer($url, $answer) { - $this->_mock_web_client - ->whenCalled('open_url') - ->with(sprintf('http://is.gd/api.php?longurl=%s', urlencode($url))) - ->answers($answer) - ->beStrict(); - } - - /** @test */ public function shareOnTwitterShouldInjectShortUrlAndMessageAndCountUrl() { - $this->_expectClientOpenUrlWithLongUrlAndAnswer('http://www.institut-francais.com', - 'http://is.gd/PkdNgD'); $this->dispatch('/social-network/share/on/twitter/url/'.urlencode('http://www.institut-francais.com').'/titre/'.urlencode('Vive bucarest !').'/counturl/'.urlencode('http://www.institut-francais.com'), true); - $this->assertEquals("window.open('http://twitter.com/share?url=http%3A%2F%2Fis.gd%2FPkdNgD&text=Vive+bucarest+%21&counturl=http%3A%2F%2Fis.gd%2FPkdNgD','_blank','toolbar=0,status=0,width=800, height=410');", + $this->assertEquals("window.open('http://twitter.com/share?url=http%3A%2F%2Fwww.institut-francais.com&text=Vive+bucarest+%21&counturl=http%3A%2F%2Fwww.institut-francais.com','_blank','toolbar=0,status=0,width=800, height=410');", $this->_response->getBody()); } -- GitLab