Tax #2373 : add unit test

This commit is contained in:
sparkyx 2024-07-29 17:12:57 +02:00
parent 707e1144ca
commit cede8af916

View file

@ -0,0 +1,60 @@
<?php
/*
* * Copyright (C) 2022 Dany De Bontridder <dany@alchimerys.be>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
* Author : Dany De Bontridder danydb@noalyss.eu $(DATE)
*/
/**
* @file
* @brief noalyss
*/
use PHPUnit\Framework\TestCase;
require DIRTEST . '/global.php';
/**
* @testdox Class taxDetailTest.php : used for ...
* @backupGlobals enabled
* @coversDefaultClass
*/
class tax_Detail_Test extends TestCase
{
/**
* @testdox check get_data
* @covers Tax_Detail::get_data
* @backupGlobals enabled
*/
function testGetData()
{
global $cn;
$cn=Dossier::connect();
$tax_detail=new \Tax_Detail(1, '01.01.2020', '31.12.2020',2);
$data=$tax_detail->get_data();
$this->assertEquals(9, count($data));
$sum=0;
foreach ($data as $item) $sum+=$item['vat_amount'];
$this->assertEquals(107.88, $sum);
}
}