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
f48348ca
Commit
f48348ca
authored
Dec 17, 2011
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
More PHPUnit tests
parent
1aa75b84
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/phpunit/FunctionsTest.php
+32
-2
32 additions, 2 deletions
test/phpunit/FunctionsTest.php
with
32 additions
and
2 deletions
test/phpunit/FunctionsTest.php
+
32
−
2
View file @
f48348ca
...
@@ -112,7 +112,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -112,7 +112,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
/**
/**
*/
*/
public
function
testHtmlCleanLastBr
()
public
function
test
Dol
HtmlCleanLastBr
()
{
{
$input
=
"A string<br>"
;
$input
=
"A string<br>"
;
$after
=
dol_htmlcleanlastbr
(
$input
);
$after
=
dol_htmlcleanlastbr
(
$input
);
...
@@ -132,7 +132,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -132,7 +132,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
/**
/**
*/
*/
public
function
testHtmlEntitiesBr
()
public
function
test
Dol
HtmlEntitiesBr
()
{
{
$input
=
"A string
\n
with a é, &, < and >."
;
// Text not already HTML
$input
=
"A string
\n
with a é, &, < and >."
;
// Text not already HTML
$after
=
dol_htmlentitiesbr
(
$input
,
0
);
// Add <br> before \n
$after
=
dol_htmlentitiesbr
(
$input
,
0
);
// Add <br> before \n
...
@@ -153,6 +153,36 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
...
@@ -153,6 +153,36 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
return
true
;
return
true
;
}
}
/**
*/
public
function
testDolTextIsHtml
()
{
// True
$input
=
'<html>xxx</html>'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
$input
=
'<body>xxx</body>'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
$input
=
'xxx <b>yyy</b> zzz'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
$input
=
'xxx<br>'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
$input
=
'text with <div>some div</div>'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
$input
=
'text with HTML entities'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertTrue
(
$after
);
// False
$input
=
'xxx < br>'
;
$after
=
dol_textishtml
(
$input
);
$this
->
assertFalse
(
$after
);
}
/**
/**
*/
*/
public
function
testDolTrunc
()
public
function
testDolTrunc
()
...
...
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