From 348b8d2ffe3747b41c7f128369319973eb01ff2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 23:55:41 +0100 Subject: [PATCH] More phpunit tests --- htdocs/core/lib/company.lib.php | 2 +- test/phpunit/SocieteTest.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c6cd0998326..fdbac5f3348 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -772,7 +772,7 @@ function isInEEC($object) $country_code_in_EEC = getCountriesInEEC(); - //print "dd".$this->country_code; + //print "dd".$object->country_code; return in_array($object->country_code, $country_code_in_EEC); } diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 0435a5e80f4..aa57d987238 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -355,7 +355,20 @@ class SocieteTest extends PHPUnit\Framework\TestCase $result=$localobject->isInEEC(); print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n"; - $this->assertTrue(true, $result); + $this->assertTrue($result); + + $localobject->country_code = 'US'; + + $result=$localobject->isInEEC(); + print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n"; + $this->assertFalse($result); + + /*$localobject->country_code = 'GB'; + + $result=$localobject->isInEEC(); + print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n"; + $this->assertTrue($result); + */ $localobject->info($localobject->id); print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";