diff --git a/library/ZendAfi/View/Helper/RenderFormation.php b/library/ZendAfi/View/Helper/RenderFormation.php index 09c20d18a3b40a0f952fc7ce9908d2e1dc4e7305..6eb22ec116ff2e0e52f1fa94cd72d6f9c74d70bd 100644 --- a/library/ZendAfi/View/Helper/RenderFormation.php +++ b/library/ZendAfi/View/Helper/RenderFormation.php @@ -16,13 +16,15 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_RenderFormation extends ZendAfi_View_Helper_BaseHelper { - public function renderFormation($formation, $strategy = '') { + if (!$formation->isVisible()) + return ''; + $render = $strategy ? 'Render_Strategy_'.$strategy : 'Render_Strategy'; $this->_strategy = new $render($this->view); return $this->_strategy->render($formation); diff --git a/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php b/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php index 18541bf15533c73c5fec7285368f96f39b16f894..d9a9f0e9e2da5a673582ac90e0de45ec225006c3 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerFormationsTest.php @@ -190,6 +190,32 @@ abstract class AbstractAbonneControllerFormationsTestCase extends AbstractContro } + + +class AbonneControllerFormationsListWithLearnJavaNotVisibleTest extends AbstractAbonneControllerFormationsTestCase { + public function setUp() { + parent::setUp(); + $this->_learn_java->hide()->save(); + $this->dispatch('/opac/formations', true); + } + + + /** @test */ + function noH2ShouldContainsLearnJava() { + $this->assertNotXPathContentContains('//h2', 'Learn Java'); + } + + + /** @test */ + function sessionMarsShouldNotBeVisible() { + $this->assertNotXPathContentContains('//tbody//tr//td', '1 mars 2014'); + } + +} + + + + class AbonneControllerFormationsListTest extends AbstractAbonneControllerFormationsTestCase { public function setUp() { parent::setUp(); diff --git a/tests/application/modules/opac/controllers/FormationsControllerTest.php b/tests/application/modules/opac/controllers/FormationsControllerTest.php index 88599f3ffbe7a5175704f5072ef036fffdc1eb3c..a97c811d3a8dcaeac76fc5e840357edd0e5ce9c7 100644 --- a/tests/application/modules/opac/controllers/FormationsControllerTest.php +++ b/tests/application/modules/opac/controllers/FormationsControllerTest.php @@ -85,11 +85,11 @@ abstract class AbstractFormationsControllerTestCase extends AbstractControllerTe $session_canceled, $_session_java_fevrier, $session_subscription_exhausted]]); - } +} + -} class FormationsControllerFormationsSessionFevrierJavaTest extends AbstractFormationsControllerTestCase { public function setUp() { @@ -129,7 +129,6 @@ class FormationsControllerFormationsSessionFevrierJavaTest extends AbstractForma class FormationsControllerAnonymousTest extends AbstractFormationsControllerTestCase { - public function setUp() { parent::setUp(); $this->dispatch('/opac/formations', true); @@ -142,9 +141,11 @@ class FormationsControllerAnonymousTest extends AbstractFormationsControllerTest $this->assertXPathContentContains('//tbody//tr/td/span', 'Date de limite d\'inscription:'); } - } + + + class FormationsControllerFormationsSessionJuilletPythonDetailRetourFicheTest extends AbstractFormationsControllerTestCase { public function setUp() { parent::setUp();