dba_sync.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. DBA Sync Test
  3. --SKIPIF--
  4. <?php
  5. require_once dirname(__FILE__) .'/skipif.inc';
  6. die("info $HND handler used");
  7. ?>
  8. --FILE--
  9. <?php
  10. require_once(dirname(__FILE__) .'/test.inc');
  11. echo "database handler: $handler\n";
  12. if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
  13. dba_insert("key1", "Content String 1", $db_file);
  14. dba_insert("key2", "Content String 2", $db_file);
  15. $a = dba_firstkey($db_file);
  16. $i=0;
  17. while($a) {
  18. $a = dba_nextkey($db_file);
  19. $i++;
  20. }
  21. echo $i;
  22. for ($i=1; $i<3; $i++) {
  23. echo dba_exists("key$i", $db_file) ? "Y" : "N";
  24. }
  25. echo "\n";
  26. var_dump(dba_sync());
  27. var_dump(dba_sync(""));
  28. var_dump(dba_sync($db_file));
  29. dba_close($db_file);
  30. } else {
  31. echo "Error creating database\n";
  32. }
  33. ?>
  34. ===DONE===
  35. <?php exit(0); ?>
  36. --CLEAN--
  37. <?php
  38. require(dirname(__FILE__) .'/clean.inc');
  39. ?>
  40. --EXPECTF--
  41. database handler: flatfile
  42. 2YY
  43. Warning: dba_sync() expects exactly 1 parameter, 0 given in %sdba_sync.php on line %d
  44. NULL
  45. Warning: dba_sync() expects parameter 1 to be resource, string given in %sdba_sync.php on line %d
  46. NULL
  47. bool(true)
  48. ===DONE===