From ffb5cd715d87ca2a06dd59adf6958b58adcdaca2 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 3 Sep 2021 00:27:11 +0200 Subject: [PATCH] PHPUNIT test bug #0002061: Fiche ne peuvent pas devenir inactive --- unit-test/include/class/fiche.Test.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/unit-test/include/class/fiche.Test.php b/unit-test/include/class/fiche.Test.php index 3c14f1bac..7ebcaa7d1 100644 --- a/unit-test/include/class/fiche.Test.php +++ b/unit-test/include/class/fiche.Test.php @@ -674,4 +674,25 @@ where } } + /** + * @testdox testUpdateEnable card enable and disable + */ + public function testUpdateEnable() + { + global $g_connection; + $fiche= $fiche=$this->build_fiche(2,'PHPUNIT-ENABLE'); + $fiche->update($fiche->to_array()); + $this->assertEquals(1,$g_connection->get_value("select f_enable from fiche where f_id=$1",[$fiche->id])," Fiche::update card is not enabled" ); + $fiche->set_f_enable(0); + $fiche->update($fiche->to_array()); + $this->assertEquals(0,$g_connection->get_value("select f_enable from fiche where f_id=$1",[$fiche->id])," Fiche::update card is not disabled" ); + $fiche->set_f_enable(1); + Card_Property::update($fiche); + $this->assertEquals(1,$g_connection->get_value("select f_enable from fiche where f_id=$1",[$fiche->id]),"Card_Property:update card is not enabled" ); + $fiche->set_f_enable(0); + Card_Property::update($fiche); + $this->assertEquals(0,$g_connection->get_value("select f_enable from fiche where f_id=$1",[$fiche->id]),"Card_Property:update card is not disabled" ); + $fiche->remove(); + + } }