[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 09/12: Improve PHPUNIT
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 09/12: Improve PHPUNIT |
Date: |
Sat, 17 Sep 2022 08:40:57 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9de599e9bc4c8dfe478c94014aee05920d3d77eb
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Sep 16 15:03:08 2022 +0200
Improve PHPUNIT
---
.../class/{fiche_def.Test.php => Fiche_DefTest.php} | 0
unit-test/include/class/followup_detail.Test.php | 21 +++++++++++++++------
unit-test/test-file.sh | 6 +++---
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/unit-test/include/class/fiche_def.Test.php
b/unit-test/include/class/Fiche_DefTest.php
similarity index 100%
rename from unit-test/include/class/fiche_def.Test.php
rename to unit-test/include/class/Fiche_DefTest.php
diff --git a/unit-test/include/class/followup_detail.Test.php
b/unit-test/include/class/followup_detail.Test.php
index da99d80b6..7b64b8640 100644
--- a/unit-test/include/class/followup_detail.Test.php
+++ b/unit-test/include/class/followup_detail.Test.php
@@ -32,7 +32,7 @@ use PHPUnit\Framework\TestCase;
* @backupGlobals enabled
* @coversDefaultClass \Follow_Up_Detail
*/
-require DIRTEST.'/global.php';
+
class Follow_Up_DetailTest extends TestCase
{
@@ -48,7 +48,11 @@ class Follow_Up_DetailTest extends TestCase
*/
protected function setUp():void
{
- include 'global.php';
+ require DIRTEST.'/global.php';
+ global $g_connection;
+ $this->g_connection=$g_connection;
+ $this->assertNotNull($this->g_connection , "Database",'invalide
ressource');
+ $this->assertEquals(get_class ($this->g_connection) ,
"Database",'invalide ressource');
}
/**
@@ -62,12 +66,15 @@ class Follow_Up_DetailTest extends TestCase
/**
* the setUpBeforeClass():void template methods is called before the first
test of the test case
- * class is run
+ * class is run
+ * @backupGlobals enabled
*/
public static function setUpBeforeClass():void
{
+
global $g_connection;
$g_connection->exec_sql('delete from action_detail');
+
}
/**
@@ -114,14 +121,16 @@ class Follow_Up_DetailTest extends TestCase
*/
public function testSQL_Update()
{
- global $g_connection;
- $obj=new Follow_Up_Detail($g_connection);
+
+
+
+ $obj=new Follow_Up_Detail($this->g_connection);
$this->insert($obj);
$this->assertTrue($obj->get_parameter("id")>0,"Cannot insert");
$obj->set_parameter('text','TEST UPDATE');
$obj->save();
- $reload=new Follow_Up_Detail($g_connection,$obj->get_parameter("id"));
+ $reload=new
Follow_Up_Detail($this->g_connection,$obj->get_parameter("id"));
$reload->load();
$this->assertTrue($reload->get_parameter("text") ==
$obj->get_parameter("text"),"cannot update");
$reload->delete();
diff --git a/unit-test/test-file.sh b/unit-test/test-file.sh
index dd5de8c9a..5693f6bf4 100755
--- a/unit-test/test-file.sh
+++ b/unit-test/test-file.sh
@@ -54,7 +54,7 @@ fi
if [ ! -z "$FOLDERTEST" -a -d "$FOLDERTEST" ] ; then
- $PHPINI $PHPUNIT --bootstrap bootstrap.php $COVERAGE --testdox --color
$FOLDERTEST
+ $PHPINI $PHPUNIT --globals-backup --bootstrap bootstrap.php $COVERAGE
--testdox --color $FOLDERTEST
exit $?
fi
@@ -65,12 +65,12 @@ fi
if [ ! -z "$FUNCTION" ] ; then
echo "testing $FILETOTEST $FUNCTION"
- $PHPINI $PHPUNIT --bootstrap $CUR_DIR/bootstrap.php --verbose --color
--filter $FUNCTION $FILETOTEST
+ $PHPINI $PHPUNIT --bootstrap $CUR_DIR/bootstrap.php --globals-backup
--verbose --color --filter $FUNCTION $FILETOTEST
else
# $PHPUNIT --bootstrap bootstrap.php --whitelist $FILETOTEST
--coverage-text=${FILETOTEST%.php}.txt --color $FILETOTEST
# $PHPUNIT --bootstrap $CUR_DIR/bootstrap.php
--whitelist=$CUR_DIR/../include/class --coverage-html=coverage --color
$FILETOTEST
$PHPINI $PHPUNIT --bootstrap bootstrap.php $COVERAGE $FILETOTEST
--testdox --color $FILETOTEST
- #$PHPUNIT --bootstrap bootstrap.php --whitelist=../include
--coverage-html=coverage $FILETOTEST --testdox-html
${FILETOTEST%.php}-testdox.html --color $FILETOTEST
+ #$PHPUNIT --bootstrap bootstrap.php --whitelist=../include
--globals-backup --coverage-html=coverage $FILETOTEST --testdox-html
${FILETOTEST%.php}-testdox.html --color $FILETOTEST
fi
- [Noalyss-commit] [noalyss] branch master updated (da636cf6e -> f1d3862e1), Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 07/12: Improve test, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 04/12: Task #0002125: Contact , devrait être refait sur le modèle de Fiche->résumé, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 08/12: Task #0002125: type , missed phoneTo for mobile , phone and faxTo, several emails separated by a comma, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 01/12: Fix Bug : accounting history was not shown when dble clicked, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 06/12: SQL If nothing is loaded return false, otherwise true, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 02/12: New #0002193: Possibilité d'ajouter directement une note aux opérations Cosmetic : change icon for enlarging operation label, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 09/12: Improve PHPUNIT,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 11/12: New #2195 0002195: Création catégorie : ordre des attributs, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 03/12: Improve autoloader, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 05/12: New function mailto and tel, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 12/12: Improve #0002196: Comptes Alphanumériques calculés trop longs, Dany De Bontridder, 2022/09/17
- [Noalyss-commit] [noalyss] 10/12: Add function linkTo for URL, Dany De Bontridder, 2022/09/17