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
102d2d9d
Commit
102d2d9d
authored
10 years ago
by
Marcos García de La Fuente
Browse files
Options
Downloads
Patches
Plain Diff
Added IE11 test to testGetBrowserInfo
parent
702c19da
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/phpunit/FunctionsLibTest.php
+24
-16
24 additions, 16 deletions
test/phpunit/FunctionsLibTest.php
with
24 additions
and
16 deletions
test/phpunit/FunctionsLibTest.php
+
24
−
16
View file @
102d2d9d
...
@@ -26,20 +26,20 @@
...
@@ -26,20 +26,20 @@
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php';
//require_once 'PHPUnit/Autoload.php';
require_once
dirname
(
__FILE__
)
.
'/../../htdocs/master.inc.php'
;
//
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once
dirname
(
__FILE__
)
.
'/../../htdocs/core/lib/date.lib.php'
;
//
require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
//
if
(
!
defined
(
'NOREQUIREUSER'
))
define
(
'NOREQUIREUSER'
,
'1'
);
//
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
if
(
!
defined
(
'NOREQUIREDB'
))
define
(
'NOREQUIREDB'
,
'1'
);
//
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if
(
!
defined
(
'NOREQUIRESOC'
))
define
(
'NOREQUIRESOC'
,
'1'
);
//
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if
(
!
defined
(
'NOREQUIRETRAN'
))
define
(
'NOREQUIRETRAN'
,
'1'
);
//
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if
(
!
defined
(
'NOCSRFCHECK'
))
define
(
'NOCSRFCHECK'
,
'1'
);
//
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
if
(
!
defined
(
'NOTOKENRENEWAL'
))
define
(
'NOTOKENRENEWAL'
,
'1'
);
//
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
if
(
!
defined
(
'NOREQUIREMENU'
))
define
(
'NOREQUIREMENU'
,
'1'
);
// If there is no menu to show
//
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
if
(
!
defined
(
'NOREQUIREHTML'
))
define
(
'NOREQUIREHTML'
,
'1'
);
// If we don't need to load the html.form.class.php
//
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
if
(
!
defined
(
'NOREQUIREAJAX'
))
define
(
'NOREQUIREAJAX'
,
'1'
);
//
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if
(
!
defined
(
"NOLOGIN"
))
define
(
"NOLOGIN"
,
'1'
);
// If this page is public (can be called outside logged session)
//
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
require_once
dirname
(
__FILE__
)
.
'/../../htdocs/core/lib/functions.lib.php'
;
/**
/**
* Class for PHPUnit tests
* Class for PHPUnit tests
...
@@ -126,12 +126,14 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
...
@@ -126,12 +126,14 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
*/
*/
public
function
testGetBrowserInfo
()
public
function
testGetBrowserInfo
()
{
{
$user_agent
=
'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; KITV4 Wanadoo; KITV5 Wanadoo)'
;
// MSIE 5.0
// MSIE 5.0
$user_agent
=
'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; KITV4 Wanadoo; KITV5 Wanadoo)'
;
$tmp
=
getBrowserInfo
(
$user_agent
);
$tmp
=
getBrowserInfo
(
$user_agent
);
$this
->
assertEquals
(
'ie'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'ie'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'5.0'
,
$tmp
[
'browserversion'
]);
$this
->
assertEquals
(
'5.0'
,
$tmp
[
'browserversion'
]);
$user_agent
=
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1'
;
// Firefox 0.9.1
// Firefox 0.9.1
$user_agent
=
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1'
;
$tmp
=
getBrowserInfo
(
$user_agent
);
$tmp
=
getBrowserInfo
(
$user_agent
);
$this
->
assertEquals
(
'firefox'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'firefox'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'0.9.1'
,
$tmp
[
'browserversion'
]);
$this
->
assertEquals
(
'0.9.1'
,
$tmp
[
'browserversion'
]);
...
@@ -155,6 +157,12 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
...
@@ -155,6 +157,12 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$tmp
=
getBrowserInfo
(
$user_agent
);
$tmp
=
getBrowserInfo
(
$user_agent
);
$this
->
assertEquals
(
'safari'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'safari'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'533.21.1'
,
$tmp
[
'browserversion'
]);
$this
->
assertEquals
(
'533.21.1'
,
$tmp
[
'browserversion'
]);
//Internet Explorer 11
$user_agent
=
'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'
;
$tmp
=
getBrowserInfo
(
$user_agent
);
$this
->
assertEquals
(
'ie'
,
$tmp
[
'browsername'
]);
$this
->
assertEquals
(
'11.0'
,
$tmp
[
'browserversion'
]);
}
}
...
...
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