Skip to content

Commit 943b35b

Browse files
committed
Use helper file
1 parent abd5b94 commit 943b35b

File tree

2 files changed

+3
-123
lines changed

2 files changed

+3
-123
lines changed

Zend/tests/offsets/invalid_container_offset_behaviour.phpt

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,7 @@ Invalid containers with offsets
33
--FILE--
44
<?php
55

6-
function get_zend_debug_type($v) {
7-
if ($v === true) {
8-
return 'true';
9-
}
10-
if ($v === false) {
11-
return 'false';
12-
}
13-
if (is_resource($v)) {
14-
return 'resource';
15-
}
16-
return get_debug_type($v);
17-
}
18-
function makeContainer($container) {
19-
if (is_array($container)) {
20-
return "[]";
21-
}
22-
if (is_resource($container)) {
23-
return "STDERR";
24-
}
25-
if ($container instanceof stdClass) {
26-
return "new stdClass()";
27-
}
28-
return var_export($container, true);
29-
}
30-
function makeOffset($offset) {
31-
if ($offset === PHP_INT_MIN) {
32-
return "PHP_INT_MIN";
33-
}
34-
if ($offset === PHP_INT_MAX) {
35-
return "PHP_INT_MAX";
36-
}
37-
return var_export($offset, true);
38-
}
6+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc';
397

408
$containers = [
419
//false,
@@ -46,40 +14,6 @@ $containers = [
4614
//new stdClass(),
4715
];
4816

49-
$offsets = [
50-
null,
51-
false,
52-
true,
53-
4,
54-
5.5,
55-
6.0,
56-
//PHP_INT_MAX,
57-
//PHP_INT_MIN,
58-
PHP_INT_MAX * 2,
59-
PHP_INT_MIN * 2,
60-
INF,
61-
NAN,
62-
'string',
63-
'7',
64-
'8.5',
65-
'9.0',
66-
'2e3',
67-
'20a',
68-
' 20',
69-
'20 ',
70-
//"9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
71-
//"-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
72-
"0x14",
73-
(string) PHP_INT_MAX * 2,
74-
(string) PHP_INT_MIN * 2,
75-
];
76-
77-
$failures = [];
78-
$failuresNb = 0;
79-
$testCasesTotal = 0;
80-
81-
$var_dim_filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
82-
8317
ob_start();
8418
foreach ($containers as $container) {
8519
$containerStr = get_zend_debug_type($container);

Zend/tests/offsets/runtime_compile_time_offset_access.phpt

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ opcache.file_update_protection=1
1010
--FILE--
1111
<?php
1212

13+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc';
14+
1315
$containers = [
1416
null,
1517
false,
@@ -24,56 +26,6 @@ $containers = [
2426
new stdClass(),
2527
];
2628

27-
$offsets = [
28-
null,
29-
false,
30-
true,
31-
4,
32-
5.5,
33-
6.0,
34-
//PHP_INT_MAX,
35-
//PHP_INT_MIN,
36-
PHP_INT_MAX * 2,
37-
PHP_INT_MIN * 2,
38-
INF,
39-
NAN,
40-
'string',
41-
'7',
42-
'8.5',
43-
'9.0',
44-
'2e3',
45-
'20a',
46-
' 20',
47-
'20 ',
48-
//"9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
49-
//"-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
50-
"0x14",
51-
(string) PHP_INT_MAX * 2,
52-
(string) PHP_INT_MIN * 2,
53-
];
54-
55-
function makeContainer($container) {
56-
if (is_array($container)) {
57-
return "[]";
58-
}
59-
if (is_resource($container)) {
60-
return "STDERR";
61-
}
62-
if ($container instanceof stdClass) {
63-
return "new stdClass()";
64-
}
65-
return var_export($container, true);
66-
}
67-
function makeOffset($offset) {
68-
if ($offset === PHP_INT_MIN) {
69-
return "PHP_INT_MIN";
70-
}
71-
if ($offset === PHP_INT_MAX) {
72-
return "PHP_INT_MAX";
73-
}
74-
return var_export($offset, true);
75-
}
76-
7729
function makeTestFile($container, $offset) {
7830
$offset_p = makeOffset($offset);
7931
$container_p = makeContainer($container);
@@ -135,12 +87,6 @@ test;
13587

13688
$const_dim_filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_offsets_temp.php';
13789

138-
$failures = [];
139-
$failuresNb = 0;
140-
$testCasesTotal = 0;
141-
142-
$var_dim_filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
143-
14490
ob_start();
14591
foreach ($containers as $container_orig) {
14692
foreach ($offsets as $offset) {

0 commit comments

Comments
 (0)