diff options
author | Felipe Pena <felipe@php.net> | 2008-11-11 17:54:11 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-11-11 17:54:11 +0000 |
commit | 02050bc6f5c45ae71ea81690c1623033e024be52 (patch) | |
tree | 0edabd03a4e5a7fe777ced4b9f555906faf0383d | |
parent | 9b894e6e62f2af312f0a193a2039897eec3d0928 (diff) | |
download | php-git-02050bc6f5c45ae71ea81690c1623033e024be52.tar.gz |
- New tests
-rw-r--r-- | ext/interbase/tests/ibase_close_001.phpt | 25 | ||||
-rw-r--r-- | ext/interbase/tests/ibase_drop_db_001.phpt | 31 | ||||
-rw-r--r-- | ext/interbase/tests/ibase_num_fields_001.phpt | 25 | ||||
-rw-r--r-- | ext/interbase/tests/ibase_rollback_001.phpt | 41 |
4 files changed, 122 insertions, 0 deletions
diff --git a/ext/interbase/tests/ibase_close_001.phpt b/ext/interbase/tests/ibase_close_001.phpt new file mode 100644 index 0000000000..6e31916abe --- /dev/null +++ b/ext/interbase/tests/ibase_close_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +ibase_close(): Basic test +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +require("interbase.inc"); + +$x = ibase_connect($test_base); +var_dump(ibase_close($x)); +var_dump(ibase_close($x)); +var_dump(ibase_close()); +var_dump(ibase_close('foo')); + +?> +--EXPECTF-- +bool(true) +bool(true) + +Warning: ibase_close(): %d is not a valid Firebird/InterBase link resource in %s on line %d +bool(false) + +Warning: ibase_close() expects parameter 1 to be resource,%string given in %s on line %d +NULL diff --git a/ext/interbase/tests/ibase_drop_db_001.phpt b/ext/interbase/tests/ibase_drop_db_001.phpt new file mode 100644 index 0000000000..7526e13144 --- /dev/null +++ b/ext/interbase/tests/ibase_drop_db_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +ibase_drop_db(): Basic test +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +require("interbase.inc"); + +unlink($file = tempnam('/tmp',"php_ibase_test")); + + +$db = ibase_query(IBASE_CREATE, + sprintf("CREATE SCHEMA '%s' USER '%s' PASSWORD '%s' DEFAULT CHARACTER SET %s",$file, + $user, $password, ($charset = ini_get('ibase.default_charset')) ? $charset : 'NONE')); + +var_dump($db); +var_dump(ibase_drop_db($db)); +var_dump(ibase_drop_db(1)); +var_dump(ibase_drop_db(NULL)); + +?> +--EXPECTF-- +resource(%d) of type (Firebird/InterBase link) +bool(true) + +Warning: ibase_drop_db() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Warning: ibase_drop_db() expects parameter 1 to be resource, null given in %s on line %d +NULL diff --git a/ext/interbase/tests/ibase_num_fields_001.phpt b/ext/interbase/tests/ibase_num_fields_001.phpt new file mode 100644 index 0000000000..510b0f6f58 --- /dev/null +++ b/ext/interbase/tests/ibase_num_fields_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +ibase_num_fields(): Basic test +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +require("interbase.inc"); + +$x = ibase_connect($test_base); + +var_dump(ibase_num_fields(ibase_query('SELECT * FROM test1'))); + +var_dump(ibase_num_fields(1)); +var_dump(ibase_num_fields()); + +?> +--EXPECTF-- +int(2) + +Warning: ibase_num_fields(): supplied argument is not a valid Firebird/InterBase result resource in %s on line %d +bool(false) + +Warning: Wrong parameter count for ibase_num_fields() in %s on line %d +NULL diff --git a/ext/interbase/tests/ibase_rollback_001.phpt b/ext/interbase/tests/ibase_rollback_001.phpt new file mode 100644 index 0000000000..3cde5e9d46 --- /dev/null +++ b/ext/interbase/tests/ibase_rollback_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +ibase_rollback(): Basic test +--SKIPIF-- +<?php include("skipif.inc"); ?> +--FILE-- +<?php + +require("interbase.inc"); + +$x = ibase_connect($test_base); + +ibase_query('INSERT INTO test1 VALUES (100, 2)'); +ibase_query('INSERT INTO test1 VALUES (100, 2)'); +ibase_query('INSERT INTO test1 VALUES (100, 2)'); + +$rs = ibase_query('SELECT COUNT(*) FROM test1 WHERE i = 100'); +var_dump(ibase_fetch_row($rs)); + +var_dump(ibase_rollback($x)); + +$rs = ibase_query('SELECT COUNT(*) FROM test1 WHERE i = 100'); +var_dump(ibase_fetch_row($rs)); + +var_dump(ibase_rollback($x)); +var_dump(ibase_rollback()); + +?> +--EXPECTF-- +array(1) { + [0]=> + int(3) +} +bool(true) +array(1) { + [0]=> + int(0) +} +bool(true) + +Warning: ibase_rollback(): invalid transaction handle (expecting explicit transaction start) in %s on line %d +bool(false) |