From 4e3c111537bf9ba595f5147c255122ed2aa826d4 Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.pergame.net> Date: Fri, 29 May 2015 18:05:13 +0200 Subject: [PATCH] fix compatibility with formation modelFusion --- library/Class/ModeleFusion.php | 18 +++++++++--------- .../controllers/FormationControllerTest.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/library/Class/ModeleFusion.php b/library/Class/ModeleFusion.php index 88a0db416db..a7e2352587c 100644 --- a/library/Class/ModeleFusion.php +++ b/library/Class/ModeleFusion.php @@ -63,11 +63,7 @@ class Class_ModeleFusion extends Storm_Model_Abstract { public function getDataSourceNamed($name) { - $this->dataSource=array_at($name, $this->getDataSource()); - return $this->dataSource; - if (!$this->dataSource) - return $this->dataSource=array_at($name, $this->getDataSource()); - return $this->dataSource->callGetterByAttributeName($name); + return array_at($name, $this->getDataSource()); } @@ -142,9 +138,9 @@ class Class_ModeleFusion extends Storm_Model_Abstract { $model = $instance->callGetterByAttributeName(array_shift($attributes)); if (!$model) return ''; + if (is_array($value = $this->getValue($model, $attributes))) return $this->buildSection($value,array_shift($match)); -// return $this->buildTable($value, array_shift($match)); return $this->htmlize($value); } @@ -161,12 +157,16 @@ class Class_ModeleFusion extends Storm_Model_Abstract { } else $attributes =[ $match]; - xdebug_break(); + $model = $this->getDataSourceNamed(array_shift($attributes)); - if (is_array($value = $this->getValue($model, $attributes))) + $value = $this->getValue($model, $attributes); + + if (is_array($value) && ($this->getNom() === 'recherche' || $this->getNom() === 'article')) return $this->buildSection($value,array_shift($match)); -// return $this->buildTable($value, array_shift($match)); + + if (is_array($value)) + return $this->buildTable($value, array_shift($match)); return $this->htmlize($value); } diff --git a/tests/application/modules/admin/controllers/FormationControllerTest.php b/tests/application/modules/admin/controllers/FormationControllerTest.php index 9085a2fb6bd..757b9b1ef41 100644 --- a/tests/application/modules/admin/controllers/FormationControllerTest.php +++ b/tests/application/modules/admin/controllers/FormationControllerTest.php @@ -1831,7 +1831,7 @@ class FormationControllerFicheEmargementSessionJavaFevrierTest extends Formation /** @test */ public function pageShouldContainsTableWithNomPrenom() { - $this->assertXPathContentContains('//table//td', 'Curzillat'); + $this->assertXPathContentContains('//table//td', 'Curzillat', $this->_response->getBody()); $this->assertXPathContentContains('//table//td', 'Benoit'); } -- GitLab