[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 13/27: Missing files for #1369: Étendre la c
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 13/27: Missing files for #1369: Étendre la comptabilité analytique à tous les postes? |
Date: |
Wed, 4 Sep 2019 15:24:56 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 8cb9ea878423be844453c577851ecfc62a3f17a9
Author: Dany De Bontridder <address@hidden>
Date: Thu Aug 29 09:55:25 2019 +0200
Missing files for #1369: Étendre la comptabilité analytique à tous les
postes?
---
include/constant.php | 2 +-
include/sql/patch/upgrade137.sql | 6 +
.../class/noalyss_parameter_folderTest.class.php | 183 +++++++++++++++++++++
3 files changed, 190 insertions(+), 1 deletion(-)
diff --git a/include/constant.php b/include/constant.php
index d157706..cb856c3 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
-define ("DBVERSION",137);
+define ("DBVERSION",138);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",18);
define ('NOTFOUND','--not found--');
diff --git a/include/sql/patch/upgrade137.sql b/include/sql/patch/upgrade137.sql
new file mode 100644
index 0000000..2d83eb3
--- /dev/null
+++ b/include/sql/patch/upgrade137.sql
@@ -0,0 +1,6 @@
+begin;
+insert into "parameter" (pr_id,pr_value) values ('MY_ANC_FILTER','6,7');
+
+
+insert into version (val,v_description) values (138,'Analytic improve');
+commit ;
\ No newline at end of file
diff --git a/unit-test/include/class/noalyss_parameter_folderTest.class.php
b/unit-test/include/class/noalyss_parameter_folderTest.class.php
new file mode 100644
index 0000000..091830c
--- /dev/null
+++ b/unit-test/include/class/noalyss_parameter_folderTest.class.php
@@ -0,0 +1,183 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * PhpCompta is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Copyright (2018) Author Dany De Bontridder <address@hidden>
+
+use PHPUnit\Framework\TestCase;
+function trim_parameter($p_value){
+ return;
+}
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2017-11-26 at 11:24:04.
+ */
+class Noalyss_Parameter_FolderTest extends TestCase
+{
+
+ protected $object;
+ private $a_param;
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ */
+ protected function setUp()
+ {
+ global $g_connection, $g_user;
+ $_REQUEST['gDossier']=DOSSIER;
+ $g_connection=new Database(DOSSIER);
+ $g_user=new User($g_connection);
+ $this->object=new Noalyss_Parameter_Folder($g_connection);
+ $this->a_param=explode(",","MY_COUNTRY,".
+ "MY_DEFAULT_ROUND_ERROR_DEB,".
+ "MY_DEFAULT_ROUND_ERROR_CRED,".
+ "MY_ANC_FILTER,".
+ "MY_NAME,".
+ "MY_TVA,".
+ "MY_STREET,".
+ "MY_NUMBER,".
+ "MY_CP,".
+ "MY_TEL,".
+ "MY_PAYS,".
+ "MY_COMMUNE,".
+ "MY_FAX,".
+ "MY_ANALYTIC,".
+ "MY_STRICT,".
+ "MY_TVA_USE,".
+ "MY_PJ_SUGGEST,".
+ "MY_CHECK_PERIODE,".
+ "MY_DATE_SUGGEST,".
+ "MY_ALPHANUM,".
+ "MY_UPDLAB,".
+ "MY_STOCK");
+
+ }
+ public function testNew()
+ {
+ global $g_connection ;
+ $nb_param=count($this->a_param);
+ $cnt=$g_connection->get_value("select count(*) from parameter where
pr_id like 'MY_%'");
+ $this->assertEquals($nb_param,$cnt,"Number of parameters");
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testcheck()
+ {
+
+ $a=$this->object->check('MY_STRICT', 0);
+ $this->assertEquals($a,"N");
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testcheck_anc_filter()
+ {
+
+ try {
+ $this->object->check_anc_filter('6,7');
+ $this->assertTrue(TRUE);
+ } catch (Exception $ex) {
+ $this->assertTrue(FALSE,'6,7 is valid');
+ }
+ try {
+ $this->object->check_anc_filter('6,7,8,2');
+ $this->assertTrue(TRUE);
+ } catch (Exception $ex) {
+ $this->assertTrue(FALSE,'6,7,8,2 is valid');
+ }
+ try {
+ $this->object->check_anc_filter('6,7,8,2,AA');
+ $this->assertTrue(FALSE);
+ } catch (Exception $ex) {
+ $this->assertTrue(TRUE,'6,7,8,2 is not valid');
+ }
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testupdate()
+ {
+ $ok=0;
+ try {
+ $this->testsave();
+ } catch (Exception $e)
+ {
+ $ok=1;
+ }
+ $this->assertEquals($ok,0);
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testsave()
+ {
+ global $g_connection;
+ for ($e =0;$e < count($this->a_param);$e++)
+ {
+
+ $attr=$this->a_param[$e];
+
+ $old=$this->object->$attr;
+ switch ($attr)
+ {
+ case "MY_STRICT":
+ $this->object->$attr='Y';
+ break;
+ case "MY_COUNTRY":
+ $this->object->MY_COUNTRY='XBE';
+ break;
+ case "MY_ANC_FILTER":
+ $this->object->MY_ANC_FILTER='5,4';
+ break;
+ default:
+ $this->object->$attr='000';
+ break;
+ }
+ $this->object->save($this->a_param[$e]);
+ $cur_value=$g_connection->get_value('select pr_value from
"parameter" where pr_id=$1',[$attr]);
+
$this->assertTrue(($cur_value==$this->object->$attr),sprintf("failed : %s
cur_value %s expected %s",$attr,$cur_value,$this->object->$attr));
+ $this->assertTrue($cur_value != $old,sprintf( "failed : %s
cur_value %s old %s",$attr,$cur_value,$old));
+
+ $this->object->$attr=$old;
+ $this->object->save($this->a_param[$e]);
+ $cur_value=$g_connection->get_value('select pr_value from
"parameter" where pr_id=$1',[$attr]);
+ $this->assertTrue($cur_value == $old,sprintf( "failed : %s
cur_value %s old %s",$attr,$cur_value,$old));
+ }
+
+ }
+ function testMatch_accounting()
+ {
+ $this->assertTrue($this->object->match_analytic("612"));
+ $this->assertTrue($this->object->match_analytic("6"));
+ $this->assertTrue($this->object->match_analytic("66"));
+ $this->assertTrue($this->object->match_analytic("71"));
+ $this->assertTrue($this->object->match_analytic("7"));
+ $this->assertFalse($this->object->match_analytic("5"));
+ }
+}
+
+?>
- [Noalyss-commit] [noalyss] 12/27: #1369: Étendre la comptabilité analytique à tous les postes? #1716: GROS SOUCI CA - ventilation 4 et 5. 5 phantôme! #1479: PROPOSITION CA - paramétrage comptes actifs, (continued)
- [Noalyss-commit] [noalyss] 12/27: #1369: Étendre la comptabilité analytique à tous les postes? #1716: GROS SOUCI CA - ventilation 4 et 5. 5 phantôme! #1479: PROPOSITION CA - paramétrage comptes actifs, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 20/27: Task #0001731: Moyen de paiement , bug in ajax , if ledger==ODS a category of card is mandatory, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 21/27: Data_SQL Add database indication, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 02/27: Task #0001736: PHP7 comptability : count() works only with array, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 26/27: Database_Core add function with the number of cols, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 07/27: #0001584: En mode «optionnelle», afficher si CA ventilée ou non. Ajout symbole "contient", Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 11/27: layout, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 27/27: Merge branch 'dev7109', Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 05/27: Security : avoid direct call to Http Variable, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 19/27: #0001735: icone warning, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 13/27: Missing files for #1369: Étendre la comptabilité analytique à tous les postes?,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 10/27: #0001711: Gros souci comptanal Montant compté en absolu, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 15/27: @0001735: icone poubelle catégorie de fiche, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 17/27: #0001735: icone poubelle catégorie de fiche, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 22/27: translate, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 23/27: Data_SQL add the member, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 16/27: #0001736: PHP7 comptability + translation, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 14/27: #0001643: ajout icon "cache" pour bouton "remonter", Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 25/27: PDF_Core : add function get, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 24/27: Noalyss_SQL Create a function build query, Dany De Bontridder, 2019/09/04
- [Noalyss-commit] [noalyss] 01/27: Cosmetic, Dany De Bontridder, 2019/09/04