bug73959.phpt 746 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #73959 (lastInsertId fails to throw an exception)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_pgsql
  6. --SKIPIF--
  7. <?php
  8. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  9. require __DIR__ . '/config.inc';
  10. PDOTest::skip();
  11. ?>
  12. --FILE--
  13. <?php
  14. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  15. require __DIR__ . '/config.inc';
  16. $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
  17. $db->setAttribute(PDO::ATTR_PERSISTENT, false);
  18. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  19. $db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
  20. try {
  21. $db->lastInsertId('nonexistent_seq');
  22. echo "Error: No exception thrown";
  23. } catch (PDOException $e) {
  24. echo "Success: Exception thrown";
  25. }
  26. ?>
  27. --EXPECT--
  28. Success: Exception thrown