tests: fix ndbm cleanup
authorMichael Wallner <mike@php.net>
Wed, 19 Oct 2016 07:18:30 +0000 (07:18 +0000)
committerMichael Wallner <mike@php.net>
Wed, 19 Oct 2016 07:18:30 +0000 (07:18 +0000)
tests/ndbm/ndbm001.phpt

index 27012be..2914bac 100644 (file)
@@ -3,36 +3,36 @@ ndbm
 --INI--
 psi.directory={PWD}:{PWD}/../../psi.d
 --SKIPIF--
-<?php 
+<?php
 extension_loaded("psi") or die("skip - need ext/psi");
 function_exists("psi\\dbm_open") or die("skip - need nbdm support");
 ?>
 --FILE--
 ===TEST===
-<?php 
+<?php
 class db {
        private $db;
-       
-       function __construct($file = "ndbm001.db", $o = psi\O_CREAT|psi\O_RDWR, $m = 0640) {
+
+       function __construct($file = __DIR__."/ndbm001.db", $o = psi\O_CREAT|psi\O_RDWR, $m = 0640) {
                if (!$this->db = psi\dbm_open($file, $o, $m)) {
                        throw new Exception(psi\strerror(psi\errno()));
                }
        }
-       
+
        function __destruct() {
                psi\dbm_close($this->db);
        }
-       
+
        function __set($k, $v) {
                return psi\dbm_store($this->db, [
-                               "dptr" => $k, 
+                               "dptr" => $k,
                                "dsize" => strlen($k)
                        ], [
                                "dptr" => $v,
                                "dsize" => strlen($v)
                        ], psi\DBM_REPLACE);
        }
-       
+
        function __get($k) {
                $val = psi\dbm_fetch($this->db, [
                        "dptr" => $k,
@@ -50,8 +50,8 @@ var_dump($db->key);
 ?>
 ===DONE===
 --CLEAN--
-<?php 
-@unlink("ndbm001.db");
+<?php
+array_map("unlink", glob(__DIR__."/ndbm001.db*"));
 ?>
 --EXPECT--
 ===TEST===