diff options
| author | Wez Furlong <wez@php.net> | 2005-07-06 06:10:52 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2005-07-06 06:10:52 +0000 |
| commit | e39f37d36b490eac7922d5a89a4450e2ce2cdd2e (patch) | |
| tree | 51fb0d33a821371899da4b3d830bb91aa67dc683 /ext/pdo_odbc/tests/common.phpt | |
| parent | 35dbaea547fa3847da732812421875438f9f97ad (diff) | |
| download | php-git-e39f37d36b490eac7922d5a89a4450e2ce2cdd2e.tar.gz | |
replace pdo_odbc tests with new redirection thingy
Diffstat (limited to 'ext/pdo_odbc/tests/common.phpt')
| -rw-r--r-- | ext/pdo_odbc/tests/common.phpt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/pdo_odbc/tests/common.phpt b/ext/pdo_odbc/tests/common.phpt new file mode 100644 index 0000000000..607afb0900 --- /dev/null +++ b/ext/pdo_odbc/tests/common.phpt @@ -0,0 +1,46 @@ +--TEST-- +ODBC +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded('pdo_odbc')) print 'skip'; ?> +--REDIRECTTEST-- +# magic auto-configuration + +$config = array( + 'TESTS' => 'ext/pdo/tests' +); + + +if (false !== getenv('PDO_ODBC_TEST_DSN')) { + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_ODBC_TEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDO_ODBC_TEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDO_ODBC_TEST_PASS'); + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_ODBC_TEST_ATTR'); +} elseif (preg_match('/^WIN/i', PHP_OS)) { + # on windows, try to create a temporary MS access database + $path = realpath(dirname(__FILE__)) . '\pdo_odbc.mdb'; + if (!file_exists($path)) { + try { + $adox = new COM('ADOX.Catalog'); + $adox->Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' . $path); + $adox = null; + + } catch (Exception $e) { + } + } + if (file_exists($path)) { + $config['ENV']['PDOTEST_DSN'] = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$path;Uid=Admin"; + } +} +# other magic autodetection here, eg: for DB2 by inspecting env +/* +$USER = 'db2inst1'; +$PASSWD = 'ibmdb2'; +$DBNAME = 'SAMPLE'; + +$CONNECTION = "odbc:DSN=$DBNAME;UID=$USER;PWD=$PASSWD;"; +*/ + + +return $config; |
