955 lines
28 KiB
PHP
955 lines
28 KiB
PHP
<?php
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Generated by PHPUnit_SkeletonGenerator on 2014-11-09 at 12:39:58.
|
|
*/
|
|
class Acc_LedgerTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @var Acc_Ledger
|
|
*/
|
|
protected $object;
|
|
protected function getDataSet()
|
|
{
|
|
$dataSet = new PHPUnit_Extensions_Database_DataSet_CsvDataSet();
|
|
$dataSet->addTable('jrn', dirname(__FILE__)."/jrn.csv");
|
|
return $dataSet;
|
|
}
|
|
/**
|
|
* Get an operation
|
|
* @global type $g_connection
|
|
* @return type
|
|
*/
|
|
private function get_jrn_id($p_ledger='ODS')
|
|
{
|
|
global $g_connection;
|
|
$jr_id=$g_connection->get_value("select max(jr_id) from jrn join jrn_def "
|
|
. "on (jrn_def_id=jr_def_id) "
|
|
. " where "
|
|
. " jrn_def_type=$1",[$p_ledger]);
|
|
return $jr_id;
|
|
}
|
|
/**
|
|
* Return 1 if operation does exist otherwise zero
|
|
* @global type $g_connection
|
|
* @param type $p_jr_id
|
|
* @return type
|
|
*/
|
|
private function exist_operation($p_jr_id)
|
|
{
|
|
global $g_connection;
|
|
$jr_id=$g_connection->get_value("select count(*) from jrn where jr_id=$1",[$p_jr_id]);
|
|
return $jr_id;
|
|
}
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
protected function setUp()
|
|
{
|
|
include 'global.php';
|
|
$this->object=new Acc_Ledger($g_connection,0);
|
|
}
|
|
|
|
/**
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
* This method is called after a test is executed.
|
|
*/
|
|
protected function tearDown()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_last_pj
|
|
* @todo Implement testGet_last_pj().
|
|
*/
|
|
public function testGet_last_pj()
|
|
{
|
|
|
|
$this->object->id=2;
|
|
$sPj=$this->object->get_last_pj(2);
|
|
print_r("get_last_pj $sPj");
|
|
$this->assertEquals(5,$sPj);
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_type
|
|
* @todo Implement testGet_type().
|
|
*/
|
|
public function testGet_type()
|
|
{
|
|
$this->object->id=0;
|
|
$type=$this->object->get_type();
|
|
$this->assertEquals('GL',$type);
|
|
|
|
$this->object->id=1;
|
|
$type=$this->object->get_type();
|
|
$this->assertEquals('FIN',$type);
|
|
|
|
$this->object->id=2;
|
|
$type=$this->object->get_type();
|
|
$this->assertEquals('VEN',$type);
|
|
|
|
$this->object->id=3;
|
|
$type=$this->object->get_type();
|
|
$this->assertEquals('ACH',$type);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::delete
|
|
* @todo Implement testDelete().
|
|
*/
|
|
public function testDelete()
|
|
{
|
|
global $g_connection;
|
|
$jr_id=$g_connection->get_value("select max(jr_id) from jrn");
|
|
$this->object->jr_id=$jr_id;
|
|
$this->object->delete();
|
|
$count=$g_connection->get_value("select count(*) from jrn where jr_id=$1",[$jr_id]);
|
|
$this->assertEquals($count,0);
|
|
}
|
|
public function delete_ledger()
|
|
{
|
|
global $g_connection;
|
|
// a . create a ledger and delete it
|
|
$array=["p_jrn_def_name"=>"UNITTEST","p_ech_lib"=>"","p_jrn_deb_max_line"=>7,'p_jrn_type'=>'ODS','jrn_def_pj_pref'=>'TT/','min_row'=>5,'p_description'=>'LEDGER UNIT TEST','jrn_def_negative_amount'=>0,'jrn_def_negative_warning'=>'Warning'];
|
|
$this->object->save_new($array);
|
|
|
|
// Get it
|
|
$last_ledger_inserted=$g_connection->get_value("select max(jrn_def_id) from jrn_def");
|
|
$name=$g_connection->get_value("select jrn_def_name from jrn_def where jrn_def_id=$1",[$last_ledger_inserted]);
|
|
$this->assertEquals($name,'UNITTEST');
|
|
|
|
// drop it
|
|
$this->object->delete_ledger();
|
|
$cnt=$g_connection->get_value("select count(*) from jrn_def where jrn_def_id=$1",[$last_ledger_inserted]);
|
|
$this->assertEquals($cnt,0);
|
|
$ok=0;
|
|
// Try to delete a ledger which is used
|
|
try {
|
|
$jr_id=$g_connection->get_value("select max(jr_id) from jrn");
|
|
$ledger_id=$g_connection->get_value("select jr_def_id from jrn where jr_id=$1",[$jr_id]);
|
|
$ledger=new Acc_Legder($g_connection,$ledger_id);
|
|
$ledger->delete_ledger();
|
|
} catch (Exception $ex) {
|
|
$ok=1;
|
|
}
|
|
$this->assertEquals($ok,1);
|
|
$cnt=$g_connection->get_value("select count(*) from jrn_def where jrn_def_id=$1",[$ledger_id]);
|
|
$this->assertEquals($cnt,1);
|
|
}
|
|
/**
|
|
* @covers Acc_Ledger::display_warning
|
|
* @todo Implement testDisplay_warning().
|
|
*/
|
|
public function testDisplay_warning()
|
|
{
|
|
$str=$this->object->display_warning(["First Line","Second Line"], "warning");
|
|
$this->assertEquals('<p class="notice"> warning<ol class="notice"><li>First Line</li><li>Second Line</li></ol></p>',$str);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::reverse
|
|
* @todo Implement testReverse().
|
|
*/
|
|
public function testReverse()
|
|
{
|
|
global $g_connection;
|
|
$this->object->jr_id=$g_connection->get_value("select max(jr_id) from jrn ");
|
|
$this->assertLessThan($this->object->jr_id,"0","found jr_id ".$this->object->jr_id);
|
|
$this->assertFalse(empty($this->object->jr_id),"not found jr_id ");
|
|
|
|
$this->object->id=$g_connection->get_value("select jr_def_id from jrn where jr_id=$1",[$this->object->jr_id]);
|
|
$this->assertGreaterThan($this->object->id,"0","found id ".$this->object->id);
|
|
$this->assertFalse(empty($this->object->id),"not found id ");
|
|
print_r("jr_id = ".$this->object->jr_id);
|
|
print_r("id = ".$this->object->id);
|
|
$date=$g_connection->get_value ("select to_char(max(p_start),'DD.MM.YYYY') from parm_periode where p_closed='f'");
|
|
$this->object->reverse($date,'unit test'.$date);
|
|
$check=$g_connection->get_value("select jr_id from jrn where jr_comment=$1",["unit test".$date]);
|
|
$this->assertFalse(empty($check),"NOT REVERSED" );
|
|
$this->object->jr_id=$check;
|
|
$this->object->delete();
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_name
|
|
* @todo Implement testGet_name().
|
|
*/
|
|
public function testGet_name()
|
|
{
|
|
$this->object->id=3;
|
|
$name=$this->object->get_name();
|
|
$this->assertEquals('Achat',$name);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_rowSimple
|
|
* @todo Implement testGet_rowSimple().
|
|
*/
|
|
public function testGet_rowSimple()
|
|
{
|
|
global $g_connection;
|
|
$last=$g_connection->get_value("select max(p_id) from parm_periode");
|
|
$first=$g_connection->get_value("select min(p_id) from parm_periode");
|
|
$id=$this->object->id;
|
|
$this->object->id=2;
|
|
$array=$this->object->get_rowSimple($first,$last);
|
|
$this->assertTrue(is_array($array),"get_rowSimple does not return an array");
|
|
$this->assertGreaterThan(0,count($array));
|
|
$this->object->id=$id;
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::guess_pj
|
|
* @todo Implement testGuess_pj().
|
|
*/
|
|
public function testGuess_pj()
|
|
{
|
|
$this->object->id=2;
|
|
$r=$this->object->guess_pj();
|
|
$this->assertEquals("VEN6",$r);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_propertie
|
|
* @todo Implement testGet_propertie().
|
|
*/
|
|
public function testGet_propertie()
|
|
{
|
|
global $g_connection;
|
|
$this->object->id=2;
|
|
$array=$this->object->get_propertie();
|
|
// there are 16 columns in jrn_def
|
|
$this->assertEquals(count($array),20);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::GetDefLine
|
|
* @todo Implement testGetDefLine().
|
|
*/
|
|
public function testGetDefLine()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
/**
|
|
* @covers Acc_Ledger::display_negative_warning
|
|
*/
|
|
public function testDisplay_negative_warning()
|
|
{
|
|
global $g_connection;
|
|
$msg="WARNING ! WARNING !";
|
|
$acc_ledger=new Jrn_def_SQL($g_connection,2);
|
|
$acc_ledger_old=clone $acc_ledger;
|
|
$acc_ledger->setp("jrn_def_negative_amount",1);
|
|
$acc_ledger->setp("jrn_def_negative_warning",$msg);
|
|
$acc_ledger->save();
|
|
$this->object->set_ledger_id(2);
|
|
$result=$this->object->display_negative_warning(-1);
|
|
$this->assertEquals($result,"");
|
|
$result=$this->object->display_negative_warning(1);
|
|
$this->assertEquals($result,$msg);
|
|
|
|
$acc_ledger_old->save();
|
|
$id=$this->object->get_ledger_id();
|
|
$ok=0;
|
|
try {
|
|
$this->object->set_ledger_id(0);
|
|
$result=$this->object->display_negative_warning(1);
|
|
} catch (Exception $e) {
|
|
$this->assertEquals($e->getCode(),1);
|
|
$ok=1;
|
|
}
|
|
$this->assertEquals($ok,1);
|
|
$this->object->set_ledger_id($id);
|
|
|
|
}
|
|
/**
|
|
* @covers Acc_Ledger::get_solde
|
|
* @todo Implement testGet_solde().
|
|
*/
|
|
public function testGet_solde()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::select_ledger
|
|
* @todo Implement testSelect_ledger().
|
|
*/
|
|
public function testSelect_ledger()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_fiche_def
|
|
* @todo Implement testGet_fiche_def().
|
|
*/
|
|
public function testGet_fiche_def()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_class_def
|
|
* @todo Implement testGet_class_def().
|
|
*/
|
|
public function testGet_class_def()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::confirm
|
|
* @todo Implement testConfirm().
|
|
*/
|
|
public function testConfirm()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_min_row
|
|
* @todo Implement testGet_min_row().
|
|
*/
|
|
public function testGet_min_row()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::input
|
|
* @todo Implement testInput().
|
|
*/
|
|
public function testInput()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::is_closed
|
|
* @todo Implement testIs_closed().
|
|
*/
|
|
public function testIs_closed()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::verify
|
|
* @todo Implement testVerify().
|
|
*/
|
|
public function testVerify()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::compute_internal_code
|
|
* @todo Implement testCompute_internal_code().
|
|
*/
|
|
public function testCompute_internal_code()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::save
|
|
* @todo Implement testSave().
|
|
*/
|
|
public function testSave()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_request
|
|
* @todo Implement testGet_request().
|
|
*/
|
|
public function testGet_request()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::next_number
|
|
* @todo Implement testNext_number().
|
|
*/
|
|
public function testNext_number()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_first
|
|
* @todo Implement testGet_first().
|
|
*/
|
|
public function testGet_first()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::update_paid
|
|
* @todo Implement testUpdate_paid().
|
|
*/
|
|
public function testUpdate_paid()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::update_internal_code
|
|
* @todo Implement testUpdate_internal_code().
|
|
*/
|
|
public function testUpdate_internal_code()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_default_card
|
|
* @todo Implement testGet_default_card().
|
|
*/
|
|
public function testGet_default_card()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_all_fiche_def
|
|
* @todo Implement testGet_all_fiche_def().
|
|
*/
|
|
public function testGet_all_fiche_def()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_saldo_exercice
|
|
* @todo Implement testGet_saldo_exercice().
|
|
*/
|
|
public function testGet_saldo_exercice()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::check_strict
|
|
* @todo Implement testCheck_strict().
|
|
*/
|
|
public function testCheck_strict()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::check_periode
|
|
* @todo Implement testCheck_periode().
|
|
*/
|
|
public function testCheck_periode()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_last_date
|
|
* @todo Implement testGet_last_date().
|
|
*/
|
|
public function testGet_last_date()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_id
|
|
* @todo Implement testGet_id().
|
|
*/
|
|
public function testGet_id()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::create_document
|
|
* @todo Implement testCreate_document().
|
|
*/
|
|
public function testCreate_document()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::check_payment
|
|
* @todo Implement testCheck_payment().
|
|
*/
|
|
public function testCheck_payment()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::inc_seq_pj
|
|
* @todo Implement testInc_seq_pj().
|
|
*/
|
|
public function testInc_seq_pj()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::search_form
|
|
* @todo Implement testSearch_form().
|
|
*/
|
|
public function testSearch_form()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::build_search_sql
|
|
* @todo Implement testBuild_search_sql().
|
|
*/
|
|
public function testBuild_search_sql()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::display_search_form
|
|
* @todo Implement testDisplay_search_form().
|
|
*/
|
|
public function testDisplay_search_form()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_last
|
|
* @todo Implement testGet_last().
|
|
*/
|
|
public function testGet_last()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::search_group
|
|
* @todo Implement testSearch_group().
|
|
*/
|
|
public function testSearch_group()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_operation
|
|
* @todo Implement testGet_operation().
|
|
*/
|
|
public function testGet_operation()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::existing_vat
|
|
* @todo Implement testExisting_vat().
|
|
*/
|
|
public function testExisting_vat()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_other_amount
|
|
* @todo Implement testGet_other_amount().
|
|
*/
|
|
public function testGet_other_amount()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::vat_operation
|
|
* @todo Implement testVat_operation().
|
|
*/
|
|
public function testVat_operation()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::previous_amount
|
|
* @todo Implement testPrevious_amount().
|
|
*/
|
|
public function testPrevious_amount()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::test_me
|
|
* @todo Implement testTest_me().
|
|
*/
|
|
public function testTest_me()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::array_cat
|
|
* @todo Implement testArray_cat().
|
|
*/
|
|
public function testArray_cat()
|
|
{
|
|
$array=Acc_Ledger::array_cat();
|
|
$this->assertEquals(4,count($array));
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_tiers
|
|
* @todo Implement testGet_tiers().
|
|
*/
|
|
public function testGet_tiers()
|
|
{
|
|
global $g_connection;
|
|
$jr_id=$this->get_jrn_id();
|
|
$this->assertEquals($this->object->get_tiers("ODS", $jr_id)," ");
|
|
|
|
$jr_id=$this->get_jrn_id("ACH");
|
|
$this->assertTrue($this->object->get_tiers("ACH",$jr_id)!=' ');
|
|
|
|
$jr_id=$this->get_jrn_id("FIN");
|
|
$this->assertTrue($this->object->get_tiers('FIN',$jr_id)!=' ');
|
|
|
|
$jr_id=$this->get_jrn_id("VEN");
|
|
$this->assertTrue($this->object->get_tiers("VEN",$jr_id)!=' ');
|
|
|
|
}
|
|
public function testGet_tiers_id()
|
|
{
|
|
global $g_connection;
|
|
$jr_id=$this->get_jrn_id();
|
|
$this->assertEquals($this->object->get_tiers_id("ODS", $jr_id),0);
|
|
|
|
$jr_id=$this->get_jrn_id("ACH");
|
|
$this->assertGreaterThan(0,$this->object->get_tiers_id("ACH",$jr_id));
|
|
|
|
$jr_id=$this->get_jrn_id("FIN");
|
|
$this->assertGreaterThan(0,$this->object->get_tiers_id("FIN",$jr_id));
|
|
|
|
$jr_id=$this->get_jrn_id("VEN");
|
|
$this->assertGreaterThan(0,$this->object->get_tiers_id("VEN",$jr_id));
|
|
|
|
}
|
|
/**
|
|
* @covers Acc_Ledger::listing
|
|
* @todo Implement testListing().
|
|
*/
|
|
public function testListing()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::display_ledger
|
|
* @todo Implement testDisplay_ledger().
|
|
*/
|
|
public function testDisplay_ledger()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::verify_ledger
|
|
* @todo Implement testVerify_ledger().
|
|
*/
|
|
public function testVerify_ledger()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::update
|
|
* @todo Implement testUpdate().
|
|
*/
|
|
public function testUpdate()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::input_paid
|
|
*/
|
|
public function testInput_paid()
|
|
{
|
|
$r=$this->object->input_paid(0);
|
|
$this->assertStringStartsWith('<div id="payment">',$r);
|
|
$this->assertStringEndsWith('</div>',$r);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::input_new
|
|
* @todo Implement testInput_new().
|
|
*/
|
|
public function testInput_new()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::save_new
|
|
*/
|
|
public function testSave_new()
|
|
{
|
|
global $g_connection;
|
|
|
|
$array=["p_jrn_name"=>"UNITTEST",
|
|
"p_ech_lib"=>"",
|
|
"p_jrn_deb_max_line"=>7,
|
|
'p_jrn_class_deb'=>'4*',
|
|
'p_jrn_type'=>'ODS',
|
|
'jrn_def_pj_pref'=>'TT/',
|
|
'min_row'=>5,
|
|
'p_description'=>'LEDGER UNIT TEST',
|
|
'negative_amount'=>0,
|
|
'negative_warning'=>'Warning'];
|
|
|
|
|
|
$this->object->save_new($array);
|
|
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
|
$this->assertGreaterThan($jrn_def_id,0);
|
|
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
|
$ledger->delete_ledger();
|
|
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
|
$this->assertEquals($jrn_def_id,"");
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::delete_ledger
|
|
* @todo Implement testDelete_ledger().
|
|
*/
|
|
public function testDelete_ledger()
|
|
{
|
|
global $g_connection;
|
|
$array=["p_jrn_name"=>"UNITTEST",
|
|
"p_ech_lib"=>"",
|
|
"p_jrn_deb_max_line"=>7,
|
|
'p_jrn_class_deb'=>'4*',
|
|
'p_jrn_type'=>'ODS',
|
|
'jrn_def_pj_pref'=>'TT/',
|
|
'min_row'=>5,
|
|
'p_description'=>'LEDGER UNIT TEST',
|
|
'negative_amount'=>0,
|
|
'negative_warning'=>'Warning'];
|
|
|
|
$this->object->save_new($array);
|
|
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
|
$this->assertGreaterThan($jrn_def_id,0);
|
|
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
|
$ledger->delete_ledger();
|
|
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
|
$this->assertEquals($jrn_def_id,"");
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_operation_date
|
|
* @todo Implement testGet_operation_date().
|
|
*/
|
|
public function testGet_operation_date()
|
|
{
|
|
$res=$this->object->get_operation_date('01.01.2010','VEN','>');
|
|
$this->assertGreaterThan(0,count($res),'Failed VEN');
|
|
$res=$this->object->get_operation_date('01.01.2010','ACH','>');
|
|
$this->assertGreaterThan(0,count($res),'Failed ACH ');
|
|
$res=$this->object->get_operation_date('01.01.2000','VEN','<');
|
|
$this->assertEquals(count($res),0,'Failed VEN before ');
|
|
$res=$this->object->get_operation_date('01.01.2000','ACH','<');
|
|
$this->assertEquals(count($res),0,'Failed ACH before');
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_supplier_now
|
|
* @todo Implement testGet_supplier_now().
|
|
*/
|
|
public function testGet_supplier_now()
|
|
{
|
|
$this->assertTrue(is_array($this->object->get_supplier_now()));
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_supplier_late
|
|
* @todo Implement testGet_supplier_late().
|
|
*/
|
|
public function testGet_supplier_late()
|
|
{
|
|
$this->assertTrue(is_array($this->object->get_supplier_late()));
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_customer_now
|
|
* @todo Implement testGet_customer_now().
|
|
*/
|
|
public function testGet_customer_now()
|
|
{
|
|
$this->assertTrue(is_array($this->object->get_customer_now()));
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::get_customer_late
|
|
* @todo Implement testGet_customer_late().
|
|
*/
|
|
public function testGet_customer_late()
|
|
{
|
|
$this->assertTrue(is_array($this->object->get_customer_late()));
|
|
}
|
|
|
|
/**
|
|
* @covers Acc_Ledger::convert_from_follow
|
|
* @todo Implement testConvert_from_follow().
|
|
*/
|
|
public function testConvert_from_follow()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
}
|