* * 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 * */ /** * @file * @brief */ use PHPUnit\Framework\TestCase; /** * @backupGlobals enabled */ require DIRTEST.'/global.php'; #[\AllowDynamicProperties] class PDF_Anc_Acc_ListTest extends TestCase { /** * @var Fiche */ protected $object; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test method is executed. */ protected function setUp():void { include 'global.php'; } /** * 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 * class is run */ public static function setUpBeforeClass():void { include 'global.php'; // insert data into operation_analytique $sql=<<exec_sql($sql); } /** * tearDownAfterClass():void template methods is calleafter the last test of the test case class is run, * */ static function tearDownAfterClass():void { include 'global.php'; global $g_connection; $g_connection->exec_sql("delete from operation_analytique"); } /** * @brief * @testdox Export to PDF * @param type $p_param * @covers */ public function testPdf_Card() { global $g_connection; // By card $anc_acc_list=new Anc_Acc_List($g_connection); $anc_acc_list->to='31.12.2019'; $anc_acc_list->from='01.01.2019'; $anc_acc_list->pa_id=1; $anc_acc_list->card_poste=1; $pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list); $pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-card-activity.pdf","F"); $filesize=filesize(__DIR__."/file/pdf_anc_acc_list-card-activity.pdf"); $this->assertTrue($filesize >= 77102 && $filesize <= 77289, __DIR__."/file/pdf_anc_acc_list-card-activity.pdf $filesize incorrect"); print __DIR__."/file/pdf_anc_acc_list-card-activity.pdf".PHP_EOL; // By Account / Activity $anc_acc_list=new Anc_Acc_List($g_connection); $anc_acc_list->to='31.12.2019'; $anc_acc_list->from='01.01.2019'; $anc_acc_list->pa_id=1; $anc_acc_list->card_poste=2; $pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list); $pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-account-activity.pdf","F"); $this->assertGreaterThan(77149,filesize(__DIR__."/file/pdf_anc_acc_list-account-activity.pdf"), __DIR__."/file/pdf_anc_acc_list-account-activity.pdf incorrect "); print __DIR__."/file/pdf_anc_acc_list-account-activity.pdf".PHP_EOL; // By Activity / Card $anc_acc_list=new Anc_Acc_List($g_connection); $anc_acc_list->to='31.12.2019'; $anc_acc_list->from='01.01.2019'; $anc_acc_list->pa_id=1; $anc_acc_list->card_poste=3; $pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list); $pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-activity-card.pdf","F"); $this->assertGreaterThan(77600,filesize(__DIR__."/file/pdf_anc_acc_list-activity-card.pdf"), __DIR__."/file/pdf_anc_acc_list-activity-card.pdf incorrect"); print __DIR__."/file/pdf_anc_acc_list-activity-card.pdf".PHP_EOL; // By Activity / Account $anc_acc_list=new Anc_Acc_List($g_connection); $anc_acc_list->to='31.12.2019'; $anc_acc_list->from='01.01.2019'; $anc_acc_list->pa_id=1; $anc_acc_list->card_poste=4; $pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list); $pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-activity-account.pdf","F"); $this->assertGreaterThan(76000,filesize(__DIR__."/file/pdf_anc_acc_list-activity-account.pdf"), __DIR__."/file/pdf_anc_acc_list-activity-account.pdf incorrect"); print __DIR__."/file/pdf_anc_acc_list-activity-account.pdf".PHP_EOL; } }