File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sqlite3 / tests / sqlite3_15_open_error.phpt
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:04 2013 UTC (11 years ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--TEST--
SQLite3::open error test
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
	die('skip non windows test');
}
require_once(__DIR__ . '/skipif.inc');
if (posix_geteuid() == 0) {
    die('SKIP Cannot run test as root.');
}
?>
--FILE--
<?php
$unreadable = __DIR__ . '/unreadable.db';
touch($unreadable);
chmod($unreadable,  0200);
try {
	$db = new SQLite3($unreadable);
} catch (Exception $e) {
	echo $e . "\n";
}
echo "Done\n";
unlink($unreadable);
?>
--EXPECTF--
exception 'Exception' with message 'Unable to open database: %s' in %ssqlite3_15_open_error.php:%d
Stack trace:
#0 %ssqlite3_15_open_error.php(%d): SQLite3->__construct('%s')
#1 {main}
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>