Skip to content

Commit

Permalink
Prepare phpunit 6.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 2, 2018
2 parents df721a5 + b9c95a5 commit bd3647a
Show file tree
Hide file tree
Showing 61 changed files with 230 additions and 108 deletions.
4 changes: 3 additions & 1 deletion test/phpunit/BankAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/BonPrelevementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/BuildDocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
6 changes: 4 additions & 2 deletions test/phpunit/CMailFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down Expand Up @@ -103,7 +105,7 @@ protected function setUp()
$db=$this->savdb;

$conf->global->MAIN_DISABLE_ALL_MAILS=1; // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why.

print __METHOD__."\n";
}
/**
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CategorieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
20 changes: 11 additions & 9 deletions test/phpunit/ChargeSocialesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down Expand Up @@ -117,7 +119,7 @@ protected function tearDown()

/**
* testChargeSocialesCreate
*
*
* @return void
*/
public function testChargeSocialesCreate()
Expand All @@ -139,10 +141,10 @@ public function testChargeSocialesCreate()

/**
* testChargeSocialesFetch
*
*
* @param int $id Id of social contribution
* @return void
*
*
* @depends testChargeSocialesCreate
* The depends says test is run only if previous is ok
*/
Expand All @@ -164,10 +166,10 @@ public function testChargeSocialesFetch($id)

/**
* testChargeSocialesValid
*
*
* @param Object $localobject Social contribution
* @return void
*
*
* @depends testChargeSocialesFetch
* The depends says test is run only if previous is ok
*/
Expand All @@ -188,10 +190,10 @@ public function testChargeSocialesValid($localobject)

/**
* testChargeSocialesOther
*
*
* @param Object $localobject Social contribution
* @return void
*
*
* @depends testChargeSocialesValid
* The depends says test is run only if previous is ok
*/
Expand All @@ -216,10 +218,10 @@ public function testChargeSocialesOther($localobject)

/**
* testChargeSocialesDelete
*
*
* @param int $id Social contribution
* @return void
*
*
* @depends testChargeSocialesOther
* The depends says test is run only if previous is ok
*/
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CodingPhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CodingSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CommandeFournisseurTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CommandeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CommonObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/CompanyBankAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/CompanyLibTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class CompanyLibTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class ContactTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down Expand Up @@ -207,7 +209,7 @@ public function testContactUpdate($localobject)
$localobject->email='[email protected]';
$localobject->jabberid='New im id';
$localobject->default_lang='es_ES';

$result=$localobject->update($localobject->id,$user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Contact::update error');
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/ContratTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class ContratTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
12 changes: 7 additions & 5 deletions test/phpunit/CoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class CoreTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down Expand Up @@ -290,22 +292,22 @@ function test_sql_and_script_inject($val, $type)
}

// Run tests

$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=0;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1a');

$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices;badaction';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1b');

$_GET['aaa']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_GET['aaa'], 0);
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 2');

$_POST['bbb']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_POST['bbb'], 2);
$expectedresult=1;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/DateLibTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class DateLibTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/DateLibTzFranceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/DiscountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class DiscountTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/EntrepotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
6 changes: 4 additions & 2 deletions test/phpunit/ExpenseReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class ExpenseReportTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down Expand Up @@ -151,7 +153,7 @@ public function testExpenseReportCreate()
$localobject2->initAsSpecimen(); // Init a speciment with lines
$localobject2->status = 0;
$localobject2->fk_statut = 0;

$result=$localobject2->create($user);
print __METHOD__." result=".$result."\n";
$this->assertGreaterThanOrEqual(0, $result);
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class ExportTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/FactureFournisseurTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/FactureRecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
4 changes: 3 additions & 1 deletion test/phpunit/FactureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class FactureTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
//$this->sharedFixture
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/FactureTestRounding.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/FichinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class FichinterTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
2 changes: 2 additions & 0 deletions test/phpunit/FilesLibTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
*/
function __construct()
{
parent::__construct();

//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
Expand Down
Loading

0 comments on commit bd3647a

Please sign in to comment.