Commit 08fbbb0c authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

hotline #75868 : fix failures

parent b20ebb23
Pipeline #4337 passed with stage
in 34 minutes and 4 seconds
......@@ -1003,6 +1003,9 @@ class Class_Profil extends Storm_Model_Abstract {
return $this->_cfg_site_array;
$params = $this->_getCfgAsArrayNamed('Site');
if (!is_array($params))
return [];
$valids = static::getCfgSiteKeys();
$this->_cfg_site_array = [];
foreach($params as $k => $v)
......
......@@ -73,12 +73,11 @@ class ProfilVideTest extends ModelTestCase {
class ProfilJeunesseAstrolabeTest extends ModelTestCase {
protected $_storm_default_to_volatile = true;
protected
$_storm_default_to_volatile = true;
public function setUp() {
$this->fixture('Class_AdminVar', ['clef' => 'NOM_DOMAINE',
'id' => 'NOM_DOMAINE',
'valeur' => 'http://bokeh.org']);
parent::setUp();
$cfg_accueil = ['modules' => ['1' => ['division' => '1',
'type_module' => 'RECH_SIMPLE',
......@@ -107,9 +106,8 @@ class ProfilJeunesseAstrolabeTest extends ModelTestCase {
/** @test */
public function profilUrlShouldReturnBokehDotOrg() {
$this->assertEquals('http://bokeh.org/index/index/id_profil/7',
Class_Profil::find(7)->getUrl());
public function profilUrlShouldContainsIndexIndexProfil7() {
$this->assertContains('/index/index/id_profil/7', Class_Profil::find(7)->getUrl());
}
......@@ -1023,7 +1021,11 @@ class ProfilAdulteChatenayMoveModuleLOGINToLastPosInDivOneTest extends ProfilAdu
class ProfilEvenementsTest extends ModelTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->profil = new Class_Profil();
$this->profil
......@@ -1088,6 +1090,7 @@ class ProfilEvenementsTest extends ModelTestCase {
$this->assertEquals('Se connecter', $this->boite_login['preferences']['titre']);
}
/** @test **/
public function boiteConnexionIdModuleShouldBeTwo() {
$this->assertEquals('2', $this->boite_login['preferences']['id_module']);
......@@ -1101,7 +1104,11 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
*/
private $_profil;
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setup();
$this->_profil = new Class_Profil();
$this->_profil
......@@ -1114,9 +1121,9 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
->setCfgNotice(ProfilPesseyValandryFixtures::createNoticeConfiguration())
->setCfgModules(ProfilPesseyValandryFixtures::createModulesConfiguration())
;
}
/** @test */
public function getCfgMenusAsArrayShouldCallTranslator() {
$mockTranslator = $this->_getMockTranslator();
......@@ -1126,25 +1133,24 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
;
$this->_profil->setTranslator($mockTranslator);
$menus = $this->_profil->getCfgMenusAsArray();
$this->_profil->getCfgMenusAsArray();
}
/** @test */
public function getCfgSiteAsArrayShouldCallTranslator() {
$config = ProfilPesseyValandryFixtures::createSiteConfiguration();
$mockTranslator = $this->_getMockTranslator();
$mockTranslator->expects($this->once())
->method('translate')
->with(ProfilPesseyValandryFixtures::createSiteConfiguration(), 'Site')
;
->method('translate')
->with($config, 'Site')
->will($this->returnValue($config));
$this->_profil->setTranslator($mockTranslator);
$menus = $this->_profil->getCfgSiteAsArray();
$this->_profil->getCfgSiteAsArray();
}
/** @test */
public function getCfgAccueilAsArrayShouldCallTranslator() {
$mockTranslator = $this->_getMockTranslator();
......@@ -1154,11 +1160,10 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
;
$this->_profil->setTranslator($mockTranslator);
$menus = $this->_profil->getCfgAccueilAsArray();
$this->_profil->getCfgAccueilAsArray();
}
/** @test */
public function getCfgNoticeAsArrayShouldCallTranslator() {
$mockTranslator = $this->_getMockTranslator();
......@@ -1168,10 +1173,10 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
;
$this->_profil->setTranslator($mockTranslator);
$menus = $this->_profil->getCfgNoticeAsArray();
$this->_profil->getCfgNoticeAsArray();
}
/** @test */
public function getCfgModulesAsArrayShouldCallTranslator() {
$mockTranslator = $this->_getMockTranslator();
......@@ -1181,19 +1186,18 @@ class ProfilPesseyValandryTranslatedTest extends ModelTestCase {
;
$this->_profil->setTranslator($mockTranslator);
$menus = $this->_profil->getCfgModulesAsArray();
$this->_profil->getCfgModulesAsArray();
}
/**
* @return PHPUnit_Framework_MockObject_MockObject
*/
private function _getMockTranslator() {
return $this->getMockBuilder('Class_Profil_I18nTranslator')
->disableOriginalConstructor()
->getMock()
;
->disableOriginalConstructor()
->getMock()
;
}
}
......@@ -1241,12 +1245,14 @@ class ProfilPortailTest extends ModelTestCase {
/** @var Storm_Test_ObjectWrapper */
protected $_wrapper;
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Profil')
->whenCalled('delete')->answers(true)->getWrapper();
$this->_wrapper = $this->onLoaderOfModel('Class_Profil')
->whenCalled('delete')->answers(true)->getWrapper();
$this->_profil = Class_Profil::getLoader()->newInstanceWithId(1);
}
......@@ -1275,25 +1281,28 @@ class ProfilPortailTest extends ModelTestCase {
class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase {
protected $_clone;
class ProfilWithPagesCopyTest extends ModelTestCase {
protected
$_clone,
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$profil = $this->fixture('Class_Profil',
['id' => 1,
'nb_divisions' => 2,
'rewrite_url' => 'adulte'])
->setSubProfils([ $this->fixture('Class_Profil', ['id' => 2]),
$this->fixture('Class_Profil', ['id' => 3]),
$this->fixture('Class_Profil', ['id' => 4,
'rewrite_url' => 'CD',
'libelle' => 'CD']),
$this->fixture('Class_Profil', ['id' => 5])
]);
->setSubProfils([$this->fixture('Class_Profil', ['id' => 2]),
$this->fixture('Class_Profil', ['id' => 3]),
$this->fixture('Class_Profil', ['id' => 4,
'rewrite_url' => 'CD',
'libelle' => 'CD']),
$this->fixture('Class_Profil', ['id' => 5])
]);
$profil->assertSave();
Class_Profil::clearCache();
......@@ -1308,6 +1317,7 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase {
$this->assertEquals(4, $this->_clone->numberOfSubProfils());
}
/** @test */
public function cloneRewriteUrlShouldBeEmpty() {
$this->assertEmpty($this->_clone->getRewriteUrl());
......@@ -1327,7 +1337,6 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase {
/** @test */
public function loadedClonedPageCDShouldHaveTwoDivisions() {
$page_cd = $this->_clone->getSubProfils()['CD'];
$this->assertEquals(2, $page_cd->getNbDivisions());
......@@ -1347,7 +1356,6 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase {
/** @test */
public function cloneThirdPageLibelleShouldBeIndexedAtCD() {
$this->assertEquals('CD', $this->_clone->getSubProfils()['CD']->getLibelle());
}
......@@ -1382,17 +1390,21 @@ class ProfilWithPagesCopyTest extends Storm_Test_ModelTestCase {
$this->assertEquals(10, array_values($this->_clone->getSubProfils())[3]->getId());
}
/** @test */
public function cloneLastPageParentIdShouldBe6() {
$this->assertEquals(6, array_values($this->_clone->getSubProfils())[3]->getParentId());
}
}
class ProfilHeaderImgAccessTest extends Storm_Test_ModelTestCase {
class ProfilHeaderImgAccessTest extends ModelTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->file_system = $this->mock()
->whenCalled('opendir')->answers(null)
->whenCalled('readdir')->answers(false)
......@@ -1438,12 +1450,14 @@ class ProfilHeaderImgAccessTest extends Storm_Test_ModelTestCase {
abstract class ProfilUpdateConfigAccueilOnModuleInBannerTestCase
extends Storm_Test_ModelTestCase {
protected $_profil;
abstract class ProfilUpdateConfigAccueilOnModuleInBannerTestCase extends ModelTestCase {
protected
$_profil,
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_profil = $this->fixture('Class_Profil', ['id' => 1])
->setBoiteLoginInBanniere(true);
......@@ -1498,11 +1512,16 @@ extends ProfilUpdateConfigAccueilOnModuleInBannerTestCase {
class ProfilGetModuleAccueilConfigTest extends Storm_Test_ModelTestCase {
protected $_profil, $_parent, $_module_config;
class ProfilGetModuleAccueilConfigTest extends ModelTestCase {
protected
$_profil,
$_parent,
$_module_config,
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_parent = $this->fixture('Class_Profil', ['id' => 1])
->setBoiteLoginInBanniere(true);
......@@ -1527,9 +1546,12 @@ class ProfilGetModuleAccueilConfigTest extends Storm_Test_ModelTestCase {
class ProfilPreferenceAuthRegisterTest extends Storm_Test_ModelTestCase {
class ProfilPreferenceAuthRegisterTest extends ModelTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->portal = $this->fixture('Class_Profil',
['id' => 1,
'libelle' => 'portail']);
......@@ -1568,7 +1590,9 @@ class ProfilPreferenceAuthRegisterTest extends Storm_Test_ModelTestCase {
class ProfilIsPortalTest extends Storm_Test_ModelTestCase {
class ProfilIsPortalTest extends ModelTestCase {
protected $_storm_default_to_volatile = true;
/** @test */
public function profilWithIdOneIntShouldBePortal() {
$this->assertTrue($this->fixture('Class_Profil', ['id' => 1])->isPortail());
......
Markdown is supported
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