Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
ffa767bb
Commit
ffa767bb
authored
Feb 12, 2012
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Qual: Add more PHPunit tests
parent
4489eba5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/core/lib/functions.lib.php
+1
-1
1 addition, 1 deletion
htdocs/core/lib/functions.lib.php
test/phpunit/FunctionsTest.php
+58
-0
58 additions, 0 deletions
test/phpunit/FunctionsTest.php
test/phpunit/ImportTest.php
+1
-1
1 addition, 1 deletion
test/phpunit/ImportTest.php
with
60 additions
and
2 deletions
htdocs/core/lib/functions.lib.php
+
1
−
1
View file @
ffa767bb
...
@@ -4239,7 +4239,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
...
@@ -4239,7 +4239,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
* Verify if condition in string is ok or not
* Verify if condition in string is ok or not
*
*
* @param string $strRights String with condition to check
* @param string $strRights String with condition to check
* @return boolean
t
rue or
f
alse
* @return boolean
T
rue or
F
alse
. Return true if strRights is ''
*/
*/
function
verifCond
(
$strRights
)
function
verifCond
(
$strRights
)
{
{
...
...
This diff is collapsed.
Click to expand it.
test/phpunit/FunctionsTest.php
+
58
−
0
View file @
ffa767bb
...
@@ -118,6 +118,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -118,6 +118,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
/**
/**
* testDolHtmlCleanLastBr
*
* @return boolean
*/
*/
public
function
testDolHtmlCleanLastBr
()
public
function
testDolHtmlCleanLastBr
()
{
{
...
@@ -138,6 +141,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -138,6 +141,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
}
}
/**
/**
* testDolHtmlEntitiesBr
*
* @return boolean
*/
*/
public
function
testDolHtmlEntitiesBr
()
public
function
testDolHtmlEntitiesBr
()
{
{
...
@@ -161,6 +167,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -161,6 +167,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
}
}
/**
/**
* testDolTextIsHtml
*
* @return void
*/
*/
public
function
testDolTextIsHtml
()
public
function
testDolTextIsHtml
()
{
{
...
@@ -191,6 +200,31 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -191,6 +200,31 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
}
}
/**
/**
* testDolTextIsHtml
*
* @return void
*/
public
function
testDolUtf8Check
()
{
// True
$result
=
utf8_check
(
'azerty'
);
$this
->
assertTrue
(
$result
);
$file
=
dirname
(
__FILE__
)
.
'/textutf8.txt'
;
$filecontent
=
file_get_contents
(
$file
);
$result
=
utf8_check
(
$filecontent
);
$this
->
assertTrue
(
$result
);
$file
=
dirname
(
__FILE__
)
.
'/textiso.txt'
;
$filecontent
=
file_get_contents
(
$file
);
$result
=
utf8_check
(
$filecontent
);
$this
->
assertFalse
(
$result
);
}
/**
* testDolTrunc
*
* @return boolean
*/
*/
public
function
testDolTrunc
()
public
function
testDolTrunc
()
{
{
...
@@ -272,5 +306,29 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -272,5 +306,29 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
print
__METHOD__
.
"getServerTimeZoneInt="
.
(
getServerTimeZoneInt
()
*
3600
)
.
"
\n
"
;
print
__METHOD__
.
"getServerTimeZoneInt="
.
(
getServerTimeZoneInt
()
*
3600
)
.
"
\n
"
;
$this
->
assertEquals
(
getServerTimeZoneInt
()
*
3600
,(
$nowtzserver
-
$now
));
$this
->
assertEquals
(
getServerTimeZoneInt
()
*
3600
,(
$nowtzserver
-
$now
));
}
}
/**
* testVerifCond
*
* @return void
*/
public
function
testVerifCond
()
{
$verifcond
=
verifCond
(
'1==1'
);
$this
->
assertTrue
(
$verifcond
);
$verifcond
=
verifCond
(
'1==2'
);
$this
->
assertFalse
(
$verifcond
);
$verifcond
=
verifCond
(
'$conf->facture->enabled'
);
$this
->
assertTrue
(
$verifcond
);
$verifcond
=
verifCond
(
'$conf->moduledummy->enabled'
);
$this
->
assertFalse
(
$verifcond
);
$verifcond
=
verifCond
(
''
);
$this
->
assertTrue
(
$verifcond
);
}
}
}
?>
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/phpunit/ImportTest.php
+
1
−
1
View file @
ffa767bb
...
@@ -120,7 +120,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
...
@@ -120,7 +120,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
*/
*/
public
function
testImportSample1
()
public
function
testImportSample1
()
{
{
$file
=
dirname
(
__FILE__
)
.
'/Example_import_company_1.csv'
;
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment