mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 10:10:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cb7036515 |
No files matched your search
@@ -37,6 +37,10 @@ class bar extends test {
|
||||
$this->foobar = 2;
|
||||
$this->a = 200;
|
||||
|
||||
$p = new reflectionproperty($this, 'a');
|
||||
$p->setAccessible(true);
|
||||
var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
|
||||
|
||||
$p = new reflectionproperty($this, 'foobar');
|
||||
var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
|
||||
}
|
||||
@@ -45,9 +49,8 @@ class bar extends test {
|
||||
new bar;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(ReflectionProperty)#%d (2) {
|
||||
object(ReflectionProperty)#2 (2) {
|
||||
["name"]=>
|
||||
string(1) "z"
|
||||
["class"]=>
|
||||
@@ -64,13 +67,15 @@ array(1) {
|
||||
int(1000)
|
||||
---------------------------
|
||||
string(30) "Property x::$zz does not exist"
|
||||
object(ReflectionProperty)#%d (2) {
|
||||
object(ReflectionProperty)#3 (2) {
|
||||
["name"]=>
|
||||
string(3) "zzz"
|
||||
["class"]=>
|
||||
string(1) "x"
|
||||
}
|
||||
int(200)
|
||||
bool(true)
|
||||
bool(false)
|
||||
int(2)
|
||||
bool(false)
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -36,15 +36,14 @@ class test extends bar {
|
||||
new test;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(ReflectionProperty)#%d (2) {
|
||||
--EXPECT--
|
||||
object(ReflectionProperty)#3 (2) {
|
||||
["name"]=>
|
||||
string(4) "test"
|
||||
["class"]=>
|
||||
string(3) "foo"
|
||||
}
|
||||
object(ReflectionProperty)#%d (2) {
|
||||
object(ReflectionProperty)#5 (2) {
|
||||
["name"]=>
|
||||
string(1) "a"
|
||||
["class"]=>
|
||||
@@ -57,18 +56,17 @@ bool(true)
|
||||
bool(false)
|
||||
array(2) {
|
||||
[0]=>
|
||||
&object(ReflectionProperty)#%d (2) {
|
||||
&object(ReflectionProperty)#6 (2) {
|
||||
["name"]=>
|
||||
string(1) "b"
|
||||
["class"]=>
|
||||
string(4) "test"
|
||||
}
|
||||
[1]=>
|
||||
&object(ReflectionProperty)#%d (2) {
|
||||
&object(ReflectionProperty)#7 (2) {
|
||||
["name"]=>
|
||||
string(1) "a"
|
||||
["class"]=>
|
||||
string(4) "test"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Test max function : 64bit long tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
define("MAX_64Bit", 9223372036854775807);
|
||||
define("MAX_32Bit", 2147483647);
|
||||
define("MIN_64Bit", -MAX_64Bit - 1);
|
||||
define("MIN_32Bit", -MAX_32Bit - 1);
|
||||
|
||||
$arrayVals = array(
|
||||
MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
|
||||
MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
|
||||
MAX_64Bit -1, MIN_64Bit + 1
|
||||
);
|
||||
|
||||
$longVals = array(
|
||||
MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
|
||||
MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
|
||||
MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
|
||||
);
|
||||
|
||||
var_dump(max($arrayVals));
|
||||
var_dump(max($longVals));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
int(9223372036854775807)
|
||||
int(9223372036854775807)
|
||||
===DONE===
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Test min function : 64bit long tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
define("MAX_64Bit", 9223372036854775807);
|
||||
define("MAX_32Bit", 2147483647);
|
||||
define("MIN_64Bit", -MAX_64Bit - 1);
|
||||
define("MIN_32Bit", -MAX_32Bit - 1);
|
||||
|
||||
$arrayVals = array(
|
||||
MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
|
||||
MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
|
||||
MAX_64Bit -1, MIN_64Bit + 1
|
||||
);
|
||||
|
||||
$longVals = array(
|
||||
MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
|
||||
MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
|
||||
MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
|
||||
);
|
||||
|
||||
var_dump(min($arrayVals));
|
||||
var_dump(min($longVals));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
int(-9223372036854775808)
|
||||
int(-9223372036854775808)
|
||||
===DONE===
|
||||
@@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
Test sleep() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int sleep ( int $seconds )
|
||||
* Description: Delays the program execution for the given number of seconds .
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
*/
|
||||
|
||||
echo "*** Testing sleep() : basic functionality ***\n";
|
||||
|
||||
$sleeptime = 5; // sleep for 5 seconds
|
||||
|
||||
set_time_limit(20);
|
||||
|
||||
$time_start = microtime(true);
|
||||
|
||||
// Sleep for a while
|
||||
sleep($sleeptime);
|
||||
|
||||
// Test passes if sleeps for at least 98% of specified time
|
||||
$sleeplow = $sleeptime - ($sleeptime * 2 /100);
|
||||
|
||||
$time_end = microtime(true);
|
||||
$time = $time_end - $time_start;
|
||||
|
||||
echo "Thread slept for " . $time . " seconds\n";
|
||||
|
||||
if ($time >= $sleeplow) {
|
||||
echo "TEST PASSED\n";
|
||||
} else {
|
||||
echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n";
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing sleep() : basic functionality ***
|
||||
Thread slept for %f seconds
|
||||
TEST PASSED
|
||||
===DONE===
|
||||
@@ -1,44 +0,0 @@
|
||||
--TEST--
|
||||
Test sleep() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int sleep ( int $seconds )
|
||||
* Description: Delays the program execution for the given number of seconds .
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
*/
|
||||
set_time_limit(20);
|
||||
|
||||
echo "*** Testing sleep() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing sleep() function with zero arguments --\n";
|
||||
var_dump( sleep() );
|
||||
|
||||
echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
|
||||
$seconds = 10;
|
||||
$extra_arg = 10;
|
||||
var_dump( sleep($seconds, $extra_arg) );
|
||||
|
||||
echo "\n-- Testing sleep() function with negative interval --\n";
|
||||
$seconds = -10;
|
||||
var_dump( sleep($seconds) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing sleep() : error conditions ***
|
||||
|
||||
-- Testing sleep() function with zero arguments --
|
||||
|
||||
Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Testing sleep() function with more than expected no. of arguments --
|
||||
|
||||
Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Testing sleep() function with negative interval --
|
||||
|
||||
Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test usleep() function
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void usleep ( int $micro_seconds )
|
||||
* Description: Delays program execution for the given number of micro seconds.
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
*/
|
||||
|
||||
set_time_limit(20);
|
||||
|
||||
echo "*** Testing usleep() : basic functionality ***\n";
|
||||
|
||||
$sleeptime = 5000000; // == 5 seconds
|
||||
// Test passes if sleeps for at least 98% of specified time
|
||||
$sleeplow = $sleeptime - ($sleeptime * 2 /100);
|
||||
|
||||
$time_start = microtime(true);
|
||||
|
||||
// Sleep for a while
|
||||
usleep($sleeptime);
|
||||
|
||||
$time_end = microtime(true);
|
||||
$time = ($time_end - $time_start) * 1000 * 1000;
|
||||
|
||||
echo "Thread slept for " . $time . " micro-seconds\n";
|
||||
|
||||
if ($time >= $sleeplow) {
|
||||
echo "TEST PASSED\n";
|
||||
} else {
|
||||
echo "TEST FAILED\n";
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing usleep() : basic functionality ***
|
||||
Thread slept for %f micro-seconds
|
||||
TEST PASSED
|
||||
===DONE===
|
||||
@@ -1,45 +0,0 @@
|
||||
--TEST--
|
||||
Test usleep() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void usleep ( int $micro_seconds )
|
||||
* Description: Delays program execution for the given number of micro seconds.
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
*/
|
||||
|
||||
set_time_limit(20);
|
||||
|
||||
echo "*** Testing usleep() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing usleep() function with zero arguments --\n";
|
||||
var_dump( usleep() );
|
||||
|
||||
echo "\n-- Testing usleep() function with more than expected no. of arguments --\n";
|
||||
$seconds = 10;
|
||||
$extra_arg = 10;
|
||||
var_dump( usleep($seconds, $extra_arg) );
|
||||
|
||||
echo "\n-- Testing usleep() function with negative interval --\n";
|
||||
$seconds = -10;
|
||||
var_dump( usleep($seconds) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing usleep() : error conditions ***
|
||||
|
||||
-- Testing usleep() function with zero arguments --
|
||||
|
||||
Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing usleep() function with more than expected no. of arguments --
|
||||
|
||||
Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing usleep() function with negative interval --
|
||||
|
||||
Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
Reference in new issue
Block a user