Annotation of embedaddon/php/ext/pdo_odbc/tests/common.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: ODBC
        !             3: --SKIPIF--
        !             4: <?php # vim:ft=php
        !             5: if (!extension_loaded('pdo_odbc')) print 'skip'; ?>
        !             6: --REDIRECTTEST--
        !             7: # magic auto-configuration
        !             8: 
        !             9: $config = array(
        !            10:        'TESTS' => 'ext/pdo/tests'
        !            11: );
        !            12:        
        !            13: 
        !            14: if (false !== getenv('PDO_ODBC_TEST_DSN')) {
        !            15:        # user set them from their shell
        !            16:        $config['ENV']['PDOTEST_DSN'] = getenv('PDO_ODBC_TEST_DSN');
        !            17:        $config['ENV']['PDOTEST_USER'] = getenv('PDO_ODBC_TEST_USER');
        !            18:        $config['ENV']['PDOTEST_PASS'] = getenv('PDO_ODBC_TEST_PASS');
        !            19:        if (false !== getenv('PDO_ODBC_TEST_ATTR')) {
        !            20:                $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_ODBC_TEST_ATTR');
        !            21:        }
        !            22: } elseif (preg_match('/^WIN/i', PHP_OS)) {
        !            23:        # on windows, try to create a temporary MS access database
        !            24:        $path = realpath(dirname(__FILE__)) . '\pdo_odbc.mdb';
        !            25:        if (!file_exists($path)) {
        !            26:                try {
        !            27:                        $adox = new COM('ADOX.Catalog');
        !            28:                        $adox->Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' . $path);
        !            29:                        $adox = null;
        !            30:        
        !            31:                } catch (Exception $e) {
        !            32:                }
        !            33:        }
        !            34:        if (file_exists($path)) {
        !            35:                $config['ENV']['PDOTEST_DSN'] = "odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$path;Uid=Admin";
        !            36:        }
        !            37: }
        !            38: # other magic autodetection here, eg: for DB2 by inspecting env
        !            39: /*
        !            40: $USER = 'db2inst1';
        !            41: $PASSWD = 'ibmdb2';
        !            42: $DBNAME = 'SAMPLE';
        !            43: 
        !            44: $CONNECTION = "odbc:DSN=$DBNAME;UID=$USER;PWD=$PASSWD;";
        !            45: */
        !            46: 
        !            47:        
        !            48: return $config;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>