Skip to content
Snippets Groups Projects
Commit c7cec38d authored by efalcy's avatar efalcy
Browse files

rel #11218 : Les notices liees ne s'affichent pas -> correction Base Url

parent c3bbe941
No related merge requests found
......@@ -148,7 +148,7 @@ class Class_FRBR_Link extends Storm_Model_Abstract {
return $this->$attribute;
try {
$key = $this->_extractKeyFromUrl($this->{'get'. ucfirst($type)}());
$key = $this->extractKeyFromUrl($this->{'get'. ucfirst($type)}());
} catch(Zend_Uri_Exception $e) {
return;
}
......@@ -177,16 +177,16 @@ class Class_FRBR_Link extends Storm_Model_Abstract {
* @param $url string
* @return string
*/
protected function _extractKeyFromUrl($url) {
public function extractKeyFromUrl($url) {
if ('' == $url)
return '';
xdebug_break();
// simule un routage standard
$request = new Zend_Controller_Request_Http($url);
$request->setBaseUrl(BASE_URL);
$router = new Zend_Controller_Router_Rewrite();
// $request->setBaseUrl(BASE_URL);
$router = new ZendAfi_Controller_Router_RewriteWithoutBaseUrl();
$router->route($request);
return $request->getParam('clef', '');
}
}
......
......@@ -46,6 +46,18 @@ class FRBR_LinkWrongAttributesTest extends Storm_Test_ModelTestCase {
public function getTargetNoticeShouldReturnNullWithInvalidType() {
$this->assertEquals(null, $this->link->getTargetNotice());
}
/** @test */
public function extractKeyFromUrlWithoutBaseUrlShouldReturnKey(){
$this->assertEquals('FEMELLES--EOLE----101', $this->link->extractKeyFromUrl('http://localhost/recherche/viewnotice/expressionRecherche/eole+femelles/tri/*/clef/FEMELLES--EOLE----101/id/3571924'));
}
/** @test */
public function extractKeyFromUrlWithBaseUrlShouldReturnKey(){
$this->assertEquals('FEMELLES--EOLE----101', $this->link->extractKeyFromUrl('http://localhost/'.BASE_URL.'/astrolabe-melun.fr/recherche/viewnotice/expressionRecherche/eole+femelles/tri/*/clef/FEMELLES--EOLE----101/id/3571924'));
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment