FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
phpbb/tests/wrapper/phpbb_php_ini_test.php at develop · Pico/phpbb · GitHub
Pico
/
phpbb
Public
forked from
phpbb/phpbb
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
phpbb
/
tests
/
wrapper
/
phpbb_php_ini_test.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
90 lines (78 loc) · 2.54 KB
Breadcrumbs
phpbb
/
tests
/
wrapper
/
phpbb_php_ini_test.php
Copy path
File metadata and controls
90 lines (78 loc) · 2.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
require_once
dirname
(
__FILE__
) .
'
/phpbb_php_ini_fake.php
'
;
require_once
dirname
(
__FILE__
) .
'
/../../phpBB/includes/functions.php
'
;
class
phpbb_wrapper_phpbb_php_ini_test
extends
phpbb_test_case
{
protected
$
php_ini
;
public
function
setUp
()
{
$
this
->
php_ini
=
new
phpbb_php_ini_fake
;
}
public
function
test_get_string
()
{
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_string
(
false
));
$
this
->
assertSame
(
'
phpbb
'
,
$
this
->
php_ini
->
get_string
(
'
phpbb
'
));
}
public
function
test_get_bool
()
{
$
this
->
assertSame
(
true
,
$
this
->
php_ini
->
get_bool
(
'
ON
'
));
$
this
->
assertSame
(
true
,
$
this
->
php_ini
->
get_bool
(
'
on
'
));
$
this
->
assertSame
(
true
,
$
this
->
php_ini
->
get_bool
(
'
1
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bool
(
'
OFF
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bool
(
'
off
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bool
(
'
0
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bool
(
''
));
}
public
function
test_get_int
()
{
$
this
->
assertSame
(
1234
,
$
this
->
php_ini
->
get_int
(
'
1234
'
));
$
this
->
assertSame
(-
12345
,
$
this
->
php_ini
->
get_int
(
'
-12345
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_int
(
'
phpBB
'
));
}
public
function
test_get_float
()
{
$
this
->
assertSame
(
1234.0
,
$
this
->
php_ini
->
get_float
(
'
1234
'
));
$
this
->
assertSame
(-
12345.0
,
$
this
->
php_ini
->
get_float
(
'
-12345
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_float
(
'
phpBB
'
));
}
public
function
test_get_bytes_invalid
()
{
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
false
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
'
phpBB
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
'
k
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
'
-k
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
'
M
'
));
$
this
->
assertSame
(
false
,
$
this
->
php_ini
->
get_bytes
(
'
-M
'
));
}
/**
* @dataProvider get_bytes_data
*/
public
function
test_get_bytes
(
$
expected
,
$
value
)
{
$
actual
=
$
this
->
php_ini
->
get_bytes
(
$
value
);
$
this
->
assertTrue
(
is_float
(
$
actual
) ||
is_int
(
$
actual
));
$
this
->
assertEquals
(
$
expected
,
$
actual
);
}
static
public
function
get_bytes_data
()
{
return
array
(
array
(
32
*
pow
(
2
,
20
),
'
32m
'
),
array
(-
32
*
pow
(
2
,
20
),
'
-32m
'
),
array
(
8
*
pow
(
2
,
30
),
'
8G
'
),
array
(-
8
*
pow
(
2
,
30
),
'
-8G
'
),
array
(
1234
,
'
1234
'
),
array
(-
12345
,
'
-12345
'
),
);
}
}
Back
|
FazBrowse Home
|
New Git URL