FIX bug due changes Data_SQL
This commit is contained in:
parent
8befe04534
commit
70bae8b1b7
17 changed files with 116 additions and 39 deletions
|
|
@ -48,6 +48,36 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
$this->assertEquals(count($array), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array : idx [ $accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred]
|
||||
*/
|
||||
public function dataGet_row_date()
|
||||
{
|
||||
$array=array(
|
||||
['55000004','01.01.2019','31.12.2019',4,0,806.90]
|
||||
,['55000005','01.01.2019','31.12.2019',3,3750.78,250.25]
|
||||
,['4400005','01.01.2019','31.12.2019',17,806.90,1761.00]
|
||||
,['4400005','01.03.2019','02.05.2019',9,602.19,848.80]
|
||||
);
|
||||
return $array;
|
||||
}
|
||||
/**
|
||||
* @brief test function Acc_Account_Ledger::get_row_date
|
||||
* @covers Acc_Account_Ledger::get_row_date
|
||||
* @dataProvider dataGet_row_date
|
||||
*/
|
||||
public function testGetRowData($accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred)
|
||||
{
|
||||
global $g_connection;
|
||||
$g_connection->clear_all_prepare();
|
||||
$acc_account_ledger=new Acc_Account_Ledger( $g_connection, $accounting);
|
||||
$acc_account_ledger->get_row_date($from_date,$to_date);
|
||||
$nb_actual_row=count($acc_account_ledger->row);
|
||||
$this->assertEquals($nb_row,$nb_actual_row,"error received $nb_row rows");
|
||||
$this->assertEquals($tot_deb,$acc_account_ledger->tot_deb,"error amount incorrect received ".$acc_account_ledger->tot_deb);
|
||||
$this->assertEquals($tot_cred,$acc_account_ledger->tot_cred,"error amount incorrect received ".$acc_account_ledger->tot_cred);
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Account_Ledger::get_row_date
|
||||
*/
|
||||
|
|
@ -480,5 +510,33 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
$this->assertEquals($nb_accounting,count($a_result)
|
||||
,"number of accounting incorrect for (\$from_date,\$to_date,\$from_accounting,\$to_accounting,\$nb_accounting : ($from_date,$to_date,$from_accounting,$to_accounting,$nb_accounting");
|
||||
|
||||
}
|
||||
/**
|
||||
* @return array : idx [ $accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred]
|
||||
*/
|
||||
public function dataRowNotLettered()
|
||||
{
|
||||
$array=array(
|
||||
['4400005','01.01.2019','31.12.2019',9,0,954.10]
|
||||
,['4400005','01.03.2019','02.05.2019',3,0,246.61]
|
||||
);
|
||||
return $array;
|
||||
}
|
||||
/**
|
||||
* @brief test function Acc_Account_Ledger::get_row_date only unlettered
|
||||
* @covers Acc_Account_Ledger::get_row_date
|
||||
* @dataProvider dataRowNotLettered
|
||||
*/
|
||||
public function testGetRowDataNotLetted($accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred)
|
||||
{
|
||||
global $g_connection;
|
||||
$g_connection->clear_all_prepare();
|
||||
$acc_account_ledger=new Acc_Account_Ledger( $g_connection, $accounting);
|
||||
$acc_account_ledger->get_row_date(p_from:$from_date,p_to:$to_date,let:2);
|
||||
$nb_actual_row=count($acc_account_ledger->row);
|
||||
$this->assertEquals($nb_row,$nb_actual_row,"error received $nb_row rows");
|
||||
$this->assertEquals($tot_deb,$acc_account_ledger->tot_deb,"error amount incorrect received ".$acc_account_ledger->tot_deb);
|
||||
$this->assertEquals($tot_cred,$acc_account_ledger->tot_cred,"error amount incorrect received ".$acc_account_ledger->tot_cred);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -901,7 +901,7 @@ class Acc_LedgerTest extends TestCase
|
|||
ob_end_clean();
|
||||
\Noalyss\Facility::save_file(__DIR__."/file", "acc_ledger-input_new.html", $result);
|
||||
$size=filesize(__DIR__."/file/acc_ledger-input_new.html");
|
||||
$this->assertTrue($size == 16044 ," output input_new is not what it is expected");
|
||||
$this->assertTrue($size == 16063 ," output input_new is $size not what it is expected");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\TestCase;
|
|||
*/
|
||||
require DIRTEST.'/global.php';
|
||||
|
||||
class Currency_SQL extends \Table_Data_SQL
|
||||
class data_Currency_SQL extends \Table_Data_SQL
|
||||
{
|
||||
|
||||
function __construct(Database $p_cn, $p_id=-1)
|
||||
|
|
@ -69,7 +69,7 @@ class Data_SQLTest extends TestCase
|
|||
function testBuildObject()
|
||||
{
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$this->assertEquals($currency_sql->cr_code_iso,'EUR','invalid ISO Code');
|
||||
}
|
||||
/**
|
||||
|
|
@ -79,17 +79,17 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
/* insert */
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn);
|
||||
$currency_sql = new data_Currency_SQL($cn);
|
||||
$currency_sql->cr_code_iso = 'XIU';
|
||||
$currency_sql->cr_name = 'Currency for UNIT TEST';
|
||||
$currency_sql->insert();
|
||||
$this->assertTrue($currency_sql->id > 0,' row not created');
|
||||
/* update */
|
||||
$update_sql = new Currency_SQL($cn,$currency_sql->id);
|
||||
$update_sql = new data_Currency_SQL($cn,$currency_sql->id);
|
||||
$this->assertTrue($update_sql->cr_code_iso=='XIU'," update can not find row");
|
||||
$update_sql->cr_name='xxxx';
|
||||
$update_sql->save();
|
||||
$check_sql=new Currency_SQL($cn,$currency_sql->id);
|
||||
$check_sql=new data_Currency_SQL($cn,$currency_sql->id);
|
||||
$this->assertEquals($check_sql->get('cr_name'),'xxxx','get row not updated');
|
||||
$this->assertEquals($check_sql->cr_name,'xxxx',' __get row not updated');
|
||||
$this->assertEquals($check_sql->getp('cr_name'),'xxxx',' getp row not updated');
|
||||
|
|
@ -107,7 +107,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$a=$currency_sql->dummy;
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$currency_sql->get("dummy");
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$currency_sql->getp("dummy");
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$currency_sql->dummy=1;
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$currency_sql->set("dummy",1);
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ class Data_SQLTest extends TestCase
|
|||
{
|
||||
try {
|
||||
$cn=new \Database(DOSSIER);
|
||||
$currency_sql = new Currency_SQL($cn,0);
|
||||
$currency_sql = new data_Currency_SQL($cn,0);
|
||||
$currency_sql->setp("dummy",1);
|
||||
$currency_sql->save();
|
||||
|
||||
|
|
@ -190,4 +190,4 @@ class Data_SQLTest extends TestCase
|
|||
$this->assertEquals($ex->getCode(), EXC_DATA_SQL,' get unknow column fails');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue