mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
More zpp error/variation test removals
This commit is contained in:
parent
aa33ab9696
commit
59dd1979ef
50 changed files with 0 additions and 2008 deletions
|
@ -1,36 +0,0 @@
|
|||
--TEST--
|
||||
Test exif_tagname() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype :string exif_tagname ( string $index )
|
||||
* Description: Get the header name for an index
|
||||
* Source code: ext/exif/exif.c
|
||||
*/
|
||||
|
||||
echo "*** Testing exif_tagname() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing exif_tagname() function with no arguments --\n";
|
||||
var_dump( exif_tagname() );
|
||||
|
||||
echo "\n-- Testing exif_tagname() function with more than expected no. of arguments --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( exif_tagname(0x10E, $extra_arg) );
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing exif_tagname() : error conditions ***
|
||||
|
||||
-- Testing exif_tagname() function with no arguments --
|
||||
|
||||
Warning: exif_tagname() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing exif_tagname() function with more than expected no. of arguments --
|
||||
|
||||
Warning: exif_tagname() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===Done===
|
|
@ -1,17 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::changes empty str tests
|
||||
--CREDITS--
|
||||
Ward Hus
|
||||
#@ PHP TESTFEST 2009 (BELGIUM)
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
//$db = new SQLite3('mysqlitedb.db');
|
||||
$db->exec('CREATE TABLE pageView(id INTEGER PRIMARY KEY, page CHAR(256), access INTEGER(10))');
|
||||
$db->exec('INSERT INTO pageView (page, access) VALUES (\'test\', \'000000\')');
|
||||
echo $db->changes("dummy");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::changes() expects exactly 0 parameters, 1 given in %s on line %d
|
|
@ -1,21 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::createAggregate Test that an error is thrown when no parameters are present
|
||||
--CREDITS--
|
||||
James Cauwelier
|
||||
# Belgium PHP TestFest
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
|
||||
$db->createAggregate ();
|
||||
|
||||
$db->close();
|
||||
|
||||
echo "Done"
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::createAggregate() expects at least 3 parameters, 0 given in %s on line %d
|
||||
Done
|
|
@ -1,40 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::lastInsertRowID parameter test
|
||||
--CREDITS--
|
||||
Jelle Lampaert
|
||||
#Belgian Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
|
||||
echo "Creating Table\n";
|
||||
var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
|
||||
|
||||
echo "Inserting data\n";
|
||||
var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
|
||||
|
||||
echo "Request last inserted id\n";
|
||||
try {
|
||||
$db->lastInsertRowID("");
|
||||
} catch (Exception $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
|
||||
echo "Closing database\n";
|
||||
var_dump($db->close());
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating Table
|
||||
bool(true)
|
||||
Inserting data
|
||||
bool(true)
|
||||
Request last inserted id
|
||||
|
||||
Warning: SQLite3::lastInsertRowID() expects exactly 0 parameters, %d given in %s on line %d
|
||||
Closing database
|
||||
bool(true)
|
||||
Done
|
|
@ -1,21 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::close parameters
|
||||
--CREDITS--
|
||||
Jachim Coudenys
|
||||
# TestFest 2009 Belgium
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
echo 'Testing SQLite3 close with one parameter' . PHP_EOL;
|
||||
$db->close('parameter');
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing SQLite3 close with one parameter
|
||||
|
||||
Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
Done
|
|
@ -1,18 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::close test with parameters
|
||||
--CREDITS--
|
||||
Thijs Feryn <thijs@feryn.eu>
|
||||
#TestFest PHPBelgium 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
var_dump($db->close('invalid argument'));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,16 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::exec test, testing for wrong type parameters
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec(array ('a','b','c'), 20090509);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::exec() expects exactly 1 parameter, 2 given in %s on line %d
|
|
@ -1,18 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::lastErrorCode test with parameters
|
||||
--CREDITS--
|
||||
Thijs Feryn <thijs@feryn.eu>
|
||||
#TestFest PHPBelgium 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
var_dump($db->lastErrorCode('invalid argument'));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::lastErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,17 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::lastErrorMsg test with parameters
|
||||
--CREDITS--
|
||||
Thijs Feryn <thijs@feryn.eu>
|
||||
#TestFest PHPBelgium 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
var_dump($db->lastErrorMsg('invalid argument'));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::lastErrorMsg() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,23 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::loadExtension test with wrong parameter type
|
||||
--CREDITS--
|
||||
Thijs Feryn <thijs@feryn.eu>
|
||||
#TestFest PHPBelgium 2009
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__ . '/skipif.inc');
|
||||
|
||||
if (!method_exists('SQLite3', 'loadExtension')) {
|
||||
die("skip if SQLITE_OMIT_LOAD_EXTENSION defined");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
var_dump($db->loadExtension(array()));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::loadExtension() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,79 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::blobOpen test, testing stream with wrong parameter count
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class SQLite3_Test_Stream
|
||||
{
|
||||
private $position;
|
||||
public static $string_length = 10;
|
||||
public static $string = "abcdefg\0hi";
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
$this->position = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$ret = substr(self::$string, $this->position, $count);
|
||||
$this->position += strlen($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function stream_write($data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array('size' => self::$string_length);
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return ($this->position >= self::$string_length);
|
||||
}
|
||||
}
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream");
|
||||
echo "Creating table: " . var_export($db->exec('CREATE TABLE test (id STRING, data BLOB)'),true) . "\n";
|
||||
|
||||
echo "PREPARING insert\n";
|
||||
$insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
|
||||
|
||||
echo "BINDING Parameters:\n";
|
||||
var_dump($insert_stmt->bindValue(1, 'a', SQLITE3_TEXT));
|
||||
var_dump($insert_stmt->bindValue(2, 'TEST TEST', SQLITE3_BLOB));
|
||||
$insert_stmt->execute();
|
||||
echo "Closing statement: " . var_export($insert_stmt->close(), true) . "\n";
|
||||
|
||||
echo "Open BLOB with wrong parameter count\n";
|
||||
$stream = $db->openBlob();
|
||||
var_dump($stream);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating table: true
|
||||
PREPARING insert
|
||||
BINDING Parameters:
|
||||
bool(true)
|
||||
bool(true)
|
||||
Closing statement: true
|
||||
Open BLOB with wrong parameter count
|
||||
|
||||
Warning: SQLite3::openBlob() expects at least 3 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,19 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::prepare test, testing for wrong parameters
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
|
||||
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
|
||||
|
||||
$stmt = $db->prepare();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::prepare() expects exactly 1 parameter, 0 given in %s on line %d
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Stmt::clear test with parameters
|
||||
--CREDITS--
|
||||
Thijs Feryn <thijs@feryn.eu>
|
||||
#TestFest PHPBelgium 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
define('TIMENOW', time());
|
||||
echo "Creating Table\n";
|
||||
$db->exec('CREATE TABLE test (time INTEGER, id STRING)');
|
||||
echo "INSERT into table\n";
|
||||
var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
|
||||
|
||||
echo "SELECTING results\n";
|
||||
$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
|
||||
var_dump($stmt->clear('invalid argument'));
|
||||
echo "Closing database\n";
|
||||
var_dump($db->close());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating Table
|
||||
INSERT into table
|
||||
bool(true)
|
||||
SELECTING results
|
||||
|
||||
Warning: SQLite3Stmt::clear() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Closing database
|
||||
bool(true)
|
||||
Done
|
|
@ -1,32 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::query parameters
|
||||
--CREDITS--
|
||||
Jachim Coudenys
|
||||
# TestFest 2009 Belgium
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
echo 'Testing SQLite3 query without parameters' . PHP_EOL;
|
||||
$db->query();
|
||||
|
||||
echo 'Testing SQLite3 query with one array parameter' . PHP_EOL;
|
||||
$db->query(array());
|
||||
|
||||
echo 'Testing SQLite3 query with empty string parameter' . PHP_EOL;
|
||||
var_dump($db->query(''));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing SQLite3 query without parameters
|
||||
|
||||
Warning: SQLite3::query() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
Testing SQLite3 query with one array parameter
|
||||
|
||||
Warning: SQLite3::query() expects parameter 1 to be string, array given in %s on line %d
|
||||
Testing SQLite3 query with empty string parameter
|
||||
bool(false)
|
||||
Done
|
|
@ -1,31 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::query parameters
|
||||
--CREDITS--
|
||||
Jachim Coudenys
|
||||
# TestFest 2009 Belgium
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
echo 'Testing SQLite3 querySingle without parameters' . PHP_EOL;
|
||||
$db->querySingle();
|
||||
|
||||
echo 'Testing SQLite3 querySingle with one array parameter' . PHP_EOL;
|
||||
$db->querySingle(array());
|
||||
|
||||
echo 'Testing SQLite3 querySingle with empty string parameter' . PHP_EOL;
|
||||
var_dump($db->querySingle(''));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Testing SQLite3 querySingle without parameters
|
||||
|
||||
Warning: SQLite3::querySingle() expects at least 1 parameter, 0 given in %s on line %d
|
||||
Testing SQLite3 querySingle with one array parameter
|
||||
|
||||
Warning: SQLite3::querySingle() expects parameter 1 to be string, array given in %s on line %d
|
||||
Testing SQLite3 querySingle with empty string parameter
|
||||
bool(false)
|
||||
Done
|
|
@ -1,16 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3::version test, testing for missing function parameters
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(SQLite3::version('dummy'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3::version() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
|
@ -1,20 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Result::fetchArray() test, testing two params causes a failure
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec('CREATE TABLE foo (bar STRING)');
|
||||
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
|
||||
$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
|
||||
|
||||
$result = $db->query('SELECT bar FROM foo');
|
||||
var_dump($result->fetchArray(1,2));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3Result::fetchArray() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
|
@ -1,33 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Result::numColumns parameters
|
||||
--CREDITS--
|
||||
Jachim Coudenys
|
||||
# TestFest 2009 Belgium
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
echo 'Creating Table' . PHP_EOL;
|
||||
var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
|
||||
|
||||
echo 'Inserting data' . PHP_EOL;
|
||||
var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
|
||||
|
||||
echo 'Fetching number of columns' . PHP_EOL;
|
||||
$result = $db->query('SELECT id FROM test');
|
||||
var_dump($result->numColumns('time'));
|
||||
|
||||
echo 'Done';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating Table
|
||||
bool(true)
|
||||
Inserting data
|
||||
bool(true)
|
||||
Fetching number of columns
|
||||
|
||||
Warning: SQLite3Result::numColumns() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,19 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Result::reset test, testing an exception is raised when calling reset with parameters
|
||||
--CREDITS--
|
||||
Michelangelo van Dam
|
||||
# Belgian PHP Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec('CREATE TABLE foo (bar STRING)');
|
||||
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
|
||||
$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
|
||||
|
||||
$result = $db->query('SELECT bar FROM foo');
|
||||
$result->reset(1);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: SQLite3Result::reset() expects exactly 0 parameters, 1 given in %s on line %d
|
|
@ -1,46 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Stmt::paramCount error test
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/new_db.inc');
|
||||
|
||||
echo "Creating Table\n";
|
||||
var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING, city STRING)'));
|
||||
|
||||
echo "INSERT into table\n";
|
||||
var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (1, 'john', 'LA')"));
|
||||
var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (2, 'doe', 'SF')"));
|
||||
|
||||
|
||||
$query = "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC";
|
||||
|
||||
echo "SELECTING results\n";
|
||||
|
||||
$stmt = $db->prepare($query);
|
||||
|
||||
echo "paramCount with wrong number of arguments\n";
|
||||
var_dump($stmt->paramCount('foobar'));
|
||||
$result = $stmt->execute();
|
||||
echo "Closing database\n";
|
||||
$stmt = null;
|
||||
$result = null;
|
||||
var_dump($db->close());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating Table
|
||||
bool(true)
|
||||
INSERT into table
|
||||
bool(true)
|
||||
bool(true)
|
||||
SELECTING results
|
||||
paramCount with wrong number of arguments
|
||||
|
||||
Warning: SQLite3Stmt::paramCount() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Closing database
|
||||
bool(true)
|
||||
Done
|
|
@ -1,47 +0,0 @@
|
|||
--TEST--
|
||||
SQLite3Stmt::reset with parameter test
|
||||
--CREDITS--
|
||||
Jelle Lampaert
|
||||
#Belgian Testfest 2009
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
echo "Creating Table\n";
|
||||
var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING)'));
|
||||
|
||||
echo "INSERT into table\n";
|
||||
var_dump($db->exec("INSERT INTO foobar (id, name) VALUES (1, 'john')"));
|
||||
|
||||
|
||||
$query = "SELECT name FROM foobar WHERE id = 1";
|
||||
|
||||
echo "Prepare query\n";
|
||||
$stmt = $db->prepare($query);
|
||||
|
||||
echo "Reset query\n";
|
||||
try {
|
||||
$stmt->reset("foo");
|
||||
} catch (Exception $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
}
|
||||
|
||||
echo "Closing database\n";
|
||||
$stmt = null;
|
||||
$result = null;
|
||||
var_dump($db->close());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Creating Table
|
||||
bool(true)
|
||||
INSERT into table
|
||||
bool(true)
|
||||
Prepare query
|
||||
Reset query
|
||||
|
||||
Warning: SQLite3Stmt::reset() expects exactly 0 parameters, %d given in %s on line %d
|
||||
Closing database
|
||||
bool(true)
|
||||
Done
|
|
@ -1,38 +0,0 @@
|
|||
--TEST--
|
||||
Test basename() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string basename(string path [, string suffix])
|
||||
* Description: Returns the filename component of the path
|
||||
* Source code: ext/standard/string.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing basename() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing basename() function with Zero arguments --\n";
|
||||
var_dump( basename() );
|
||||
|
||||
//Test basename with one more than the expected number of arguments
|
||||
echo "\n-- Testing basename() function with more than expected no. of arguments --\n";
|
||||
$path = 'string_val';
|
||||
$suffix = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( basename($path, $suffix, $extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing basename() : error conditions ***
|
||||
|
||||
-- Testing basename() function with Zero arguments --
|
||||
|
||||
Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing basename() function with more than expected no. of arguments --
|
||||
|
||||
Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,19 +0,0 @@
|
|||
--TEST--
|
||||
Test clearstatcache() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: void clearstatcache ([bool clear_realpath_cache[, filename]]);
|
||||
Description: clears files status cache
|
||||
*/
|
||||
|
||||
echo "*** Testing clearstatcache() function: error conditions ***\n";
|
||||
var_dump( clearstatcache(0, "/foo/bar", 1) ); //No.of args more than expected
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing clearstatcache() function: error conditions ***
|
||||
|
||||
Warning: clearstatcache() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
*** Done ***
|
|
@ -1,39 +0,0 @@
|
|||
--TEST--
|
||||
Test dirname() function : error conditions
|
||||
--CREDITS--
|
||||
Dave Kelsey <d_kelsey@uk.ibm.com>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string dirname(string path)
|
||||
* Description: Returns the directory name component of the path
|
||||
* Source code: ext/standard/string.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing dirname() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing dirname() function with Zero arguments --\n";
|
||||
var_dump( dirname() );
|
||||
|
||||
//Test dirname with one more than the expected number of arguments
|
||||
echo "\n-- Testing dirname() function with more than expected no. of arguments --\n";
|
||||
$path = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( dirname($path, 1, $extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing dirname() : error conditions ***
|
||||
|
||||
-- Testing dirname() function with Zero arguments --
|
||||
|
||||
Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing dirname() function with more than expected no. of arguments --
|
||||
|
||||
Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,87 +0,0 @@
|
|||
--TEST--
|
||||
Test fflush() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: bool fflush ( resource $handle );
|
||||
Description: Flushes the output to a file
|
||||
*/
|
||||
|
||||
echo "*** Testing error conditions ***\n";
|
||||
$file_path = dirname(__FILE__);
|
||||
|
||||
// zero argument
|
||||
echo "-- Testing fflush(): with zero argument --\n";
|
||||
var_dump( fflush() );
|
||||
|
||||
// more than expected no. of args
|
||||
echo "-- Testing fflush(): with more than expected number of arguments --\n";
|
||||
|
||||
$filename = "$file_path/fflush_error.tmp";
|
||||
$file_handle = fopen($filename, "w");
|
||||
if($file_handle == false)
|
||||
exit("Error:failed to open file $filename");
|
||||
|
||||
var_dump( fflush($file_handle, $file_handle) );
|
||||
fclose($file_handle);
|
||||
|
||||
// test invalid arguments : non-resources
|
||||
echo "-- Testing fflush(): with invalid arguments --\n";
|
||||
$invalid_args = array (
|
||||
"string",
|
||||
10,
|
||||
10.5,
|
||||
true,
|
||||
array(1,2,3),
|
||||
new stdclass
|
||||
);
|
||||
|
||||
/* loop to test fflush() with different invalid type of args */
|
||||
for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
|
||||
echo "-- Iteration $loop_counter --\n";
|
||||
var_dump( fflush($invalid_args[$loop_counter - 1]) );
|
||||
}
|
||||
echo "\n*** Done ***";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
unlink("$file_path/fflush_error.tmp");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing error conditions ***
|
||||
-- Testing fflush(): with zero argument --
|
||||
|
||||
Warning: fflush() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
-- Testing fflush(): with more than expected number of arguments --
|
||||
|
||||
Warning: fflush() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
-- Testing fflush(): with invalid arguments --
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: fflush() expects parameter 1 to be resource, object given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
*** Done ***
|
|
@ -1,73 +0,0 @@
|
|||
--TEST--
|
||||
Test fgetc() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: string fgetc ( resource $handle );
|
||||
Description: Gets character from file pointer
|
||||
*/
|
||||
|
||||
echo "*** Testing error conditions ***\n";
|
||||
// zero argument
|
||||
echo "-- Testing fgetc() with zero argument --\n";
|
||||
var_dump( fgetc() );
|
||||
|
||||
// more than expected no. of args
|
||||
echo "-- Testing fgetc() with more than expected number of arguments --\n";
|
||||
$fp = fopen(__FILE__, "r");
|
||||
var_dump( fgetc($fp, $fp) );
|
||||
fclose($fp);
|
||||
|
||||
// test invalid arguments : non-resources
|
||||
echo "-- Testing fgetc() with invalid arguments --\n";
|
||||
$invalid_args = array (
|
||||
"string",
|
||||
10,
|
||||
10.5,
|
||||
true,
|
||||
array(1,2,3),
|
||||
new stdclass,
|
||||
);
|
||||
/* loop to test fgetc() with different invalid type of args */
|
||||
for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
|
||||
echo "-- Iteration $loop_counter --\n";
|
||||
var_dump( fgetc($invalid_args[$loop_counter - 1]) );
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
--EXPECTF--
|
||||
*** Testing error conditions ***
|
||||
-- Testing fgetc() with zero argument --
|
||||
|
||||
Warning: fgetc() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
-- Testing fgetc() with more than expected number of arguments --
|
||||
|
||||
Warning: fgetc() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
-- Testing fgetc() with invalid arguments --
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: fgetc() expects parameter 1 to be resource, object given in %s on line %d
|
||||
bool(false)
|
||||
Done
|
|
@ -1,96 +0,0 @@
|
|||
--TEST--
|
||||
Test fgetcsv() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure [, string $escape]]]] );
|
||||
Description: Gets line from file pointer and parse for CSV fields
|
||||
*/
|
||||
|
||||
echo "*** Testing error conditions ***\n";
|
||||
// zero argument
|
||||
echo "-- Testing fgetcsv() with zero argument --\n";
|
||||
var_dump( fgetcsv() );
|
||||
|
||||
// more than expected no. of args
|
||||
echo "-- Testing fgetcsv() with more than expected number of arguments --\n";
|
||||
$fp = fopen(__FILE__, "r");
|
||||
$len = 1024;
|
||||
$delim = ";";
|
||||
$enclosure ="\"";
|
||||
$escape = '"';
|
||||
var_dump( fgetcsv($fp, $len, $delim, $enclosure, $escape, $fp) );
|
||||
fclose($fp);
|
||||
|
||||
// test invalid arguments : non-resources
|
||||
echo "-- Testing fgetcsv() with invalid arguments --\n";
|
||||
$invalid_args = array (
|
||||
"string",
|
||||
10,
|
||||
10.5,
|
||||
true,
|
||||
array(1,2,3),
|
||||
new stdclass,
|
||||
);
|
||||
/* loop to test fgetcsv() with different invalid type of args */
|
||||
for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
|
||||
echo "-- Iteration $loop_counter --\n";
|
||||
var_dump( fgetcsv($invalid_args[$loop_counter - 1]) ); // with default args
|
||||
var_dump( fgetcsv($invalid_args[$loop_counter - 1], $len, $delim, $enclosure, $escape) ); // all args specified
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
--EXPECTF--
|
||||
*** Testing error conditions ***
|
||||
-- Testing fgetcsv() with zero argument --
|
||||
|
||||
Warning: fgetcsv() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
-- Testing fgetcsv() with more than expected number of arguments --
|
||||
|
||||
Warning: fgetcsv() expects at most 5 parameters, 6 given in %s on line %d
|
||||
NULL
|
||||
-- Testing fgetcsv() with invalid arguments --
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fgetcsv() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,39 +0,0 @@
|
|||
--TEST--
|
||||
Test file_exists() function : error conditions
|
||||
--CREDITS--
|
||||
Dave Kelsey <d_kelsey@uk.ibm.com>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto bool file_exists(string filename)
|
||||
* Description: Returns true if filename exists
|
||||
* Source code: ext/standard/filestat.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing file_exists() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing file_exists() function with Zero arguments --\n";
|
||||
var_dump( file_exists() );
|
||||
|
||||
//Test file_exists with one more than the expected number of arguments
|
||||
echo "\n-- Testing file_exists() function with more than expected no. of arguments --\n";
|
||||
$filename = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( file_exists($filename, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing file_exists() : error conditions ***
|
||||
|
||||
-- Testing file_exists() function with Zero arguments --
|
||||
|
||||
Warning: file_exists() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing file_exists() function with more than expected no. of arguments --
|
||||
|
||||
Warning: file_exists() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,250 +0,0 @@
|
|||
--TEST--
|
||||
Test file_put_contents() function : usage variation - different types for context.
|
||||
--CREDITS--
|
||||
Dave Kelsey <d_kelsey@uk.ibm.com>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
|
||||
* Description: Write/Create a file with contents data and return the number of bytes written
|
||||
* Source code: ext/standard/file.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing file_put_contents() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$filename = 'FilePutContentsVar4.tmp';
|
||||
$absFile = dirname(__FILE__).'/'.$filename;
|
||||
|
||||
$fileRes = fopen(__FILE__,'r');
|
||||
$strContext = stream_context_create();
|
||||
|
||||
$data = "data to write";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// string data
|
||||
'string DQ' => "string",
|
||||
'string SQ' => 'string',
|
||||
'mixed case string' => "sTrInG",
|
||||
'heredoc' => $heredoc,
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
//non context resource
|
||||
'file resource' => $fileRes,
|
||||
|
||||
//valid stream context
|
||||
'stream context' => $strContext,
|
||||
);
|
||||
|
||||
// loop through each element of the array for context
|
||||
|
||||
foreach($inputs as $key =>$value) {
|
||||
echo "\n--$key--\n";
|
||||
var_dump( file_put_contents($absFile, $data, null, $value) );
|
||||
};
|
||||
|
||||
unlink($absFile);
|
||||
fclose($fileRes);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing file_put_contents() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, int given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int 1--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, int given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int 12345--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, int given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int -12345--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, int given, %s(%d)
|
||||
NULL
|
||||
|
||||
--float 10.5--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, float given, %s(%d)
|
||||
NULL
|
||||
|
||||
--float -10.5--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, float given, %s(%d)
|
||||
NULL
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, float given, %s(%d)
|
||||
NULL
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, float given, %s(%d)
|
||||
NULL
|
||||
|
||||
--float .5--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, float given, %s(%d)
|
||||
NULL
|
||||
|
||||
--empty array--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
int(13)
|
||||
|
||||
--lowercase null--
|
||||
int(13)
|
||||
|
||||
--lowercase true--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, bool given, %s(%d)
|
||||
NULL
|
||||
|
||||
--lowercase false--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, bool given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, bool given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, bool given, %s(%d)
|
||||
NULL
|
||||
|
||||
--empty string DQ--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--empty string SQ--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--string DQ--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--string SQ--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--mixed case string--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--heredoc--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
|
||||
NULL
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
int(13)
|
||||
|
||||
--unset var--
|
||||
int(13)
|
||||
|
||||
--file resource--
|
||||
Error: 2 - file_put_contents(): supplied resource is not a valid Stream-Context resource, %s(%d)
|
||||
int(13)
|
||||
|
||||
--stream context--
|
||||
int(13)
|
||||
===DONE===
|
|
@ -1,57 +0,0 @@
|
|||
--TEST--
|
||||
Test fnmatch() function: Error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists('fnmatch'))
|
||||
die("skip fnmatch() function is not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
|
||||
Description: fnmatch() checks if the passed string would match
|
||||
the given shell wildcard pattern.
|
||||
*/
|
||||
|
||||
echo "*** Testing error conditions for fnmatch() ***";
|
||||
|
||||
/* Invalid arguments */
|
||||
var_dump( fnmatch(array(), array()) );
|
||||
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
var_dump( fnmatch($file_handle, $file_handle) );
|
||||
fclose( $file_handle );
|
||||
|
||||
$std_obj = new stdClass();
|
||||
var_dump( fnmatch($std_obj, $std_obj) );
|
||||
|
||||
|
||||
/* No.of arguments less than expected */
|
||||
var_dump( fnmatch("match.txt") );
|
||||
var_dump( fnmatch("") );
|
||||
|
||||
/* No.of arguments greater than expected */
|
||||
var_dump( fnmatch("match.txt", "match.txt", TRUE, 100) );
|
||||
|
||||
echo "\n*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing error conditions for fnmatch() ***
|
||||
Warning: fnmatch() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fnmatch() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fnmatch() expects parameter 1 to be a valid path, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
|
||||
NULL
|
||||
|
||||
Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
|
||||
NULL
|
||||
|
||||
Warning: fnmatch() expects at most 3 parameters, 4 given in %s on line %d%d
|
||||
NULL
|
||||
|
||||
*** Done ***
|
|
@ -1,40 +0,0 @@
|
|||
--TEST--
|
||||
Test fpassthru() function: Error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: int fpassthru ( resource $handle );
|
||||
Description: Reads to EOF on the given file pointer from the current position
|
||||
and writes the results to the output buffer.
|
||||
*/
|
||||
|
||||
echo "*** Test error conditions of fpassthru() function ***\n";
|
||||
|
||||
/* Non-existing file resource */
|
||||
$no_file = fread("/no/such/file", "r");
|
||||
var_dump( fpassthru($no_file) );
|
||||
|
||||
/* No.of args less than expected */
|
||||
var_dump( fpassthru() );
|
||||
|
||||
/* No.of args greaer than expected */
|
||||
var_dump( fpassthru("", "") );
|
||||
|
||||
echo "\n*** Done ***\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test error conditions of fpassthru() function ***
|
||||
|
||||
Warning: fread() expects parameter 1 to be resource, string given in %s on line %d
|
||||
|
||||
Warning: fpassthru() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fpassthru() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fpassthru() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
*** Done ***
|
|
@ -1,96 +0,0 @@
|
|||
--TEST--
|
||||
Test fputcsv() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype: int fputcsv ( resource $handle [, array $fields [, string $delimiter [, string $enclosure]]] );
|
||||
Description:fputcsv() formats a line (passed as a fields array) as CSV and write it to the specified file
|
||||
handle. Returns the length of the written string, or FALSE on failure.
|
||||
*/
|
||||
|
||||
echo "*** Testing error conditions ***\n";
|
||||
// zero argument
|
||||
echo "-- Testing fputcsv() with zero argument --\n";
|
||||
var_dump( fputcsv() );
|
||||
|
||||
// more than expected no. of args
|
||||
echo "-- Testing fputcsv() with more than expected number of arguments --\n";
|
||||
$fp = fopen(__FILE__, "r");
|
||||
$fields = array("fld1", "fld2");
|
||||
$delim = ";";
|
||||
$enclosure ="\"";
|
||||
var_dump( fputcsv($fp, $fields, $delim, $enclosure, $fp) );
|
||||
fclose($fp);
|
||||
|
||||
// test invalid arguments : non-resources
|
||||
echo "-- Testing fputcsv() with invalid arguments --\n";
|
||||
$invalid_args = array (
|
||||
"string",
|
||||
10,
|
||||
10.5,
|
||||
true,
|
||||
array(1,2,3),
|
||||
new stdclass,
|
||||
);
|
||||
/* loop to test fputcsv() with different invalid type of args */
|
||||
for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
|
||||
echo "-- Iteration $loop_counter --\n";
|
||||
var_dump( fputcsv($invalid_args[$loop_counter - 1]) ); // with default args
|
||||
var_dump( fputcsv($invalid_args[$loop_counter - 1], $fields, $delim, $enclosure) ); // all args specified
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
--EXPECTF--
|
||||
*** Testing error conditions ***
|
||||
-- Testing fputcsv() with zero argument --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
-- Testing fputcsv() with more than expected number of arguments --
|
||||
|
||||
Warning: fputcsv() expects parameter 5 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
-- Testing fputcsv() with invalid arguments --
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: fputcsv() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,21 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by calling it more than or less than its expected arguments
|
||||
--FILE--
|
||||
<?php
|
||||
$fp = fopen (__FILE__, 'r');
|
||||
$extra_arg = 'nothing';
|
||||
|
||||
var_dump(fstat( $fp, $extra_arg ) );
|
||||
var_dump(fstat());
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,33 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by substituting argument 1 with array values.
|
||||
--FILE--
|
||||
<?php
|
||||
$index_array = array(1, 2, 3);
|
||||
$assoc_array = array(1 => 'one', 2 => 'two');
|
||||
|
||||
$variation_array = array(
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
);
|
||||
|
||||
|
||||
foreach ( $variation_array as $var ) {
|
||||
var_dump(fstat( $var ) );
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,30 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by substituting argument 1 with boolean values.
|
||||
--FILE--
|
||||
<?php
|
||||
$variation_array = array(
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
);
|
||||
|
||||
|
||||
foreach ( $variation_array as $var ) {
|
||||
var_dump(fstat( $var ) );
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by substituting argument 1 with float values.
|
||||
--FILE--
|
||||
<?php
|
||||
$variation_array = array(
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
);
|
||||
|
||||
|
||||
foreach ( $variation_array as $var ) {
|
||||
var_dump(fstat( $var ) );
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, float given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,30 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by substituting argument 1 with int values.
|
||||
--FILE--
|
||||
<?php
|
||||
$variation_array = array (
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
);
|
||||
|
||||
|
||||
foreach ( $variation_array as $var ) {
|
||||
var_dump(fstat( $var ) );
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, int given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
Test function fstat() by substituting argument 1 with string values.
|
||||
--FILE--
|
||||
<?php
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
$variation_array = array(
|
||||
'string DQ' => "string",
|
||||
'string SQ' => 'string',
|
||||
'mixed case string' => "sTrInG",
|
||||
'heredoc' => $heredoc,
|
||||
);
|
||||
|
||||
|
||||
foreach ( $variation_array as $var ) {
|
||||
var_dump(fstat( $var ) );
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
|
@ -1,53 +0,0 @@
|
|||
--TEST--
|
||||
Test glob() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: array glob ( string $pattern [, int $flags] );
|
||||
Description: Find pathnames matching a pattern
|
||||
*/
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
|
||||
// temp dir created
|
||||
mkdir("$file_path/glob_error");
|
||||
// temp file created
|
||||
$fp = fopen("$file_path/glob_error/wonder12345", "w");
|
||||
fclose($fp);
|
||||
|
||||
echo "*** Testing glob() : error conditions ***\n";
|
||||
|
||||
echo "-- Testing glob() with unexpected no. of arguments --\n";
|
||||
var_dump( glob() ); // args < expected
|
||||
var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", GLOB_ERR, 3) ); // args > expected
|
||||
|
||||
echo "\n-- Testing glob() with invalid arguments --\n";
|
||||
var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", '') );
|
||||
var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", "string") );
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
// temp file deleted
|
||||
unlink(dirname(__FILE__)."/glob_error/wonder12345");
|
||||
// temp dir deleted
|
||||
rmdir(dirname(__FILE__)."/glob_error");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing glob() : error conditions ***
|
||||
-- Testing glob() with unexpected no. of arguments --
|
||||
|
||||
Warning: glob() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: glob() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing glob() with invalid arguments --
|
||||
|
||||
Warning: glob() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: glob() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
Test is_dir() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool is_dir ( string $filename );
|
||||
* Description: Tells whether the filename is a regular file
|
||||
* Returns TRUE if the filename exists and is a regular file
|
||||
*/
|
||||
|
||||
echo "*** Testing is_dir() error conditions ***";
|
||||
var_dump( is_dir() ); // Zero No. of args
|
||||
|
||||
$dir_name = dirname(__FILE__)."/is_dir_error";
|
||||
mkdir($dir_name);
|
||||
var_dump( is_dir($dir_name, "is_dir_error1") ); // args > expected no.of args
|
||||
|
||||
/* Non-existing dir */
|
||||
var_dump( is_dir("/no/such/dir") );
|
||||
|
||||
echo "*** Done ***";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
rmdir(dirname(__FILE__)."/is_dir_error");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing is_dir() error conditions ***
|
||||
Warning: is_dir() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: is_dir() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
*** Done ***
|
|
@ -1,50 +0,0 @@
|
|||
--TEST--
|
||||
Test is_file() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool is_file ( string $filename );
|
||||
Description: Tells whether the filename is a regular file
|
||||
Returns TRUE if the filename exists and is a regular file
|
||||
*/
|
||||
|
||||
echo "*** Testing is_file() error conditions ***";
|
||||
$file_path = dirname(__FILE__);
|
||||
var_dump( is_file() ); // Zero No. of args
|
||||
|
||||
/* no of args > expected */
|
||||
$file_handle = fopen($file_path."/is_file_error.tmp", "w");
|
||||
var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") );
|
||||
|
||||
/* Non-existing file */
|
||||
var_dump( is_file($file_path."/is_file_error1.tmp") );
|
||||
|
||||
/* Passing resource as an argument */
|
||||
var_dump( is_file($file_handle) );
|
||||
|
||||
fclose($file_handle);
|
||||
|
||||
echo "\n*** Done ***";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
if(file_exists($file_path."/is_file_error.tmp")) {
|
||||
unlink($file_path."/is_file_error.tmp");
|
||||
}
|
||||
if(file_exists($file_path."/is_file_error1.tmp")) {
|
||||
unlink($file_path."/is_file_error1.tmp");
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing is_file() error conditions ***
|
||||
Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
*** Done ***
|
|
@ -1,24 +0,0 @@
|
|||
--TEST--
|
||||
Test pathinfo() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: mixed pathinfo ( string $path [, int $options] );
|
||||
Description: Returns information about a file path
|
||||
*/
|
||||
|
||||
echo "*** Testing pathinfo() for error conditions ***\n";
|
||||
/* unexpected no. of arguments */
|
||||
var_dump( pathinfo() ); /* args < expected */
|
||||
var_dump( pathinfo("/home/1.html", 1, 3) ); /* args > expected */
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing pathinfo() for error conditions ***
|
||||
|
||||
Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: pathinfo() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
Done
|
|
@ -1,48 +0,0 @@
|
|||
--TEST--
|
||||
Test tempnam() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: string tempnam ( string $dir, string $prefix );
|
||||
Description: Create file with unique file name.
|
||||
*/
|
||||
|
||||
echo "*** Testing tempnam() error conditions ***\n";
|
||||
$file_path = dirname(__FILE__);
|
||||
|
||||
/* More number of arguments than expected */
|
||||
var_dump( tempnam("$file_path", "tempnam_error.tmp", "") ); //Two Valid & One Invalid
|
||||
var_dump( tempnam("$file_path", "tempnam_error.tmp", TRUE) );
|
||||
|
||||
/* Less number of arguments than expected */
|
||||
var_dump( tempnam("tempnam_error") ); //One Valid arg
|
||||
var_dump( tempnam("$file_path") ); //One Valid arg
|
||||
var_dump( tempnam("") ); //Empty string
|
||||
var_dump( tempnam(NULL) ); //NULL as arg
|
||||
var_dump( tempnam() ); //Zero args
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing tempnam() error conditions ***
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: tempnam() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
*** Done ***
|
|
@ -1,29 +0,0 @@
|
|||
--TEST--
|
||||
Test wrong number of arguments for atanh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float atanh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(atanh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(atanh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: atanh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: atanh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
|
@ -1,29 +0,0 @@
|
|||
--TEST--
|
||||
Test wrong number of arguments for sinh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float sinh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(sinh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(sinh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: sinh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: sinh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
|
@ -1,37 +0,0 @@
|
|||
--TEST--
|
||||
Test token_get_all() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array token_get_all(string $source)
|
||||
* Description: splits the given source into an array of PHP languange tokens
|
||||
* Source code: ext/tokenizer/tokenizer.c
|
||||
*/
|
||||
|
||||
echo "*** Testing token_get_all() : error conditions ***\n";
|
||||
|
||||
// with zero arguments
|
||||
echo "\n-- Testing token_get_all() function with zero arguments --\n";
|
||||
var_dump( token_get_all());
|
||||
|
||||
// with one more than the expected number of arguments
|
||||
echo "-- Testing token_get_all() function with more than expected no. of arguments --\n";
|
||||
$source = '<?php ?>';
|
||||
$extra_arg = 10;
|
||||
var_dump( token_get_all($source, true, $extra_arg));
|
||||
|
||||
echo "Done"
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing token_get_all() : error conditions ***
|
||||
|
||||
-- Testing token_get_all() function with zero arguments --
|
||||
|
||||
Warning: token_get_all() expects at least 1 parameter, 0 given in %s on line 11
|
||||
NULL
|
||||
-- Testing token_get_all() function with more than expected no. of arguments --
|
||||
|
||||
Warning: token_get_all() expects at most 2 parameters, 3 given in %s on line 17
|
||||
NULL
|
||||
Done
|
|
@ -1,15 +0,0 @@
|
|||
--TEST--
|
||||
xmlwriter_open_uri without parameter
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(xmlwriter_open_uri());
|
||||
?>
|
||||
--CREDITS--
|
||||
Koen Kuipers koenk82@gmail.com
|
||||
Theo van der Zee
|
||||
#Test Fest Utrecht 09-05-2009
|
||||
--EXPECTF--
|
||||
Warning: xmlwriter_open_uri() expects exactly %d parameter, %d given in %s on line %d
|
||||
NULL
|
|
@ -1,23 +0,0 @@
|
|||
--TEST--
|
||||
xmlwriter_set_indent_string with missing param(s)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$temp_filename = dirname(__FILE__)."/xmlwriter_set_indent_string_error.tmp";
|
||||
$fp = fopen($temp_filename, "w");
|
||||
fwrite ($fp, "Hi");
|
||||
fclose($fp);
|
||||
$resource = xmlwriter_open_uri($temp_filename);
|
||||
var_dump(xmlwriter_set_indent_string($resource));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$temp_filename = dirname(__FILE__)."/xmlwriter_set_indent_string_error.tmp";
|
||||
unlink($temp_filename);
|
||||
?>
|
||||
--CREDITS--
|
||||
Koen Kuipers koenk82@gmail.com
|
||||
--EXPECTF--
|
||||
Warning: xmlwriter_set_indent_string() expects exactly %d parameters, %d given in %s on line %d
|
||||
NULL
|
|
@ -1,33 +0,0 @@
|
|||
--TEST--
|
||||
xmlwriter_write_attribute_ns with missing param
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xw = xmlwriter_open_memory();
|
||||
xmlwriter_set_indent($xw, TRUE);
|
||||
xmlwriter_start_document($xw, NULL, "UTF-8");
|
||||
xmlwriter_start_element($xw, 'root');
|
||||
xmlwriter_write_attribute_ns($xw, 'prefix', '', 'http://www.php.net/uri');
|
||||
xmlwriter_start_element($xw, 'elem1');
|
||||
xmlwriter_write_attribute($xw, 'attr1', 'first');
|
||||
xmlwriter_end_element($xw);
|
||||
xmlwriter_full_end_element($xw);
|
||||
xmlwriter_end_document($xw);
|
||||
|
||||
$output = xmlwriter_flush($xw, true);
|
||||
print $output;
|
||||
|
||||
// write attribute_ns without start_element first
|
||||
$xw = xmlwriter_open_memory();
|
||||
var_dump(xmlwriter_write_attribute_ns($xw, 'prefix', 'id', 'http://www.php.net/uri', 'elem1'));
|
||||
print xmlwriter_output_memory($xw);
|
||||
?>
|
||||
--CREDITS--
|
||||
Koen Kuipers koenk82@gmail.com
|
||||
--EXPECTF--
|
||||
Warning: xmlwriter_write_attribute_ns() expects exactly %d parameters, %d given in %s on line %d
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<elem1 attr1="first"/>
|
||||
</root>%wbool(false)
|
|
@ -1,14 +0,0 @@
|
|||
--TEST--
|
||||
xmlwriter_write_dtd with missing param(s)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xmlwriter = xmlwriter_open_memory();
|
||||
var_dump(xmlwriter_write_dtd($xmlwriter));
|
||||
?>
|
||||
--CREDITS--
|
||||
Koen Kuipers koenk82@gmail.com
|
||||
--EXPECTF--
|
||||
Warning: xmlwriter_write_dtd() expects at least %d parameters, %d given in %s on line %d
|
||||
NULL
|
Loading…
Add table
Add a link
Reference in a new issue