]> granicus.if.org Git - php/commitdiff
Create temporary sqlite db in test dir rather than cwd (and clean it up)
authorSara Golemon <pollita@php.net>
Sat, 30 Apr 2016 06:02:01 +0000 (06:02 +0000)
committerSara Golemon <pollita@php.net>
Sat, 30 Apr 2016 06:02:01 +0000 (06:02 +0000)
Well behaved tests do not leave their droppings all over the filesystem.

ext/pdo_sqlite/tests/bug70221.phpt

index 1ee2378bc66d119e99ba17f2140421c3137b01cd..bead80d23343ea2b796c3db5da236d50fbede201 100644 (file)
@@ -6,10 +6,13 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
 ?>
 --FILE--
 <?php
-$db = new PDO('sqlite:test.sqlite', null, null, array(PDO::ATTR_PERSISTENT => true));
+$dbfile = __DIR__ . '/test.sqlite';
+$db = new PDO('sqlite:'.$dbfile, null, null, array(PDO::ATTR_PERSISTENT => true));
 function _test() { return 42; }
 $db->sqliteCreateFunction('test', '_test', 0);
 print("Everything is fine, no exceptions here\n");
+unset($db);
+unlink($dbfile);
 ?>
 --EXPECT--
 Everything is fine, no exceptions here