code syntax

This commit is contained in:
Frédéric FRANCE
2021-01-14 15:09:08 +01:00
parent 43161be711
commit b1a1cd4be6
83 changed files with 14010 additions and 13774 deletions

View File

@@ -30,8 +30,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/images.lib.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -76,81 +75,81 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase
}
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
print __METHOD__."\n";
}
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
}
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testDolCountNbOfLine
*
* @return int
*/
public function testgetImageSize()
{
/**
* testDolCountNbOfLine
*
* @return int
*/
public function testgetImageSize()
{
$file=dirname(__FILE__).'/img250x50.jpg';
$tmp=dol_getImageSize($file);
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
$this->assertEquals($tmp['width'], 250);
$this->assertEquals($tmp['height'], 50);
$file=dirname(__FILE__).'/img250x20.png';
$tmp=dol_getImageSize($file);
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
$this->assertEquals($tmp['width'], 250);
$this->assertEquals($tmp['height'], 20);
/*$file=dirname(__FILE__).'/filenotfound.png';
$tmp=dol_getImageSize($file);
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
print __METHOD__." result=".$tmp['width'].'/'.$tmp['height']."\n";
$this->assertEquals($tmp['width'],250);
$this->assertEquals($tmp['height'],20);*/
return 1;
}
}
}