From 832915d561217fc6a5df23a69548f5e7c17c2fef Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Mon, 27 Jun 2022 15:53:49 +0200 Subject: [PATCH] fix 156612 : when discovering template folder name on local install, dirname is returning full path. Adding a call to basename on dirname to return only the dirname. --- library/Class/Template.php | 2 +- tests/scenarios/Templates/MyBibAppTemplateTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Class/Template.php b/library/Class/Template.php index 4c0deba2e59..34762c2c971 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -732,7 +732,7 @@ class Class_Template { public function getFolder() : string { - return dirname((new ReflectionClass($this))->getFileName()); + return basename(dirname((new ReflectionClass($this))->getFileName())); } diff --git a/tests/scenarios/Templates/MyBibAppTemplateTest.php b/tests/scenarios/Templates/MyBibAppTemplateTest.php index eb5b870e48c..52645279b54 100644 --- a/tests/scenarios/Templates/MyBibAppTemplateTest.php +++ b/tests/scenarios/Templates/MyBibAppTemplateTest.php @@ -149,7 +149,6 @@ class MyBibAppTemplateOpacIndexWithUserAgentTest extends MyBibAppTemplateTestCas Class_AdminVar::set('MYBIBAPP_TEMPLATE', 1); Class_Profil::find(2)->beCurrentProfil(); - $this->dispatch('/opac/index/index'); } @@ -168,7 +167,10 @@ class MyBibAppTemplateOpacIndexWithUserAgentTest extends MyBibAppTemplateTestCas /** @test */ public function pageShouldLoadMyBibAppCss() { - $this->assertXPath('//head/link[contains(@href, "/library/templates/MyBibApp/Assets/css/mybibapp.css")]'); + $this->assertXPath(sprintf('//head/link[@href="%s/library/templates/MyBibApp/Assets/css/mybibapp.css?v=%s"]', + BASE_URL, + Class_ScriptLoader::getInstance()->getCacheHash()), + $this->_response->getBody()); } -- GitLab