update test
This commit is contained in:
parent
278d447e45
commit
336b8c49b3
@ -53,7 +53,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
@ -79,6 +79,23 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
// create a third_party, needed to create an invoice
|
||||
$societe=new Societe($db);
|
||||
$societe->ref='';
|
||||
$societe->name='name';
|
||||
$societe->ref_ext='209';
|
||||
$societe->status=1;
|
||||
$societe->client=1;
|
||||
$societe->fournisseur=0;
|
||||
$societe->date_creation=$now;
|
||||
$societe->tva_assuj=0;
|
||||
$societe->particulier=0;
|
||||
|
||||
$societe->create($user);
|
||||
|
||||
print __METHOD__." societe created id=".$societe->id."\n";
|
||||
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
@ -102,10 +119,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
// create a third_party, needed to create an invoice
|
||||
|
||||
|
||||
print __METHOD__."\n";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,6 +152,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
$WS_METHOD = 'createInvoice';
|
||||
$ns='http://www.dolibarr.org/ns/';
|
||||
|
||||
// load societe first
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch('', '', '209');
|
||||
print __METHOD__." societe loaded id=".$societe->id."\n";
|
||||
|
||||
// Set the WebService URL
|
||||
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
|
||||
$soapclient = new nusoap_client($WS_DOL_URL);
|
||||
@ -144,48 +165,49 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
$soapclient->soap_defencoding='UTF-8';
|
||||
$soapclient->decodeUTF8(false);
|
||||
}
|
||||
|
||||
|
||||
$body = array (
|
||||
["id"] => NULL,
|
||||
["ref"]=> NULL,
|
||||
["ref_ext"]=> "165",
|
||||
["thirdparty_id"]=> "209",
|
||||
["fk_user_author"] => NULL,
|
||||
["fk_user_valid"] => NULL,
|
||||
["date"]=> "2015-04-19 20:16:53",
|
||||
["date_due"]=> "",
|
||||
["date_creation"]=> "",
|
||||
["date_validation"]=> "",
|
||||
["date_modification"]=> "",
|
||||
["type"]=> "",
|
||||
["total_net"]=> "36.30",
|
||||
["total_vat"]=> "6.00",
|
||||
["total"]=> "42.30",
|
||||
["payment_mode_id"]=> 50,
|
||||
["note_private"]=> "Synchronised from Prestashop",
|
||||
["note_public"]=> "",
|
||||
["status"]=> "1",
|
||||
["close_code"]=> NULL ,
|
||||
["close_note"]=> NULL,
|
||||
["project_id"]=> NULL,
|
||||
["lines"] => array(
|
||||
["id"] => NULL,
|
||||
["type"]=> 0,
|
||||
["desc"]=> "Horloge Vinyle Serge",
|
||||
["vat_rate"]=> 20,
|
||||
["qty"]=> "1",
|
||||
["unitprice"]=> "30.000000",
|
||||
["total_net"]=> "30.000000",
|
||||
["total_vat"]=> "6.00",
|
||||
["total"]=> "36.000000",
|
||||
["date_start"]=> "",
|
||||
["date_end"]=> "",
|
||||
["payment_mode_id"]=> "",
|
||||
["product_id"]=> "",
|
||||
["product_ref"]=> "",
|
||||
["product_label"]=> "",
|
||||
["product_desc"]=> "" )
|
||||
);
|
||||
"id" => NULL,
|
||||
"ref" => NULL,
|
||||
"ref_ext" => "165",
|
||||
"thirdparty_id" => $societe->id,
|
||||
"fk_user_author" => NULL,
|
||||
"fk_user_valid" => NULL,
|
||||
"date" => "2015-04-19 20:16:53",
|
||||
"date_due" => "",
|
||||
"date_creation" => "",
|
||||
"date_validation" => "",
|
||||
"date_modification" => "",
|
||||
"type" => "",
|
||||
"total_net" => "36.30",
|
||||
"total_vat" => "6.00",
|
||||
"total" => "42.30",
|
||||
"payment_mode_id" => 50,
|
||||
"note_private" => "Synchronised from Prestashop",
|
||||
"note_public" => "",
|
||||
"status" => "1",
|
||||
"close_code" => NULL ,
|
||||
"close_note" => NULL,
|
||||
"project_id" => NULL,
|
||||
"lines" => array(
|
||||
"id" => NULL,
|
||||
"type" => 0,
|
||||
"desc" => "Horloge Vinyle Serge",
|
||||
"vat_rate" => 20,
|
||||
"qty" => "1",
|
||||
"unitprice" => "30.000000",
|
||||
"total_net" => "30.000000",
|
||||
"total_vat" => "6.00",
|
||||
"total" => "36.000000",
|
||||
"date_start" => "",
|
||||
"date_end" => "",
|
||||
"payment_mode_id" => "",
|
||||
"product_id" => "",
|
||||
"product_ref" => "",
|
||||
"product_label" => "",
|
||||
"product_desc" => "" )
|
||||
);
|
||||
|
||||
// Call the WebService method and store its result in $result.
|
||||
$authentication=array(
|
||||
@ -218,7 +240,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print __METHOD__." result=".$result."\n";
|
||||
print __METHOD__." result=".$result['result']['result_label']."\n";
|
||||
$this->assertEquals('OK',$result['result']['result_code']);
|
||||
$this->assertEquals('165', $result['ref_ext']);
|
||||
|
||||
@ -319,45 +341,45 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// update status to 2
|
||||
$body = array (
|
||||
["id"] => NULL,
|
||||
["ref"]=> NULL,
|
||||
["ref_ext"]=> "165",
|
||||
["thirdparty_id"]=> "209",
|
||||
["fk_user_author"] => NULL,
|
||||
["fk_user_valid"] => NULL,
|
||||
["date"]=> "2015-04-19 20:16:53",
|
||||
["date_due"]=> "",
|
||||
["date_creation"]=> "",
|
||||
["date_validation"]=> "",
|
||||
["date_modification"]=> "",
|
||||
["type"]=> "",
|
||||
["total_net"]=> "36.30",
|
||||
["total_vat"]=> "6.00",
|
||||
["total"]=> "42.30",
|
||||
["payment_mode_id"]=> 50,
|
||||
["note_private"]=> "Synchronised from Prestashop",
|
||||
["note_public"]=> "",
|
||||
["status"]=> "2",
|
||||
["close_code"]=> NULL ,
|
||||
["close_note"]=> NULL,
|
||||
["project_id"]=> NULL,
|
||||
["lines"] => array(
|
||||
["id"] => NULL,
|
||||
["type"]=> 0,
|
||||
["desc"]=> "Horloge Vinyle Serge",
|
||||
["vat_rate"]=> 20,
|
||||
["qty"]=> "1",
|
||||
["unitprice"]=> "30.000000",
|
||||
["total_net"]=> "30.000000",
|
||||
["total_vat"]=> "6.00",
|
||||
["total"]=> "36.000000",
|
||||
["date_start"]=> "",
|
||||
["date_end"]=> "",
|
||||
["payment_mode_id"]=> "",
|
||||
["product_id"]=> "",
|
||||
["product_ref"]=> "",
|
||||
["product_label"]=> "",
|
||||
["product_desc"]=> "" )
|
||||
"id" => NULL,
|
||||
"ref" => NULL,
|
||||
"ref_ext" => "165",
|
||||
"thirdparty_id" => "209",
|
||||
"fk_user_author" => NULL,
|
||||
"fk_user_valid" => NULL,
|
||||
"date" => "2015-04-19 20:16:53",
|
||||
"date_due" => "",
|
||||
"date_creation" => "",
|
||||
"date_validation" => "",
|
||||
"date_modification" => "",
|
||||
"type" => "",
|
||||
"total_net" => "36.30",
|
||||
"total_vat" => "6.00",
|
||||
"total" => "42.30",
|
||||
"payment_mode_id" => 50,
|
||||
"note_private" => "Synchronised from Prestashop",
|
||||
"note_public" => "",
|
||||
"status" => "2",
|
||||
"close_code" => NULL ,
|
||||
"close_note" => NULL,
|
||||
"project_id" => NULL,
|
||||
"lines" => array(
|
||||
"id" => NULL,
|
||||
"type" => 0,
|
||||
"desc" => "Horloge Vinyle Serge",
|
||||
"vat_rate" => 20,
|
||||
"qty" => "1",
|
||||
"unitprice" => "30.000000",
|
||||
"total_net" => "30.000000",
|
||||
"total_vat" => "6.00",
|
||||
"total" => "36.000000",
|
||||
"date_start" => "",
|
||||
"date_end" => "",
|
||||
"payment_mode_id" => "",
|
||||
"product_id" => "",
|
||||
"product_ref" => "",
|
||||
"product_label" => "",
|
||||
"product_desc" => "" )
|
||||
);
|
||||
|
||||
// Call the WebService method and store its result in $result.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user