Try to fix phpunit
This commit is contained in:
parent
4c90e1c10d
commit
8794e54eba
@ -3380,10 +3380,10 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// on verifie si la facture est en numerotation provisoire
|
// we check if invoice is a temporary number (PROVxxxx)
|
||||||
$facref = substr($this->ref, 1, 4);
|
$tmppart = substr($this->ref, 1, 4);
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // If draft invoice and ref not yet defined
|
if ($this->statut == self::STATUS_DRAFT && $tmppart == 'PROV') // If draft invoice and ref not yet defined
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -3395,7 +3395,7 @@ class Facture extends CommonInvoice
|
|||||||
// ...
|
// ...
|
||||||
|
|
||||||
// If not a draft invoice and not temporary invoice
|
// If not a draft invoice and not temporary invoice
|
||||||
if ($facref != 'PROV')
|
if ($tmppart !== 'PROV')
|
||||||
{
|
{
|
||||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||||
$ventilExportCompta = $this->getVentilExportCompta();
|
$ventilExportCompta = $this->getVentilExportCompta();
|
||||||
|
|||||||
@ -284,27 +284,27 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
|||||||
$result=$localobject2->initAsSpecimen();
|
$result=$localobject2->initAsSpecimen();
|
||||||
$result=$localobject2->create($user);
|
$result=$localobject2->create($user);
|
||||||
$result=$localobject2->validate($user);
|
$result=$localobject2->validate($user);
|
||||||
print 'Invoice localobject ref = '.$localobject->ref."\n";
|
print 'Invoice $localobject ref = '.$localobject->ref."\n";
|
||||||
print 'Invoice $localobject2 created with ref = '.$localobject2->ref."\n";
|
print 'Invoice $localobject2 created with ref = '.$localobject2->ref."\n";
|
||||||
|
|
||||||
$conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1;
|
$conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1;
|
||||||
|
|
||||||
$result=$localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
|
$result=$localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
|
||||||
$this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on');
|
$this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on');
|
||||||
|
|
||||||
unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
|
unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
|
||||||
|
|
||||||
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
|
||||||
$this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice');
|
$this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice');
|
||||||
|
|
||||||
$result=$localobject2->delete($user); // Deletion is OK, it is last invoice
|
$result=$localobject2->delete($user); // Deletion is OK, it is last invoice
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
|
||||||
$this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');
|
$this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');
|
||||||
|
|
||||||
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
|
||||||
$this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice');
|
$this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice');
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user