1--TEST--
2PDO OCI checkliveness (code coverage)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
6require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
7PDOTest::skip();
8?>
9--FILE--
10<?php
11
12require 'ext/pdo/tests/pdo_test.inc';
13$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
14
15$dsn = getenv('PDOTEST_DSN');
16$user = getenv('PDOTEST_USER');
17$pass = getenv('PDOTEST_PASS');
18$attr = getenv('PDOTEST_ATTR');
19
20try {
21    $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
22}
23catch (PDOException $e) {
24    echo 'Connection failed: ' . $e->getMessage();
25    exit;
26}
27
28// This triggers the call to check liveness
29try {
30    $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
31}
32catch (PDOException $e) {
33    echo 'Connection failed: ' . $e->getMessage();
34    exit;
35}
36
37$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
38
39try {
40    $stmt = $db->prepare('SELECT * FROM dual');
41    $stmt->execute();
42    $row = $stmt->fetch();
43    var_dump($row);
44} catch (PDOException $e) {
45    print $e->getMessage();
46}
47
48$db = null;
49--EXPECTF--
50array(2) {
51  ["DUMMY"]=>
52  string(1) "X"
53  [0]=>
54  string(1) "X"
55}
56