Add new PHP Unit file
This commit is contained in:
parent
fc3c1057e3
commit
613360befe
5 changed files with 662 additions and 0 deletions
74
unit-test/include/lib/databaseCore.Test.php
Normal file
74
unit-test/include/lib/databaseCore.Test.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* 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-2021) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Test DabaseCore
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-02-11 at 15:41:40.
|
||||
*/
|
||||
class DatabaseCoreTest extends TestCase
|
||||
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Database
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$noalyss_user = (defined("noalyss_user")) ? noalyss_user : phpcompta_user;
|
||||
$password = (defined("noalyss_password")) ? noalyss_password : phpcompta_password;
|
||||
$port = (defined("noalyss_psql_port")) ? noalyss_psql_port : phpcompta_psql_port;
|
||||
$host = (!defined("noalyss_psql_host")) ? '127.0.0.1' : noalyss_psql_host;
|
||||
$this->object=new DatabaseCore($noalyss_user, $password, sprintf("%sdossier%s",domaine,DOSSIER), $host, $port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testExec_SQL()
|
||||
{
|
||||
$this->assertEquals(DBVERSION,$this->object->get_value("select max(val) from version"),"check Version");
|
||||
$this->assertTrue(true,$this->object->get_is_open(),"Database open");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue