Merge branch 'slimconfigure'
[m6w6/ext-psi] / tests / ndbm / ndbm001.phpt
index 27012be..ef6a906 100644 (file)
@@ -3,36 +3,31 @@ 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");
+#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);
+               array_map("unlink", glob(__DIR__."/ndbm001.db*"));
        }
-       
+
        function __set($k, $v) {
-               return psi\dbm_store($this->db, [
-                               "dptr" => $k, 
-                               "dsize" => strlen($k)
-                       ], [
-                               "dptr" => $v,
-                               "dsize" => strlen($v)
-                       ], psi\DBM_REPLACE);
+               return psi\dbm_store($this->db, $k, $v, psi\DBM_REPLACE);
        }
-       
+
        function __get($k) {
                $val = psi\dbm_fetch($this->db, [
                        "dptr" => $k,
@@ -50,8 +45,8 @@ var_dump($db->key);
 ?>
 ===DONE===
 --CLEAN--
-<?php 
-@unlink("ndbm001.db");
+<?php
+array_map("unlink", glob(__DIR__."/ndbm001.db*"));
 ?>
 --EXPECT--
 ===TEST===