sebastianbergmann / dbunit

DbUnit port for PHP/PHPUnit.
https://phpunit.de/
Other
225 stars 186 forks source link

odbc / freetds / sqlsrv #170

Closed rbredlau closed 6 years ago

rbredlau commented 8 years ago

When using odbc and freetds to access MS SQL Server from a Linux environment, dbunit fails with an error about a missing metadata driver (no meta data driver for odbc).

A simple work around is to create a subclass of the PDO class you want to test:

/**
* In my application...
*/
class PDO_MsSql extends PDO {
    ...
}

/**
* In my test code...
*/
class Testing_PDO_MsSqlTest extends PDO_MsSql {
    ...

    public function getAttribute( $attribute ) {
        if( $attribute === PDO::ATTR_DRIVER_NAME && PHP_OS === 'Linux' ) {
            return 'sqlsrv';
        } else {
            return parent::getAttribute( $attribute );
        }
   }
}
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.