[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/46: Test Acc_Account
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/46: Test Acc_Account |
Date: |
Mon, 4 May 2020 13:38:41 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit c8bd525a425d3a7683d51155d37579e8497176e4
Author: Dany De Bontridder <address@hidden>
AuthorDate: Sun Jan 19 21:34:34 2020 +0100
Test Acc_Account
---
unit-test/include/class/acc_account.classTest.php | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/unit-test/include/class/acc_account.classTest.php
b/unit-test/include/class/acc_account.classTest.php
index 91343d7..676899a 100644
--- a/unit-test/include/class/acc_account.classTest.php
+++ b/unit-test/include/class/acc_account.classTest.php
@@ -16,7 +16,7 @@ class Acc_AccountTest extends TestCase
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
- protected function setUp() :void
+ protected function setUp()
{
global $g_connection, $g_parameter, $g_user;
$_REQUEST['gDossier']=DOSSIER;
@@ -129,7 +129,6 @@ class Acc_AccountTest extends TestCase
$this->assertEquals($ex->getCode(),EXC_PARAM_VALUE);
}
$duplicate->set_parameter('pcm_val','999TEST');
- $duplicate->insert();
$duplicate->delete();
}
@@ -154,11 +153,15 @@ class Acc_AccountTest extends TestCase
/**
* @covers Acc_Account::insert
+ * @covers Acc_Account::find_by_value
*/
public function testInsert()
{
$cn=Dossier::connect();
+ $cn->exec_sql("delete from tmp_pcmn where pcm_val=$1",
+ ['400A']);
$new=new Acc_Account($cn);
+
$new->set_parameter("pcm_val", '400A');
$new->set_parameter("pcm_val_parent", "400");
$new->set_parameter("pcm_direct_use", "Y");
@@ -172,11 +175,16 @@ class Acc_AccountTest extends TestCase
catch (Exception $e)
{
$this->assertEquals($e->getCode(), EXC_PARAM_VALUE);
+ $new->delete();
}
$new->set_parameter("pcm_lib", "Insertion test");
$new->insert();
+ $check=new Acc_Account($cn);
+ $check->find_by_value('400A');
+ $this->assertEquals("Insertion test",$check->get_lib());
$new->delete();
+
}
/**
@@ -201,11 +209,14 @@ class Acc_AccountTest extends TestCase
public function testSave()
{
global $g_connection;
+ $g_connection->exec_sql("delete from tmp_pcmn where pcm_val=$1",
+ ['999TEST']);
$check=new Acc_Account($g_connection,'999TEST');
$check->set_parameter("pcm_lib", "TESTING");
$check->set_parameter('pcm_val_parent','9');
$check->set_parameter('pcm_direct_use','N');
// insert
+
$check->save();
$check_new=new Acc_Account($g_connection,'999TEST');
$this->assertEquals($check_new->get_lib(),$check->get_lib());
@@ -216,5 +227,11 @@ class Acc_AccountTest extends TestCase
$this->assertNotEquals($check_new->get_lib(),"TESTING");
$check->delete();
}
-
+
+ public function testfind_parent()
+ {
+ $this->object->set_parameter("pcm_val", 70000000);
+ $result=$this->object->find_parent();
+ $this->assertEquals($result,700);
+ }
}
- [Noalyss-commit] [noalyss] branch master updated (f306130 -> aa78d59), Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 01/46: Record exception, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 04/46: Comptability PHP7.2, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 05/46: Documentation, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 02/46: Bug solde is rounded and doesn't have decimal, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 03/46: Test Acc_Account,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 06/46: Documentation, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 12/46: Minimum version : PHP 7.0 and PostgreSQL 9.5, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 07/46: phpunit : use plain text for restoring test database, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 09/46: search : add placeholder, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 10/46: Bug : customer.inc.php with http_input::request Correct : Contact.inc.php remove direct use of $_GET, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 11/46: New : Icon_Action::icon_onoff : display on or off, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 08/46: Bug : filter_list does not filter simple list, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 13/46: Noalyss_CSV : add setter and getter, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 16/46: remove blank line, Dany De Bontridder, 2020/05/04
- [Noalyss-commit] [noalyss] 18/46: Task #1694: Opération FIN: opération liée - code fiche mais pas nom, Dany De Bontridder, 2020/05/04