pdo_mysql_interface.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --TEST--
  2. MySQL PDO class interface
  3. --SKIPIF--
  4. <?php
  5. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
  6. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  7. MySQLPDOTest::skip();
  8. $db = MySQLPDOTest::factory();
  9. if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
  10. die("skip Transactional engine not found");
  11. ?>
  12. --FILE--
  13. <?php
  14. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  15. $db = MySQLPDOTest::factory();
  16. $expected = array(
  17. '__construct' => true,
  18. 'prepare' => true,
  19. 'beginTransaction' => true,
  20. 'commit' => true,
  21. 'rollBack' => true,
  22. 'setAttribute' => true,
  23. 'exec' => true,
  24. 'query' => true,
  25. 'lastInsertId' => true,
  26. 'errorCode' => true,
  27. 'errorInfo' => true,
  28. 'getAttribute' => true,
  29. 'quote' => true,
  30. 'inTransaction' => true,
  31. '__wakeup' => true,
  32. '__sleep' => true,
  33. 'getAvailableDrivers' => true,
  34. );
  35. $classname = get_class($db);
  36. $methods = get_class_methods($classname);
  37. foreach ($methods as $k => $method) {
  38. if (isset($expected[$method])) {
  39. unset($expected[$method]);
  40. unset($methods[$k]);
  41. }
  42. if ($method == $classname) {
  43. unset($expected['__construct']);
  44. unset($methods[$k]);
  45. }
  46. }
  47. if (!empty($expected)) {
  48. printf("Dumping missing class methods\n");
  49. var_dump($expected);
  50. }
  51. if (!empty($methods)) {
  52. printf("Found more methods than expected, dumping list\n");
  53. var_dump($methods);
  54. }
  55. print "done!";
  56. --EXPECT--
  57. done!