Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SQLite3::open error test
3: --SKIPIF--
4: <?php
5: if(substr(PHP_OS, 0, 3) != 'WIN' ) {
6: die('skip windows only test');
7: }
8: require_once(__DIR__ . '/skipif.inc');
9: ?>
10: --FILE--
11: <?php
12: $sysroot = exec('echo %systemroot%');
13: $icacls = "$sysroot\\System32\\icacls.exe";
14: $user = get_current_user();
15: $unreadable = __DIR__ . '/unreadable.db';
16:
17: touch($unreadable);
18: $cmd = $icacls . ' ' . $unreadable . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
19: exec($cmd);
20:
21: try {
22: $db = new SQLite3($unreadable);
23: } catch (Exception $e) {
24: echo $e . "\n";
25: }
26: echo "Done\n";
27:
28: $cmd = $icacls . ' ' . $unreadable . ' /grant ' . $user . ':(F,M,R,RX,W)';
29: exec($cmd);
30: unlink($unreadable);
31: ?>
32: --EXPECTF--
33: exception 'Exception' with message 'Unable to open database: %s' in %ssqlite3_15_open_error-win.php:%d
34: Stack trace:
35: #0 %ssqlite3_15_open_error-win.php(%d): SQLite3->__construct('%s')
36: #1 {main}
37: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>