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

hotline#13340 : display banners cycles on all pages , broken tests (to be continued..)

parent 83164a89
5 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!114Master,!109Hotline 6.42,!106Hotline 6.42,!101Hotline#13340 Affichage Bannieres
......@@ -602,11 +602,12 @@ class Class_Profil extends Storm_Model_Abstract {
* @return array
*/
public function getAllHeaderImg() {
if (!$this->getHeaderImgCycle())
return [$this->getHeaderImg()];
if (isset($this->_all_header_img))
return $this->_all_header_img;
// if (isset($this->_all_header_img))
// return $this->_all_header_img;
$banners_path = USERFILESPATH . '/bannieres';
$file_system = self::getFileSystem();
......@@ -621,7 +622,9 @@ class Class_Profil extends Storm_Model_Abstract {
$images = [];
while (false !== ($file = $file_system->readdir($handle))) {
if (false !== strpos(strtolower($file), '.jpg')) {
$images[] = $banners_path . '/' . $file;
$images[]=USERFILESURL.'bannieres/'.$file;
// $images[] = $banners_path . '/' . $file;
}
}
......
......@@ -28,8 +28,21 @@ class ZendAfi_View_Helper_TagBanniereCycleTest extends ViewHelperTestCase {
public function setUp() {
parent::setUp();
defineConstant("PATH_SKIN","");
defineConstant("USERFILESPATH","onepath");
defineConstant("USERFILESURL","onepath");
$this->file_system = $this->mock()
->whenCalled('opendir')->answers(null)
->whenCalled('file_exists')->answers(true)
->whenCalled('readdir')->answers(false)
->whenCalled('mkdir')->answers(false)
->whenCalled('closedir')->answers(null);
Class_Profil::setFileSystem($this->file_system);
$this->profil = $this->fixture('Class_Profil',
['id' => 999, 'header_img_cycle' => true]);
$this->_helper = new ZendAfi_View_Helper_TagBanniere();
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
$this->_helper->view->profil = Class_Profil::getLoader()
......@@ -48,12 +61,12 @@ class ZendAfi_View_Helper_TagBanniereCycleTest extends ViewHelperTestCase {
/** @test */
function ban1ShouldBeVisible() {
$this->assertXPath($this->_html, "//img[@src='ban1.jpg']");
$this->assertXPath($this->_html, "//img[@src='ban1.jpg']",$this->_html);
}
/** @test */
function ban2ShouldBeVisible() {
$this->assertXPath($this->_html, "//img[@src='ban2.jpg']");
$this->assertXPath($this->_html, "//img[@src='ban2.jpg']",$this->_html);
}
}
......
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