From 239d145cd3fa56937e5e7f9527e8d7e49c8a2426 Mon Sep 17 00:00:00 2001
From: pbarroca <pbarroca@git-test.afi-sa.fr>
Date: Thu, 12 Apr 2012 15:53:03 +0000
Subject: [PATCH] =?UTF-8?q?Tests:=20Suppression=20des=20r=C3=A9f=C3=A9renc?=
 =?UTF-8?q?es=20en=20dur=20au=20r=C3=A9pertoire=20afi-opac3=20+=20suppress?=
 =?UTF-8?q?ions=20xdebug=5Fbreak()?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../opac/controllers/AuthController.php       |  2 +-
 .../admin/controllers/AdminControllerTest.php |  2 +-
 .../admin/controllers/AlbumControllerTest.php |  4 +-
 .../admin/controllers/CmsControllerTest.php   |  6 +-
 .../controllers/FormationControllerTest.php   |  1 -
 .../controllers/AbonneControllerAvisTest.php  |  6 +-
 .../BibControllerIndexActionTest.php          |  2 +-
 .../BibNumeriqueControllerTest.php            |  6 +-
 .../ProfilOptionsControllerTest.php           |  2 +-
 tests/library/Class/AlbumRessourceTest.php    | 21 +++---
 tests/library/Class/AlbumTest.php             |  4 +-
 tests/library/Class/I18nTest.php              |  2 -
 tests/library/Class/NewsletterMailingTest.php |  8 +--
 tests/library/Class/ScriptLoaderTest.php      |  4 +-
 .../Class/WebService/ReseauxSociauxTest.php   | 67 +++++++------------
 .../View/Helper/Accueil/BibNumeriqueTest.php  |  2 +-
 .../View/Helper/Accueil/CalendarTest.php      |  1 -
 .../ZendAfi/View/Helper/WebThumbnailTest.php  |  8 +--
 18 files changed, 62 insertions(+), 86 deletions(-)

diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php
index ea0d5371ac8..d4eb489e6ec 100644
--- a/application/modules/opac/controllers/AuthController.php
+++ b/application/modules/opac/controllers/AuthController.php
@@ -191,7 +191,7 @@ class AuthController extends Zend_Controller_Action
 	function registerAction()	{
 		if (Class_AdminVar::get('INTERDIRE_ENREG_UTIL'))
 			$this->_redirect('/');
-		xdebug_break();
+
 		if ($this->_request->isPost())
 		{
 			// recup _post
diff --git a/tests/application/modules/admin/controllers/AdminControllerTest.php b/tests/application/modules/admin/controllers/AdminControllerTest.php
index 0c4d0cfd26e..d9272a7487b 100644
--- a/tests/application/modules/admin/controllers/AdminControllerTest.php
+++ b/tests/application/modules/admin/controllers/AdminControllerTest.php
@@ -41,7 +41,7 @@ class AdminControllerSitoOKTest extends Admin_AbstractControllerTestCase {
 	}
 	
 	public function testMenuNewsletterLink() {
-		$this->assertXPathContentContains("//a[@href='/afi-opac3/admin/newsletter']", 
+		$this->assertXPathContentContains("//a[@href='" . BASE_URL . "/admin/newsletter']", 
 																			"Lettres d'information");
 	}
 
diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php
index 780c14a8701..786135a6466 100644
--- a/tests/application/modules/admin/controllers/AlbumControllerTest.php
+++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php
@@ -1177,7 +1177,7 @@ class Admin_AlbumControllerAlbumHarlockEditRessourceOneActionTest extends Admin_
 
 	/** @test */
 	function imageOneDotPngShouldBeDisplayed() {
-		$this->assertXPath('//img[@src="/afi-opac3/userfiles/album/999/thumbs/media/1.png"]',
+		$this->assertXPath('//img[@src="' . BASE_URL . '/userfiles/album/999/thumbs/media/1.png"]',
 											 $this->_response->getBody());
 	}
 
@@ -1190,7 +1190,7 @@ class Admin_AlbumControllerAlbumHarlockEditRessourceOneActionTest extends Admin_
 
 	/** @test */
 	function inputLinkToShouldContainsViewArticleTwo() {
-		$this->assertXPath('//input[@name="link_to"][@value="/afi-opac3/cms/viewarticle/id/2"]');
+		$this->assertXPath('//input[@name="link_to"][contains(@value, "cms/viewarticle/id/2")]');
 	}
 
 
diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php
index 8ac5ff63dbf..72c301fa7a6 100644
--- a/tests/application/modules/admin/controllers/CmsControllerTest.php
+++ b/tests/application/modules/admin/controllers/CmsControllerTest.php
@@ -404,7 +404,7 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerTestCas
 									'events_debut' => '02/03/2011',
 									'events_fin' => '05/03/2011',
 									'contenu' => 'Ici: <img src="../../images/bonlieu.jpg" />',
-									'description' => 'Affiche: <img src="http://localhost/afi-opac3/images/concert.jpg" />');
+									'description' => 'Affiche: <img src="http://localhost' . BASE_URL . '/images/concert.jpg" />');
 
 		$this
 			->getRequest()
@@ -469,14 +469,14 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerTestCas
 
 	/** @test */
 	function contenuShouldHaveFixedImageURL() {
-		$this->assertEquals(sprintf('Ici: <img src="/afi-opac3/images/bonlieu.jpg" />'),
+		$this->assertEquals('Ici: <img src="' . BASE_URL . '/images/bonlieu.jpg" />',
 												$this->concert->getContenu());
 	}
 
 
 	/** @test */
 	function descriptionShouldHaveFixedImageURL() {
-		$this->assertEquals(sprintf('Affiche: <img src="/afi-opac3/images/concert.jpg" />'),
+		$this->assertEquals('Affiche: <img src="' . BASE_URL . '/images/concert.jpg" />',
 												$this->concert->getDescription());
 	}
 
diff --git a/tests/application/modules/admin/controllers/FormationControllerTest.php b/tests/application/modules/admin/controllers/FormationControllerTest.php
index 67f072cacb1..8c9e3a9a96b 100644
--- a/tests/application/modules/admin/controllers/FormationControllerTest.php
+++ b/tests/application/modules/admin/controllers/FormationControllerTest.php
@@ -1193,7 +1193,6 @@ class Admin_FormationControllerInscriptionsSessionPythonInscritAmadouAndAmandine
 
 	/** @test */
 	public function amandineShouldHasRightSuivreFormation() {
-		xdebug_break();
 		$this->assertTrue($this->_amandine->hasRightSuivreFormation());
 	}
 
diff --git a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php
index c39d2e8a09f..167a9a18089 100644
--- a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php
+++ b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php
@@ -466,7 +466,7 @@ class RssControllerViewAvisUserTest extends AvisControllersFixturesTestCase {
 	/** @test */
 	function linkShouldBeLocalhostAfiOpac3BlogRssUser123456() {
 		$this->assertXPathContentContains('//channel/link', 
-																			'http://localhost/afi-opac3/blog/viewauteur/id/123456', 
+																			'http://localhost' . BASE_URL . '/blog/viewauteur/id/123456', 
 																			$this->_response->getBody());
 	}
 
@@ -486,7 +486,7 @@ class RssControllerViewAvisUserTest extends AvisControllersFixturesTestCase {
 	/** @test */
 	function firstItemLinkShouldBeBlogViewAvisId13() {
 		$this->assertXPathContentContains('//channel/item/link', 
-																			"http://localhost/afi-opac3/opac/blog/viewavis/id/13");
+																			"http://localhost" . BASE_URL . "/opac/blog/viewavis/id/13");
 	}
 
 
@@ -499,7 +499,7 @@ class RssControllerViewAvisUserTest extends AvisControllersFixturesTestCase {
 	/** @test */
 	function firstItemNoteCritiqueShouldBeImgStars4Gif() {
 		$this->assertTrue(false !== strpos($this->_response->getBody(),
-																			 "src='http://localhost/afi-opac3/public/admin/images/stars/stars-4.gif'"));
+																			 "src='http://localhost" . BASE_URL . "/public/admin/images/stars/stars-4.gif'"));
 	}
 }
 
diff --git a/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php b/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php
index 834fb98e6ed..e3a15fa32ac 100644
--- a/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php
+++ b/tests/application/modules/opac/controllers/BibControllerIndexActionTest.php
@@ -94,7 +94,7 @@ class BibControllerIndexActionTest extends AbstractControllerTestCase {
 	/** @test */
 	function setTooltipJSShouldBeGenerated() {
 		$this->assertTrue(false !== strpos($this->_response->getBody(),
-																			 "setTooltip($('.tooltip_bib3'), '<a href=\"/afi-opac3/bib/bibview/id/3\"><b>BibZone3</b></a><br />'"),
+																			 "setTooltip($('.tooltip_bib3'), '<a href=\"" . BASE_URL . "/bib/bibview/id/3\"><b>BibZone3</b></a><br />'"),
 											$this->_response->getBody());
 	}
 
diff --git a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
index d09221a73b2..7671166967e 100644
--- a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
+++ b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
@@ -155,7 +155,7 @@ class BibNumeriqueControllerAlbumPremierVolumeTestToJSON extends AbstractBibNume
 
 	/** @test */
 	function firstRessourceNavigatorThumbnailShouldPassResizeParamsOfRightPageCropTopFiveWidth50() {
-		$this->assertContains('/afi-opac3/userfiles/album/999/thumbs/media/1.jpg',
+		$this->assertContains(BASE_URL . '/userfiles/album/999/thumbs/media/1.jpg',
 													$this->json->album->ressources[0]->navigator_thumbnail);
 	}
 
@@ -195,7 +195,7 @@ class BibNumeriqueControllerAlbumPremierVolumeTestToJSON extends AbstractBibNume
 
 	/** @test */
 	function secondRessourceNavigatorThumbnailShouldPassResizeParamsOfLeftPageCropRightTenWidth50() {
-		$this->assertContains('/afi-opac3/public/opac/images/earth-logo.jpg',
+		$this->assertContains(BASE_URL . '/public/opac/images/earth-logo.jpg',
 													$this->json->album->ressources[1]->navigator_thumbnail);
 	}
 }
@@ -333,7 +333,7 @@ class BibNumeriqueControllerBookletTest extends AbstractBibNumeriqueControllerAl
 	/** @test */
 	function pageShouldContainsCodeToOpenBooklet() {
 		$this->assertXPathContentContains('//script', 
-																			"smalltalk.BibNumAlbum._load_in_scriptsRoot_('/bib-numerique/album/id/999.json', '#booklet_999', '/afi-opac3/amber/afi/souvigny/')",
+																			"smalltalk.BibNumAlbum._load_in_scriptsRoot_('/bib-numerique/album/id/999.json', '#booklet_999', '" . BASE_URL . "/amber/afi/souvigny/')",
 																			$this->_response->getBody());
 	}
 }
diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
index 4e083a6745d..7320358b943 100644
--- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
+++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
@@ -75,7 +75,7 @@ class ProfilOptionsControllerTwitterLinkWithProfilAdulteTest extends ProfilOptio
 		$this->_mock_web_client
 			->whenCalled('open_url')
 			->with(sprintf('http://is.gd/api.php?longurl=%s', 
-										 urlencode('http://localhost/afi-opac3/index/index/id_profil/2')))
+										 urlencode('http://localhost' . BASE_URL . '/index/index/id_profil/2')))
 			->answers('http://is.gd/PkdNgD')
 			->beStrict();
 	}
diff --git a/tests/library/Class/AlbumRessourceTest.php b/tests/library/Class/AlbumRessourceTest.php
index f32b954d14b..bc704a76d1d 100644
--- a/tests/library/Class/AlbumRessourceTest.php
+++ b/tests/library/Class/AlbumRessourceTest.php
@@ -284,7 +284,7 @@ class AlbumRessourceTypeXMLTest extends ModelTestCase {
 
 	/** @test */
 	function thumbnailURLShouldReturnEarthLogo() {
-		$this->assertEquals('/afi-opac3/public/opac/images/earth-logo.jpg',
+		$this->assertEquals(BASE_URL . '/public/opac/images/earth-logo.jpg',
 												$this->resource->getThumbnailURL());
 	}
 }
@@ -319,7 +319,7 @@ class AlbumRessourceTypeSWFTest extends ModelTestCase {
 
 	/** @test */
 	function thumbnailURLShouldReturnFlashLogo() {
-		$this->assertEquals('/afi-opac3/public/opac/images/flash-logo.jpg',
+		$this->assertEquals(BASE_URL . '/public/opac/images/flash-logo.jpg',
 												$this->resource->getThumbnailURL());
 	}
 }
@@ -354,7 +354,7 @@ class AlbumRessourceTypeMOVTest extends ModelTestCase {
 
 	/** @test */
 	function thumbnailURLShouldReturnQuicktimeLogo() {
-		$this->assertEquals('/afi-opac3/public/opac/images/quicktime-logo.png',
+		$this->assertEquals(BASE_URL . '/public/opac/images/quicktime-logo.png',
 												$this->resource->getThumbnailURL());
 	}
 }
@@ -368,12 +368,7 @@ abstract class AlbumRessourceThumbnailTestCase extends ModelTestCase {
 
 	public function setUp() {
 		parent::setUp();
-
-		$this->_expected_filepath = USERFILESPATH.'/temp/'.$this->_expected_filename;
-		if (file_exists($this->_expected_filepath)) {
-			unlink($this->_expected_filepath);
-		}
-
+		
 		$this->_ressource = Class_AlbumRessource::getLoader()
 			->newInstanceWithId(1)
 			->setFichier('1.jpg')
@@ -383,6 +378,11 @@ abstract class AlbumRessourceThumbnailTestCase extends ModelTestCase {
 								 ->newInstanceWithId(93)
 								 ->setRessources(array($this->_ressource)));
 
+		$this->_expected_filename = md5($this->_ressource->getOriginalPath().serialize($this->_size_params)).'.jpg';
+		$this->_expected_filepath = USERFILESPATH . '/temp/'.$this->_expected_filename;
+		if (file_exists($this->_expected_filepath))
+			unlink($this->_expected_filepath);
+
 		$this->_thumb_path = $this->_ressource->getThumbnailFilePath($this->_size_params);
 	}
 
@@ -404,7 +404,6 @@ abstract class AlbumRessourceThumbnailTestCase extends ModelTestCase {
 
 
 class AlbumRessourceThumbnailResizeHundredPerHundredTwentyTest extends AlbumRessourceThumbnailTestCase {
-	protected $_expected_filename = 'a05849302da9a6dbfc0176149184d5f6.jpg';
 	protected $_size_params = array('width' => 100,
 																	'height' => 120,
 																	'crop_left' => 2,
@@ -454,7 +453,6 @@ class AlbumRessourceThumbnailResizeHundredPerHundredTwentyTest extends AlbumRess
 
 
 class AlbumRessourceThumbnailResizeNoParamTest extends AlbumRessourceThumbnailTestCase {
-	protected $_expected_filename = '5c93c2fb3ba41d726d671bd360647b44.jpg';
 	protected $_size_params = array();
 
 	/** @test */
@@ -480,7 +478,6 @@ class AlbumRessourceThumbnailResizeNoParamTest extends AlbumRessourceThumbnailTe
 
 
 class AlbumRessourceThumbnailResizeNoWidthButCropParamTest extends AlbumRessourceThumbnailTestCase {
-	protected $_expected_filename = 'ee3c084f7413076c92893d9d2dc34d15.jpg';
 	protected $_size_params = array('width' => 100,
 																	'crop_left' => 2);
 
diff --git a/tests/library/Class/AlbumTest.php b/tests/library/Class/AlbumTest.php
index 9c75bf78c17..d628cf1125c 100644
--- a/tests/library/Class/AlbumTest.php
+++ b/tests/library/Class/AlbumTest.php
@@ -98,12 +98,12 @@ class AlbumHarlockBasicTest extends AlbumHarlockTestCase {
 
 	/** @test */
 	function basePathShouldBeUserfiles_Slash_Album_999() {
-		$this->assertEquals('../afi-opac3/userfiles/album/999/', $this->_album->getBasePath());
+		$this->assertEquals('..' . BASE_URL . '/userfiles/album/999/', $this->_album->getBasePath());
 	}
 
 	/** @test */
 	function thumbnailsPathShouldBeUserfiles_Slash_thumbs_999() {
-		$this->assertEquals('../afi-opac3/userfiles/album/999/thumbs/', $this->_album->getThumbnailsPath());
+		$this->assertEquals('..' . BASE_URL . '/userfiles/album/999/thumbs/', $this->_album->getThumbnailsPath());
 	}
 
 	/** @test */
diff --git a/tests/library/Class/I18nTest.php b/tests/library/Class/I18nTest.php
index cbf9aecf261..ee561c0c040 100644
--- a/tests/library/Class/I18nTest.php
+++ b/tests/library/Class/I18nTest.php
@@ -48,9 +48,7 @@ class ProfileI18nTest extends PHPUnit_Framework_TestCase {
 	/** @test */
 	public function generateShouldCreateMasterFile() {
 		$this->_i18n->generate();
-
 		$this->assertFileExists($this->_getFilePathFor(Class_I18n::MASTER_NAME));
-
 	}
 
 	/** @test */
diff --git a/tests/library/Class/NewsletterMailingTest.php b/tests/library/Class/NewsletterMailingTest.php
index a55cf5714c5..04756fa9980 100644
--- a/tests/library/Class/NewsletterMailingTest.php
+++ b/tests/library/Class/NewsletterMailingTest.php
@@ -288,7 +288,7 @@ class NewsletterConcertsTestPanier extends ModelTestCase {
 	}
 
 	public function testBodyTextContainsURLMillenium() {
-		$this->assertBodyTextContains("http://localhost/afi-opac3/recherche/viewnotice/id/345");
+		$this->assertBodyTextContains("http://localhost" . BASE_URL . "/recherche/viewnotice/id/345");
 	}
 
 	public function testBodyTextContainsPotter() {
@@ -300,7 +300,7 @@ class NewsletterConcertsTestPanier extends ModelTestCase {
 	}
 
 	public function testBodyTextContainsURLPotter() {
-		$this->assertBodyTextContains("http://localhost/afi-opac3/recherche/viewnotice/id/987");
+		$this->assertBodyTextContains("http://localhost" . BASE_URL . "/recherche/viewnotice/id/987");
 	}
 
 	public function testVignetteMilleniumInHTML() {
@@ -308,7 +308,7 @@ class NewsletterConcertsTestPanier extends ModelTestCase {
 	}
 
 	public function testLinkMillenium() {
-		$this->assertBodyHTMLContains('<a href="http://localhost/afi-opac3/recherche/viewnotice?id=345">');
+		$this->assertBodyHTMLContains('<a href="http://localhost' . BASE_URL . '/recherche/viewnotice?id=345">');
 	}
 
 	public function testBodyHTMLContainsPotter() {
@@ -324,7 +324,7 @@ class NewsletterConcertsTestPanier extends ModelTestCase {
 	}
 
 	public function testLinkPotter() {
-		$this->assertBodyHTMLContains('<a href="http://localhost/afi-opac3/recherche/viewnotice?id=987">');
+		$this->assertBodyHTMLContains('<a href="http://localhost' . BASE_URL . '/recherche/viewnotice?id=987">');
 	}
 }
 
diff --git a/tests/library/Class/ScriptLoaderTest.php b/tests/library/Class/ScriptLoaderTest.php
index 14cf11a4f68..642160cefe9 100644
--- a/tests/library/Class/ScriptLoaderTest.php
+++ b/tests/library/Class/ScriptLoaderTest.php
@@ -102,14 +102,14 @@ class ScriptLoaderAmberDevelopmentModeTest extends AbstractScriptLoaderTestCase
 
 	/** @test */
 	function commitPathJsShouldBeAmberCommitJs() {
-		$this->assertContains('"/afi-opac3/opac/amber/commitJs"',
+		$this->assertContains('"' . BASE_URL . '/opac/amber/commitJs"',
 													Class_ScriptLoader::getInstance()->html());
 	}
 
 
 	/** @test */
 	function commitPathStShouldBeAmberCommitSt() {
-		$this->assertContains('"/afi-opac3/opac/amber/commitSt"',
+		$this->assertContains('"' . BASE_URL . '/opac/amber/commitSt"',
 													Class_ScriptLoader::getInstance()->html());
 	}
 }
diff --git a/tests/library/Class/WebService/ReseauxSociauxTest.php b/tests/library/Class/WebService/ReseauxSociauxTest.php
index f9e556af059..cb1e8439afd 100644
--- a/tests/library/Class/WebService/ReseauxSociauxTest.php
+++ b/tests/library/Class/WebService/ReseauxSociauxTest.php
@@ -34,13 +34,8 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 
 	/** @test */
 	public function shortenUrlShouldReturnIsGdUrl() {
-		$this->_mock_web_client
-			->whenCalled('open_url')
-			->with(sprintf('http://is.gd/api.php?longurl=%s', 
-										 urlencode('http://www.institut-francais.com')))
-			->answers('http://is.gd/PkdNgD')
-			->beStrict();
-
+		$this->_expectClientOpenUrlWithLongUrlAndAnswer('http://www.institut-francais.com',
+																										'http://is.gd/PkdNgD');
 
 		$this->assertEquals('http://is.gd/PkdNgD',
 												$this->_rs->shortenUrl('http://www.institut-francais.com'));
@@ -50,13 +45,7 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 	/** @test */
 	public function getTwitterUrlViewNoticeShouldReturnShortenUrlWithServerHost() {
 		$_SERVER["HTTP_HOST"] = 'localhost';
-
-		$this->_mock_web_client
-			->whenCalled('open_url')
-			->with('http://is.gd/api.php?longurl=http%3A%2F%2Flocalhost%2Fafi-opac3%2Frecherche%2Fviewnotice%2Fid%2F2')
-			->answers('http://is.gd/PkdNg2')
-			->beStrict();
-
+		$this->_expectClientOpenUrlForShortenViewNotice2();
 		$this->assertEquals(sprintf('http://twitter.com/home?status=%s', urlencode('http://is.gd/PkdNg2')),
 												$this->_rs->getUrl("twitter", '/recherche/viewnotice/id/2'));
 	}
@@ -65,13 +54,7 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 	/** @test */
 	public function getTwitterUrlViewNoticeWithMessageShouldReturnShortenUrlWithServerHost() {
 		$_SERVER["HTTP_HOST"] = 'localhost';
-
-		$this->_mock_web_client
-			->whenCalled('open_url')
-			->with('http://is.gd/api.php?longurl=http%3A%2F%2Flocalhost%2Fafi-opac3%2Frecherche%2Fviewnotice%2Fid%2F2')
-			->answers('http://is.gd/PkdNg2')
-			->beStrict();
-
+		$this->_expectClientOpenUrlForShortenViewNotice2();
 		$this->assertEquals(sprintf('http://twitter.com/home?status=%s', urlencode('venez voir ! http://is.gd/PkdNg2')),
 												$this->_rs->getUrl("twitter", '/recherche/viewnotice/id/2', 'venez voir !'));
 	}
@@ -80,13 +63,7 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 	/** @test */
 	public function getFacebookUrlViewNoticeShouldReturnShortenUrlWithServerHost() {
 		$_SERVER["HTTP_HOST"] = 'localhost';
-
-		$this->_mock_web_client
-			->whenCalled('open_url')
-			->with('http://is.gd/api.php?longurl=http%3A%2F%2Flocalhost%2Fafi-opac3%2Frecherche%2Fviewnotice%2Fid%2F2')
-			->answers('http://is.gd/PkdNg2')
-			->beStrict();
-
+		$this->_expectClientOpenUrlForShortenViewNotice2();
 		$this->assertEquals(sprintf('http://www.facebook.com/share.php?u=%s', urlencode('http://is.gd/PkdNg2')),
 												$this->_rs->getUrl("facebook", '/recherche/viewnotice/id/2'));
 	}
@@ -94,13 +71,8 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 
 	/** @test */
 	public function shortenUrlWithErrorShouldReturnOriginalUrl() {
-			$this->_mock_web_client
-			->whenCalled('open_url')
-			->with(sprintf('http://is.gd/api.php?longurl=%s', 
-										 urlencode('http://www.institut-francais.com')))
-			->answers('Error')
-			->beStrict();
-
+		$this->_expectClientOpenUrlWithLongUrlAndAnswer('http://www.institut-francais.com', 
+																										'Error');
 
 		$this->assertEquals('http://www.institut-francais.com',
 												$this->_rs->shortenUrl('http://www.institut-francais.com'));	
@@ -109,17 +81,28 @@ class ReseauxSociauxTest extends PHPUnit_Framework_TestCase {
 
 	/** @test */
 	public function shortenUrlWithNullShouldReturnOriginalUrl() {
-			$this->_mock_web_client
-			->whenCalled('open_url')
-			->with(sprintf('http://is.gd/api.php?longurl=%s', 
-										 urlencode('http://www.institut-francais.com')))
-			->answers(null)
-			->beStrict();
-
+		$this->_expectClientOpenUrlWithLongUrlAndAnswer('http://www.institut-francais.com', 
+																										null);
 
 		$this->assertEquals('http://www.institut-francais.com',
 												$this->_rs->shortenUrl('http://www.institut-francais.com'));	
 	}
+
+
+	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();
+
+	}
+
+
+	protected function _expectClientOpenUrlForShortenViewNotice2() {
+		$this->_expectClientOpenUrlWithLongUrlAndAnswer('http://localhost'. BASE_URL .'/recherche/viewnotice/id/2',
+																										'http://is.gd/PkdNg2');
+	}
 }
 
 
diff --git a/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php
index 2e90a6fc1ce..680a749a413 100644
--- a/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php
+++ b/tests/library/ZendAfi/View/Helper/Accueil/BibNumeriqueTest.php
@@ -542,7 +542,7 @@ class BibNumeriqueAlbumHarlockAsBookletTest extends AbstractBibNumeriqueViewHelp
 
 	/** @test */
 	function pageShouldContainsCodeToOpenBooklet() {
-		$this->assertContains("smalltalk.BibNumAlbum._load_in_scriptsRoot_('/afi-opac3/bib-numerique/album/id/99.json', '#booklet_12', '/afi-opac3/amber/afi/souvigny/')",
+		$this->assertContains("smalltalk.BibNumAlbum._load_in_scriptsRoot_('" . BASE_URL . "/bib-numerique/album/id/99.json', '#booklet_12', '" . BASE_URL . "/amber/afi/souvigny/')",
 													Class_ScriptLoader::getInstance()->html());
 	}
 
diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php
index 4151ac2071e..6676b6208db 100644
--- a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php
+++ b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php
@@ -262,7 +262,6 @@ class CalendarWithCategoryLimitAndBibPreferencesTest extends CalendarViewHelperT
 			->answers(array($this->nanook2, $this->opac4, $this->amber))
 			->getWrapper()
 			->beStrict();
-		xdebug_break();
 		$this->html = $helper->getBoite();
 	}
 
diff --git a/tests/library/ZendAfi/View/Helper/WebThumbnailTest.php b/tests/library/ZendAfi/View/Helper/WebThumbnailTest.php
index 323f6576877..33f2e5da3b9 100644
--- a/tests/library/ZendAfi/View/Helper/WebThumbnailTest.php
+++ b/tests/library/ZendAfi/View/Helper/WebThumbnailTest.php
@@ -44,7 +44,7 @@ class ViewHelperWebThumbnailTestReturnedUrl extends ViewHelperTestCase {
 			->will($this->returnValue(true));
 
 		$url = $this->helper->webThumbnail('http://www.google.com');
-		$this->assertEquals('/afi-opac3/userfiles/web_thumbnails/www_google_com.jpg',
+		$this->assertEquals(BASE_URL . '/userfiles/web_thumbnails/www_google_com.jpg',
 												$url);
 	}
 
@@ -57,7 +57,7 @@ class ViewHelperWebThumbnailTestReturnedUrl extends ViewHelperTestCase {
 			->method('fetchUrlToFile');
 
 		$url = $this->helper->webThumbnail('http://www.google.com');
-		$this->assertEquals('/afi-opac3/userfiles/web_thumbnails/www_google_com.jpg',
+		$this->assertEquals(BASE_URL . '/userfiles/web_thumbnails/www_google_com.jpg',
 												$url);
 	}
 
@@ -70,7 +70,7 @@ class ViewHelperWebThumbnailTestReturnedUrl extends ViewHelperTestCase {
 			->will($this->returnValue(true));
 
 		$url = $this->helper->webThumbnail('http://www.google.fr/search?sourceid=chrome&ie=UTF-8&q=harry+potter');
-		$this->assertEquals('/afi-opac3/userfiles/web_thumbnails/www_google_fr_search_sourceid_chrome_ie_UTF-8_q_harry_potter.jpg',
+		$this->assertEquals(BASE_URL . '/userfiles/web_thumbnails/www_google_fr_search_sourceid_chrome_ie_UTF-8_q_harry_potter.jpg',
 												$url);
 	}
 
@@ -83,7 +83,7 @@ class ViewHelperWebThumbnailTestReturnedUrl extends ViewHelperTestCase {
 			->will($this->returnValue(true));
 
 		$url = $this->helper->webThumbnail('https://astrolabe.fr/my%20search');
-		$this->assertEquals('/afi-opac3/userfiles/web_thumbnails/astrolabe_fr_my_search.jpg',
+		$this->assertEquals(BASE_URL . '/userfiles/web_thumbnails/astrolabe_fr_my_search.jpg',
 												$url);
 	}
 
-- 
GitLab