Skip to content

Commit

Permalink
The phpunit test is correct. What's wrong is
Browse files Browse the repository at this point in the history
inside dolibarr code (Really dont know why it fails with 1900. It
looks like a year 2000 bug). Let's try with 1915 and 1916
  • Loading branch information
eldy committed Sep 24, 2012
1 parent 9792d5a commit e6d91a3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/phpunit/NumberingModulesTest.php
Expand Up @@ -129,30 +129,29 @@ public function testFactureMercure()
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/mod_facture_mercure.php';

/*
// First we try with a simple mask, with no reset
// and we test counter is still increase second year.
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';

$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1900); // we use year 1900 to be sure to not have existing invoice for this year
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($mysoc, $localobject);
$result2=$localobject->create($user,1);
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
$this->assertEquals('1900-0001', $result); // counter must start to 1
$this->assertEquals('1915-0001', $result); // counter must start to 1

$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1901); // we use following year for second invoice
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($mysoc, $localobject);
print __METHOD__." result=".$result."\n";
$this->assertEquals('1901-0002', $result); // counter must not be reset
*/
$this->assertEquals('1916-0002', $result); // counter must not be reset

// Now we try with a reset
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000@1}';
Expand Down

0 comments on commit e6d91a3

Please sign in to comment.