PHPUNIT : adapt 12.3
This commit is contained in:
parent
9ebb89b38a
commit
8dca7f0866
32 changed files with 123 additions and 345 deletions
|
|
@ -251,7 +251,7 @@ class Document
|
|||
{
|
||||
if (mkdir($temp_dir)==false)
|
||||
{
|
||||
$msg=sprintf("D221."._("Ne peut pas créer le répertoire %s", $temp_dir));
|
||||
$msg=sprintf("D221."._("Ne peut pas créer le répertoire %s"), $temp_dir);
|
||||
record_log("D221".$msg);
|
||||
throw new Exception($msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass \Acc_Payment
|
||||
|
|
@ -84,7 +84,7 @@ class Acc_TVATest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
function dataCheck() {
|
||||
static function dataCheck() {
|
||||
return array(
|
||||
['abc',true]
|
||||
,['13A',true]
|
||||
|
|
@ -100,6 +100,7 @@ class Acc_TVATest extends TestCase
|
|||
* @dataProvider dataCheck
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('dataCheck')]
|
||||
function testCheck($tva_code,$result)
|
||||
{
|
||||
$cn=\Dossier::connect();
|
||||
|
|
@ -117,7 +118,7 @@ class Acc_TVATest extends TestCase
|
|||
$this->assertTrue($result==$check," erreur pour $tva_code ");
|
||||
$this->display_error($tva_rate_mtable);
|
||||
}
|
||||
function dataBuild() {
|
||||
static function dataBuild() {
|
||||
return array(
|
||||
['0A',4]
|
||||
,['0B',6]
|
||||
|
|
@ -133,6 +134,7 @@ class Acc_TVATest extends TestCase
|
|||
* @dataProvider dataBuild
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('dataBuild')]
|
||||
function testBuild($tva_code,$result)
|
||||
{
|
||||
$cn=\Dossier::connect();
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ class AccountRepositoryTest extends TestCase {
|
|||
$db->close();
|
||||
$this->assertEquals(11, $nb_table, " number of table incorrect $nb_table");
|
||||
} catch (\Exception $ex) {
|
||||
$db->close();
|
||||
|
||||
echo $ex->getMessage();
|
||||
echo $ex->getTraceAsString();
|
||||
$this->assertTrue(false, __CLASS__ . " cannot create DB");
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ use PHPUnit\Framework\TestCase;
|
|||
*/
|
||||
require DIRTEST . '/global.php';
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
/**
|
||||
* @backupGlobals disabled
|
||||
*/
|
||||
|
|
@ -251,10 +253,10 @@ class DocumentTest extends TestCase {
|
|||
$document->d_id = $d_id;
|
||||
$document->get();
|
||||
}
|
||||
return $document;
|
||||
return $document;
|
||||
}
|
||||
|
||||
function dataReplace() {
|
||||
static function dataReplace() {
|
||||
return array(
|
||||
["CUST_NAME", "Client 2"],
|
||||
["SOLDE", 27.29],
|
||||
|
|
@ -270,6 +272,7 @@ class DocumentTest extends TestCase {
|
|||
* @backupGlobals enabled
|
||||
* @dataProvider dataReplace
|
||||
*/
|
||||
#[DataProvider('dataReplace')]
|
||||
function testReplace2($tag_name, $value) {
|
||||
require "global.php";
|
||||
static $request = null;
|
||||
|
|
@ -288,7 +291,7 @@ class DocumentTest extends TestCase {
|
|||
$this->assertEquals($name, $value, $tag_name." fails");
|
||||
}
|
||||
|
||||
function dataBalance()
|
||||
static function dataBalance()
|
||||
{
|
||||
return array(
|
||||
['CLIENT1',27.29, 4204.14],
|
||||
|
|
@ -301,6 +304,7 @@ class DocumentTest extends TestCase {
|
|||
|
||||
* @dataProvider dataBalance
|
||||
*/
|
||||
#[DataProvider('dataBalance')]
|
||||
function testBalance($quickcode,$balance_report,$balance_noreport)
|
||||
{
|
||||
require "global.php";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
define('USE_ID', 999999);
|
||||
define('USE_FIRST_NAME', 'Unit test');
|
||||
define('USE_NAME', 'UNIT');
|
||||
|
|
@ -187,7 +187,7 @@ class NoalyssUserTest extends TestCase
|
|||
// check his removal
|
||||
$this->assertEquals($cn->get_value('select count(*) from profile_user where user_name=$1',array('unknown/user')),0);
|
||||
}
|
||||
public function dataPeriode()
|
||||
public static function dataPeriode()
|
||||
{
|
||||
return array(
|
||||
[92],
|
||||
|
|
@ -204,6 +204,7 @@ class NoalyssUserTest extends TestCase
|
|||
* @param type $p_id periode id
|
||||
* @dataProvider dataPeriode
|
||||
*/
|
||||
#[DataProvider('dataPeriode')]
|
||||
public function testPeriode($p_id)
|
||||
{
|
||||
$this->object=new Noalyss_user(Dossier::connect(), USE_ID);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2017-11-26 at 11:24:04.
|
||||
*/
|
||||
|
|
@ -234,7 +234,7 @@ class Acc_AccountTest extends TestCase
|
|||
$result=$this->object->find_parent();
|
||||
$this->assertEquals($result,700);
|
||||
}
|
||||
public function dataFormatAccount()
|
||||
public static function dataFormatAccount()
|
||||
{
|
||||
return array(
|
||||
['60élépànç%','60ELEPANC'],
|
||||
|
|
@ -253,6 +253,7 @@ class Acc_AccountTest extends TestCase
|
|||
* @param string $p_result
|
||||
* @dataProvider dataFormatAccount
|
||||
*/
|
||||
#[DataProvider('dataFormatAccount')]
|
||||
public function testFormatAccount($param,$p_result)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-10-31 at 20:33:22.
|
||||
*
|
||||
|
|
@ -51,7 +51,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
/**
|
||||
* @return array : idx [ $accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred]
|
||||
*/
|
||||
public function dataGet_row_date()
|
||||
public static function dataGet_row_date()
|
||||
{
|
||||
$array=array(
|
||||
['55000004','01.01.2019','31.12.2019',4,0,806.90]
|
||||
|
|
@ -66,6 +66,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_row_date
|
||||
* @dataProvider dataGet_row_date
|
||||
*/
|
||||
#[DataProvider('dataGet_row_date')]
|
||||
public function testGetRowData($accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -289,7 +290,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
$this->assertEquals($expected, $a_array);
|
||||
}
|
||||
|
||||
function dataGet_Name()
|
||||
static function dataGet_Name()
|
||||
{
|
||||
return array(
|
||||
array('10', 'Capital '),
|
||||
|
|
@ -301,6 +302,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_name
|
||||
* @dataProvider dataGet_Name
|
||||
*/
|
||||
#[DataProvider('dataGet_Name')]
|
||||
public function testGet_name($id, $result)
|
||||
{
|
||||
$this->object->id=$id;
|
||||
|
|
@ -311,13 +313,14 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::do_exist
|
||||
* @dataProvider dataDo_exist
|
||||
*/
|
||||
#[DataProvider('dataDo_exist')]
|
||||
public function testDo_exist($p_value, $result)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$this->assertEquals($this->object->do_exist(), $result);
|
||||
}
|
||||
|
||||
function dataDo_exist()
|
||||
static function dataDo_exist()
|
||||
{
|
||||
return array(
|
||||
array('400', 1),
|
||||
|
|
@ -380,7 +383,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
$this->assertTrue(true, 'Ne peut être testé car vue HTML');
|
||||
}
|
||||
|
||||
public function dataGet_amount_side()
|
||||
public static function dataGet_amount_side()
|
||||
{
|
||||
return array(
|
||||
array(0, "="),
|
||||
|
|
@ -393,6 +396,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_amount_side
|
||||
* @dataProvider dataGet_amount_side
|
||||
*/
|
||||
#[DataProvider('dataGet_amount_side')]
|
||||
public function testGet_amount_side($amount, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->get_amount_side($amount), $result);
|
||||
|
|
@ -404,12 +408,13 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::belong_ledger
|
||||
* @dataProvider DataBelong_ledger
|
||||
*/
|
||||
#[DataProvider('DataBelong_ledger')]
|
||||
public function testBelong_ledger($p_jrn, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->belong_ledger($p_jrn), $result);
|
||||
}
|
||||
|
||||
function DataBelong_ledger()
|
||||
static function DataBelong_ledger()
|
||||
{
|
||||
return array(
|
||||
array(-1, 0),
|
||||
|
|
@ -420,7 +425,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function dataGet_account_ledger()
|
||||
public static function dataGet_account_ledger()
|
||||
{
|
||||
return array(
|
||||
array(0, array()),
|
||||
|
|
@ -435,6 +440,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_account_ledger
|
||||
* @dataProvider dataGet_account_ledger
|
||||
*/
|
||||
#[DataProvider('dataGet_account_ledger')]
|
||||
public function testGet_account_ledger($p_jrn, $result)
|
||||
{
|
||||
$this->assertEquals($this->object->get_account_ledger($p_jrn), $result);
|
||||
|
|
@ -444,13 +450,14 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::build_sql_account
|
||||
* @dataProvider DataBuild_Sql_account
|
||||
*/
|
||||
#[DataProvider('DataBuild_Sql_account')]
|
||||
public function testBuild_sql_account($p_jrn, $result)
|
||||
{
|
||||
$value=$this->object->build_sql_account($p_jrn);
|
||||
$this->assertEquals(trim($value), $result);
|
||||
}
|
||||
|
||||
public function DataBuild_Sql_account()
|
||||
public static function DataBuild_Sql_account()
|
||||
{
|
||||
return array(
|
||||
array(0, ""),
|
||||
|
|
@ -461,7 +468,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
function dataFind_Card()
|
||||
static function dataFind_Card()
|
||||
{
|
||||
return array(
|
||||
array('6191', '27'),
|
||||
|
|
@ -475,13 +482,14 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @todo Implement testFind_card().
|
||||
* @dataProvider dataFind_Card()
|
||||
*/
|
||||
#[DataProvider('dataFind_Card')]
|
||||
public function testFind_card($p_value, $p_card)
|
||||
{
|
||||
$this->object->id=$p_value;
|
||||
$result=$this->object->find_card();
|
||||
$this->assertEquals($p_card, $result[0]['f_id']);
|
||||
}
|
||||
public function dataGet_used_accounting()
|
||||
public static function dataGet_used_accounting()
|
||||
{
|
||||
$array=array(
|
||||
["01.01.2020","31.12.2020",5,7,4]
|
||||
|
|
@ -500,6 +508,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_used_accounting
|
||||
* @dataProvider dataGet_used_accounting
|
||||
*/
|
||||
#[DataProvider('dataGet_used_accounting')]
|
||||
public function testGet_UsedAcccounting($from_date,$to_date,$from_accounting,$to_accounting,$nb_accounting)
|
||||
{
|
||||
$a_result=Acc_Account_Ledger::get_used_accounting(from_date:$from_date
|
||||
|
|
@ -514,7 +523,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
/**
|
||||
* @return array : idx [ $accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred]
|
||||
*/
|
||||
public function dataRowNotLettered()
|
||||
public static function dataRowNotLettered()
|
||||
{
|
||||
$array=array(
|
||||
['4400005','01.01.2019','31.12.2019',9,0,954.10]
|
||||
|
|
@ -527,6 +536,7 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
* @covers Acc_Account_Ledger::get_row_date
|
||||
* @dataProvider dataRowNotLettered
|
||||
*/
|
||||
#[DataProvider('dataRowNotLettered')]
|
||||
public function testGetRowDataNotLetted($accounting,$from_date,$to_date,$nb_row,$tot_deb,$tot_cred)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-10-31 at 20:33:23.
|
||||
*/
|
||||
|
|
@ -29,7 +29,7 @@ class Acc_ComputeTest extends TestCase
|
|||
{
|
||||
|
||||
}
|
||||
public function dataGet_parameter()
|
||||
public static function dataGet_parameter()
|
||||
{
|
||||
return array( array('amount'),
|
||||
array('amount_vat'),
|
||||
|
|
@ -51,6 +51,7 @@ class Acc_ComputeTest extends TestCase
|
|||
* @todo Implement testGet_parameter().
|
||||
* @dataProvider dataGet_parameter
|
||||
*/
|
||||
#[DataProvider('dataGet_parameter')]
|
||||
public function testGet_parameter($data)
|
||||
{
|
||||
$result=$data;
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ class Acc_LedgerTest extends TestCase
|
|||
{
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectException(\Exception::class);
|
||||
$array=[
|
||||
"p_jrn"=>"15",
|
||||
"p_jrn_deb_max_line"=>5,
|
||||
|
|
|
|||
|
|
@ -1,123 +0,0 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_history_purchaseTest.class
|
||||
*/
|
||||
class Acc_Ledger_History_PurchaseTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp():void
|
||||
{
|
||||
include DIRTEST.'/global.php';
|
||||
global $g_connection;
|
||||
$this->object=new Acc_Ledger_History_Purchase($g_connection, [3], 92, 131, 'L');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown():void
|
||||
{
|
||||
|
||||
}
|
||||
private function save_file($p_name,$content)
|
||||
{
|
||||
$hFile=fopen(__DIR__."/file/".$p_name,"w+");
|
||||
fwrite($hFile, $content);
|
||||
fclose($hFile);
|
||||
}
|
||||
//@covers Acc_Ledger_History_Financial::get_row , Acc_Ledger_History_Financial::get_data
|
||||
function testGet_Row()
|
||||
{
|
||||
$this->object->get_row();
|
||||
$this->assertEquals(16,count($this->object->get_data()),"Acc_Ledger_History_Purchase->get_data");
|
||||
|
||||
}
|
||||
//@covers Acc_Ledger_History_Financial::export_oneline_html
|
||||
function testExport_Oneline_Html()
|
||||
{
|
||||
//- Listing
|
||||
$name="acc_ledger_history_purchase_export_listing.html";
|
||||
$this->object->set_m_mode("L");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Extended
|
||||
$name="acc_ledger_history_purchase_export_extended.html";
|
||||
$this->object->set_m_mode("E");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Detail
|
||||
$name="acc_ledger_history_purchase_export_detail.html";
|
||||
$this->object->set_m_mode("D");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Accounting
|
||||
$name="acc_ledger_history_purchase_export_accounting.html";
|
||||
$this->object->set_m_mode("D");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'ACH');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne Acc_Ledger_History_SaleTest.class
|
||||
*/
|
||||
class Acc_Ledger_History_SaleTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp():void
|
||||
{
|
||||
include 'global.php';
|
||||
global $g_connection;
|
||||
$this->object=new Acc_Ledger_History_Sale($g_connection,[2],92,131,'L');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown():void
|
||||
{
|
||||
|
||||
}
|
||||
function testGet_row()
|
||||
{
|
||||
$this->object->get_row();
|
||||
$this->assertEquals(6,count($this->object->get_data()),"Acc_Ledger_History_Sale->get_row");
|
||||
}
|
||||
private function save_file($p_name,$content)
|
||||
{
|
||||
$hFile=fopen(__DIR__."/file/".$p_name,"w+");
|
||||
fwrite($hFile, $content);
|
||||
fclose($hFile);
|
||||
}
|
||||
//@covers Acc_Ledger_History_Sale::export_oneline_html
|
||||
function testExport_Oneline_Html()
|
||||
{
|
||||
//- Listing
|
||||
$name="acc_ledger_history_sale_export_listing.html";
|
||||
$this->object->set_m_mode("L");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Extended
|
||||
$name="acc_ledger_history_sale_export_extended.html";
|
||||
$this->object->set_m_mode("E");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Detail
|
||||
$name="acc_ledger_history_sale_export_detail.html";
|
||||
$this->object->set_m_mode("D");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
//- Accounting
|
||||
$name="acc_ledger_history_sale_export_accounting.html";
|
||||
$this->object->set_m_mode("D");
|
||||
ob_start();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_History::get_ledger_type
|
||||
*/
|
||||
|
||||
function testGet_Ledger_type()
|
||||
{
|
||||
$this->assertEquals($this->object->get_ledger_type(),'VEN');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass Acc_Ledger_Purchase
|
||||
|
|
@ -431,7 +431,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
// check that all card has these attributes
|
||||
|
||||
}
|
||||
public function data_no_deductible()
|
||||
public static function data_no_deductible()
|
||||
{
|
||||
$aValue=array(
|
||||
[ ATTR_DEF_DEPENSE_NON_DEDUCTIBLE, 33.33 ,'qp_nd_amount',201.28,ATTR_DEF_ACCOUNT_ND_PERSO,'4890'],
|
||||
|
|
@ -454,6 +454,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
* @parameter $p_amount float the corresponding column in quant_purchase
|
||||
* @parameter $p_accounting string is the accounting counterpart for this not deductible fee($p_counterpart)
|
||||
*/
|
||||
#[DataProvider('data_no_deductible')]
|
||||
public function testInsertPurchase_No_Ded($p_attribut , $p_value,$p_column,$p_amount,$p_counterpart,$p_accounting)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -507,6 +508,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
* @parameter $p_amount float the corresponding column in quant_purchase
|
||||
* @parameter $p_accounting string is the accounting counterpart for this not deductible fee($p_counterpart)
|
||||
*/
|
||||
#[DataProvider('data_no_deductible')]
|
||||
public function testInsertPurchase_No_Ded_reverse($p_attribut , $p_value,$p_column,$p_amount,$p_counterpart,$p_accounting)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@
|
|||
* @brief
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
require DIRTEST.'/global.php';
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class Acc_LetterTest extends TestCase
|
||||
{
|
||||
|
|
@ -68,14 +69,7 @@ class Acc_LetterTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test method is executed.
|
||||
*/
|
||||
protected function tearDown():void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the setUpBeforeClass():void template methods is called before the first test of the test case
|
||||
|
|
@ -87,15 +81,8 @@ class Acc_LetterTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDownAfterClass():void template methods is calleafter the last test of the test case class is run,
|
||||
*
|
||||
*/
|
||||
static function tearDownAfterClass():void
|
||||
{
|
||||
// include 'global.php';
|
||||
}
|
||||
public function dataget_Letter()
|
||||
|
||||
public static function dataget_Letter()
|
||||
{
|
||||
return array([22,577],[26,343]);
|
||||
}
|
||||
|
|
@ -105,6 +92,7 @@ class Acc_LetterTest extends TestCase
|
|||
* @covers Lettering_Card::get_letter
|
||||
* @dataProvider dataget_Letter
|
||||
*/
|
||||
#[DataProvider('dataget_Letter')]
|
||||
public function testget_letterAccount($p_fiche_id,$p_jrnx_id)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -156,6 +144,7 @@ class Acc_LetterTest extends TestCase
|
|||
* @covers Lettering_Card::get_letter
|
||||
* @dataProvider dataget_Letter
|
||||
*/
|
||||
#[DataProvider('dataget_Letter')]
|
||||
public function testget_letterCard($p_fiche_id,$p_jrnx_id)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -197,7 +186,7 @@ class Acc_LetterTest extends TestCase
|
|||
$g_connection->exec_sql("update jrnx set j_montant =$2 where j_id=$1 ",[$p_jrnx_id,$restore]);
|
||||
|
||||
}
|
||||
public function dataDateLimit()
|
||||
public static function dataDateLimit()
|
||||
{
|
||||
return array(
|
||||
[100,'01.01.2018','31.12.2018'],
|
||||
|
|
@ -211,6 +200,7 @@ class Acc_LetterTest extends TestCase
|
|||
* @param type $p_id
|
||||
* @dataProvider dataDateLimit
|
||||
*/
|
||||
#[DataProvider('dataDateLimit')]
|
||||
public function testDateLimitComputed($p_periode_id,$p_first_day,$p_last_day)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -239,6 +229,7 @@ class Acc_LetterTest extends TestCase
|
|||
* @param type $p_id
|
||||
* @dataProvider dataDateLimit
|
||||
*/
|
||||
#[DataProvider('dataDateLimit')]
|
||||
public function testDateLimitGiven($p_periode_id,$p_first_day,$p_last_day)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-13 at 00:41:50.
|
||||
* @backupGlobals enabled
|
||||
|
|
@ -93,7 +94,7 @@ class Acc_OperationTest extends TestCase
|
|||
* provide data for testAmount_Currency
|
||||
* @return type
|
||||
*/
|
||||
public function data_amount_currency()
|
||||
public static function data_amount_currency()
|
||||
{
|
||||
return array(
|
||||
/* sale */
|
||||
|
|
@ -118,6 +119,7 @@ class Acc_OperationTest extends TestCase
|
|||
* @covers Acc_Operation::get_amount_currency
|
||||
* @dataProvider data_amount_currency
|
||||
*/
|
||||
#[DataProvider('data_amount_currency')]
|
||||
function testGet_AmountCurrency($p_jrn_id,$p_amount_currency)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@
|
|||
* @brief
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass \Acc_Payment
|
||||
*/
|
||||
require DIRTEST.'/global.php';
|
||||
|
||||
class AccPaymentTest extends TestCase
|
||||
class Acc_PaymentTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +51,7 @@ class AccPaymentTest extends TestCase
|
|||
include 'global.php';
|
||||
}
|
||||
|
||||
public function dataLoad()
|
||||
public static function dataLoad()
|
||||
{
|
||||
$a_json=array();
|
||||
$a_json[0]=['{
|
||||
|
|
@ -105,6 +105,7 @@ class AccPaymentTest extends TestCase
|
|||
* @param json $json
|
||||
* @covers ::load ::get_parameter
|
||||
*/
|
||||
#[DataProvider('dataLoad')]
|
||||
public function testLoad($json)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -128,6 +129,7 @@ class AccPaymentTest extends TestCase
|
|||
* @param json $json
|
||||
* @covers ::from_array ::get_parameter
|
||||
*/
|
||||
#[DataProvider('dataLoad')]
|
||||
public function testFromArray($json)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
* @brief Test Anc_Group
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass \Anc_Group
|
||||
|
|
@ -82,7 +82,7 @@ class Anc_GroupTest extends TestCase
|
|||
$g_connection->exec_sql("delete from plan_analytique where pa_id>1");
|
||||
}
|
||||
|
||||
public function datasqlStmt()
|
||||
public static function datasqlStmt()
|
||||
{
|
||||
return array([1,"Group 1",1],
|
||||
[2,"Group 2",1],
|
||||
|
|
@ -98,6 +98,7 @@ class Anc_GroupTest extends TestCase
|
|||
* @param type $p_param
|
||||
* @covers
|
||||
*/
|
||||
#[DataProvider('datasqlStmt')]
|
||||
public function test_sqlStmt($p_ga_id,$pga_description,$ppa_id)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase;
|
|||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-08 at 14:23:52.
|
||||
*/
|
||||
class Anc_Key_Detail_SQLTest extends TestCase
|
||||
class Anc_Key_SQLTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2014-11-07 at 23:05:36.
|
||||
* @backupGlobals enabled
|
||||
|
|
@ -16,12 +16,7 @@ class FicheTest extends TestCase
|
|||
*/
|
||||
protected $object;
|
||||
private $g_connection;
|
||||
function __construct($name = null, array $data = [], $dataName = '')
|
||||
{
|
||||
|
||||
parent::__construct($name, $data, $dataName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
|
|
@ -311,7 +306,7 @@ class FicheTest extends TestCase
|
|||
$this->assertEquals($nb_fiche, $nb_fiche_after, 'card not removed');
|
||||
}
|
||||
|
||||
public function dataEmptyQuickCode()
|
||||
public static function dataEmptyQuickCode()
|
||||
{
|
||||
return array(
|
||||
array("none", ""),
|
||||
|
|
@ -328,6 +323,7 @@ class FicheTest extends TestCase
|
|||
* @testdox testInsertEmptyQuickCode Test if it is possible to insert an empty quickcode
|
||||
* @dataProvider dataEmptyQuickCode
|
||||
*/
|
||||
#[DataProvider('dataEmptyQuickCode')]
|
||||
public function testInsertEmptyQuickCode($name, $quick_code)
|
||||
{
|
||||
//insert
|
||||
|
|
@ -338,7 +334,7 @@ class FicheTest extends TestCase
|
|||
$fiche->remove();
|
||||
|
||||
}
|
||||
function dataUpdateQuickCode()
|
||||
static function dataUpdateQuickCode()
|
||||
{
|
||||
return array(
|
||||
array('a+z+1-5', 'AZ1-5'),
|
||||
|
|
@ -358,6 +354,7 @@ class FicheTest extends TestCase
|
|||
* @testdox testUpdateEmptyQuickCode Test if it is possible to update an empty quickcode
|
||||
* @dataProvider dataUpdateQuickCode
|
||||
*/
|
||||
#[DataProvider('dataUpdateQuickCode')]
|
||||
public function testUpdateEmptyQuickCode($name, $quick_code)
|
||||
{
|
||||
$aCardId=[];
|
||||
|
|
@ -439,7 +436,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
function dataFormat_QuickCode()
|
||||
static function dataFormat_QuickCode()
|
||||
{
|
||||
return array(
|
||||
array('a+z+1-5','AZ1-5'),
|
||||
|
|
@ -458,12 +455,13 @@ where
|
|||
* @testdox test comptaproc.format_quickcode
|
||||
* @dataProvider dataFormat_Quickcode
|
||||
*/
|
||||
#[DataProvider('dataFormat_Quickcode')]
|
||||
public function testFormat_QuickCode($p_qcode,$p_result)
|
||||
{
|
||||
$this->assertEquals($p_result,$this->g_connection->get_value( "select comptaproc.format_quickcode($1)",
|
||||
[$p_result]),'quickcode is not transformed correctly');
|
||||
}
|
||||
function dataInsertName()
|
||||
static function dataInsertName()
|
||||
{
|
||||
return array(
|
||||
['',"Nom vide"],
|
||||
|
|
@ -475,6 +473,7 @@ where
|
|||
* @testdox Test if it is possible to insert an empty name
|
||||
* @dataProvider dataInsertName
|
||||
*/
|
||||
#[DataProvider('dataInsertName')]
|
||||
public function testInsertName($p_name,$p_result)
|
||||
{
|
||||
|
||||
|
|
@ -490,6 +489,7 @@ where
|
|||
* @testdox Test if it is possible to insert or update a empty name
|
||||
* @dataProvider dataInsertName
|
||||
*/
|
||||
#[DataProvider('dataInsertName')]
|
||||
public function testUpdateName($p_name,$p_result)
|
||||
{
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ where
|
|||
$this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created');
|
||||
}
|
||||
}
|
||||
public function dataAccount()
|
||||
public static function dataAccount()
|
||||
{
|
||||
return array(
|
||||
['600002','600002'],
|
||||
|
|
@ -626,6 +626,7 @@ where
|
|||
* @testdox testAccountInsert Set of the accounting while inserting, numeric with automatic
|
||||
* @dataProvider dataAccount
|
||||
*/
|
||||
#[DataProvider('dataAccount')]
|
||||
public function testAccountInsert($p_value,$p_expected)
|
||||
{
|
||||
$fiche=$this->build_fiche(2, 'PHPUNIT.ACCOUNT.INSERT');
|
||||
|
|
@ -697,6 +698,7 @@ where
|
|||
* @testdox testAccountUpdate et of the accounting while updating
|
||||
* @dataProvider dataAccount
|
||||
*/
|
||||
#[DataProvider('dataAccount')]
|
||||
public function testAccountUpdate($p_value,$p_expected)
|
||||
{
|
||||
$this->g_connection->exec_sql("update public.parameter set pr_value = $1 where pr_id=$2",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use PHPUnit\Framework\TestCase;
|
|||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class Follow_Up_DetailTest extends TestCase
|
||||
class FollowUp_DetailTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
|
|
@ -43,31 +43,22 @@ class ImpressTest extends TestCase
|
|||
{
|
||||
include 'global.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown():void
|
||||
{
|
||||
|
||||
}
|
||||
private function setData()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
include 'global.php';
|
||||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from operation_analytique where oa_id > 48 and oa_id < 57");
|
||||
$sql="INSERT INTO operation_analytique
|
||||
$sql="INSERT INTO operation_analytique
|
||||
(oa_id,po_id,oa_amount,oa_description,oa_debit,j_id,oa_date,oa_row,oa_jrnx_id_source,oa_positive,f_id)
|
||||
VALUES
|
||||
(49,3,90.0000,'',true,18,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(50,4,93.0000,'',true,18,'2018-02-24',1,NULL,'Y',NULL),
|
||||
(51,3,10.0000,'Déplacement',false,4,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(52,1,30.0000,'Déplacement',false,4,'2018-02-24',1,NULL,'Y',NULL),
|
||||
(53,3,25.0000,'Vente de marchandises',false,7,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(54,3,91.0000,'Eau',true,371,'2018-04-24',0,NULL,'Y',NULL),
|
||||
(55,3,80.0000,'Eau',true,371,'2018-04-24',1,NULL,'Y',NULL)";
|
||||
(49,3,90.0000,'',true,18,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(50,4,93.0000,'',true,18,'2018-02-24',1,NULL,'Y',NULL),
|
||||
(51,3,10.0000,'Déplacement',false,4,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(52,1,30.0000,'Déplacement',false,4,'2018-02-24',1,NULL,'Y',NULL),
|
||||
(53,3,25.0000,'Vente de marchandises',false,7,'2018-02-24',0,NULL,'Y',NULL),
|
||||
(54,3,91.0000,'Eau',true,371,'2018-04-24',0,NULL,'Y',NULL),
|
||||
(55,3,80.0000,'Eau',true,371,'2018-04-24',1,NULL,'Y',NULL)";
|
||||
$g_connection->exec_sql($sql);
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
|
@ -154,6 +145,7 @@ class ImpressTest extends TestCase
|
|||
* @covers Impress::parse_formula
|
||||
* @dataProvider getData_compute_amount
|
||||
*/
|
||||
#[DataProvider('getData_compute_amount')]
|
||||
function test_compute_amount($p_accounting,$p_amount)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -224,7 +216,6 @@ class ImpressTest extends TestCase
|
|||
function test_parse_formula()
|
||||
{
|
||||
global $g_connection,$g_user;
|
||||
$this->setData();
|
||||
$a_formula=array(
|
||||
0=>array("sum 70% (credit is negative)", "[70%-s]",-456.80),
|
||||
1=>array("sum 70% (debit is negative)", "0-round([70%-s],2)",456.80),
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
* @brief
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
|
|
@ -77,7 +77,7 @@ class PeriodeTest extends TestCase
|
|||
// include 'global.php';
|
||||
}
|
||||
|
||||
public function dataInsert()
|
||||
public static function dataInsert()
|
||||
{
|
||||
return array(
|
||||
[ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'],
|
||||
|
|
@ -95,6 +95,7 @@ class PeriodeTest extends TestCase
|
|||
* @param type $p_param
|
||||
* @covers
|
||||
*/
|
||||
#[DataProvider('dataInsert')]
|
||||
public function testInsert($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status)
|
||||
{
|
||||
global $g_connection;
|
||||
|
|
@ -126,7 +127,7 @@ class PeriodeTest extends TestCase
|
|||
}
|
||||
$g_connection->exec_sql("delete from parm_periode where p_id > 144");
|
||||
}
|
||||
public function dataUpdate()
|
||||
public static function dataUpdate()
|
||||
{
|
||||
return array(
|
||||
[ '01.01.2023' , '31.01.2023','2023','2020.2023','OK'],
|
||||
|
|
@ -141,6 +142,7 @@ class PeriodeTest extends TestCase
|
|||
*
|
||||
*
|
||||
*/
|
||||
#[DataProvider('dataUpdate')]
|
||||
public function testUpdate($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status)
|
||||
{
|
||||
|
||||
|
|
@ -183,7 +185,7 @@ class PeriodeTest extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public function dataUpdateException()
|
||||
public static function dataUpdateException()
|
||||
{
|
||||
return array(
|
||||
[ '01.01.2023' , '31.01.2023','2020','2020.2023','NOK'],
|
||||
|
|
@ -199,6 +201,7 @@ class PeriodeTest extends TestCase
|
|||
*
|
||||
*
|
||||
*/
|
||||
#[DataProvider('dataUpdateException')]
|
||||
public function testUpdateException($p_start,$p_end,$p_exercice,$p_exercice_label,$p_status)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
class Ac_CommonTest extends TestCase
|
||||
{
|
||||
|
|
@ -207,7 +208,7 @@ class Ac_CommonTest extends TestCase
|
|||
/**
|
||||
* provides data to testIsDate
|
||||
*/
|
||||
function dataIsDate()
|
||||
static function dataIsDate():array
|
||||
{
|
||||
return array(
|
||||
['01.01.1992',1],
|
||||
|
|
@ -221,12 +222,13 @@ class Ac_CommonTest extends TestCase
|
|||
* @testdox isDate
|
||||
* @dataProvider dataIsDate
|
||||
*/
|
||||
function testIsDate($p_date,$expected)
|
||||
#[DataProvider('dataIsDate')]
|
||||
function testIsDate(string $p_date,int $expected)
|
||||
{
|
||||
$return=($expected==1)?$p_date:null;
|
||||
$this->assertEquals(isDate($p_date),$return,"Test $p_date");
|
||||
}
|
||||
function dataCompareDate ()
|
||||
static function dataCompareDate ():array
|
||||
{
|
||||
return array(
|
||||
['01.01.1992','05.02.2001',-1],
|
||||
|
|
@ -238,6 +240,7 @@ class Ac_CommonTest extends TestCase
|
|||
* @testDox test cmpDate
|
||||
* @dataProvider dataCompareDate
|
||||
*/
|
||||
#[DataProvider('dataCompareDate')]
|
||||
function testCompareDate($p_date,$p_date_2,$p_result)
|
||||
{
|
||||
$cmp=cmpDate($p_date,$p_date_2);
|
||||
|
|
@ -266,7 +269,7 @@ class Ac_CommonTest extends TestCase
|
|||
$this->assertEquals("<&",h("<&"));
|
||||
$this->assertEquals(0,h("0"));
|
||||
}
|
||||
function dataFormat_Date()
|
||||
static function dataFormat_Date()
|
||||
{
|
||||
return array(
|
||||
["01.05.2000","DD.MM.YYYY","DD.MM.YY",'01.05.00'],
|
||||
|
|
@ -287,6 +290,7 @@ class Ac_CommonTest extends TestCase
|
|||
* @throws Exception
|
||||
* @dataProvider dataFormat_date
|
||||
*/
|
||||
#[DataProvider('dataFormat_date')]
|
||||
function testFormatDate($p_date,$p_from,$p_to,$p_result)
|
||||
{
|
||||
$this->assertEquals($p_result,format_date($p_date,$p_from,$p_to));
|
||||
|
|
@ -305,7 +309,7 @@ class Ac_CommonTest extends TestCase
|
|||
$this->assertEquals("l''éléphant",Database::escape_string("l'éléphant"));
|
||||
$this->assertEquals("l\''éléphant",Database::escape_string("l\'éléphant"));
|
||||
}
|
||||
function dataNoalyss_trim()
|
||||
static function dataNoalyss_trim()
|
||||
{
|
||||
return array(["0","0"],
|
||||
[" 0 1 1 1 ","0 1 1 1"],
|
||||
|
|
@ -320,11 +324,12 @@ class Ac_CommonTest extends TestCase
|
|||
* @return void
|
||||
* @dataProvider dataNoalyss_trim
|
||||
*/
|
||||
#[DataProvider('dataNoalyss_trim')]
|
||||
function testNoalyss_trim($param,$result)
|
||||
{
|
||||
$this->assertEquals($result,noalyss_trim($param));
|
||||
}
|
||||
function dataNoalyss_replace() {
|
||||
static function dataNoalyss_replace() {
|
||||
return array(["0","/","0A0A","/A/A"],
|
||||
["A","*","0A0A","0*0*"],
|
||||
["0","/",null,""],
|
||||
|
|
@ -336,11 +341,12 @@ class Ac_CommonTest extends TestCase
|
|||
* @brief Comptability PHP 8.1 , null is not consider as an empty string
|
||||
* @dataProvider dataNoalyss_replace
|
||||
*/
|
||||
#[DataProvider('dataNoalyss_replace')]
|
||||
function testNoalyss_replace($search,$replace,$string,$expected)
|
||||
{
|
||||
$this->assertEquals($expected,noalyss_str_replace($search,$replace,$string));
|
||||
}
|
||||
function dataNoalyss_bcsub() {
|
||||
static function dataNoalyss_bcsub() {
|
||||
return array(
|
||||
[1,2,-1],
|
||||
[0,2,-2],
|
||||
|
|
@ -353,11 +359,12 @@ class Ac_CommonTest extends TestCase
|
|||
* @brief Comptability PHP 8.1 , null is not consider as an empty string
|
||||
* @dataProvider dataNoalyss_bcsub
|
||||
*/
|
||||
#[DataProvider('dataNoalyss_bcsub')]
|
||||
function testNoalyss_bcsub($numbera,$numberb,$expected)
|
||||
{
|
||||
$this->assertEquals($expected,noalyss_bcsub($numbera,$numberb));
|
||||
}
|
||||
function dataNoalyss_strip_tags() {
|
||||
static function dataNoalyss_strip_tags() {
|
||||
return array(
|
||||
[null,""],
|
||||
["",""],
|
||||
|
|
@ -370,6 +377,7 @@ class Ac_CommonTest extends TestCase
|
|||
* @brief Comptability PHP 8.1 , null is not consider as an empty string
|
||||
* @dataProvider dataNoalyss_strip_tags
|
||||
*/
|
||||
#[DataProvider('dataNoalyss_strip_tags')]
|
||||
function testNoalyss_strip_tags($string,$expected)
|
||||
{
|
||||
$this->assertEquals($expected,noalyss_strip_tags($string));
|
||||
|
|
@ -429,7 +437,7 @@ EOF;
|
|||
* supply data for user password
|
||||
* @return array[$password, $weakness] 0 means strong password
|
||||
*/
|
||||
public function dataCheck_password_strength()
|
||||
public static function dataCheck_password_strength()
|
||||
{
|
||||
return array(
|
||||
["AAAAAAA",5]
|
||||
|
|
@ -446,6 +454,7 @@ EOF;
|
|||
* @testDoc test the check_password_strength function
|
||||
* @dataProvider dataCheck_password_strength()
|
||||
*/
|
||||
#[DataProvider('dataCheck_password_strength')]
|
||||
public function testCheck_password_strength($p_password,$p_cnt)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue