Download the PHP package cspray/database-testing-pdo without Composer
On this page you can find all versions of the php package cspray/database-testing-pdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cspray/database-testing-pdo
More information about cspray/database-testing-pdo
Files in cspray/database-testing-pdo
Package database-testing-pdo
Short Description PDO ConnectionAdapter for cspray/database-testing
License
Informations about the package database-testing-pdo
cspray/database-testing-pdo
A connection adapter for cspray/database-testing
that allows you to
use a PDO connection for testing database interactions.
Installation
Composer is the only supported means to install this package.
Quick Start
This library works by providing an implementation of the Cspray\DatabaseTesting\ConnectionAdapter\ConnectionAdapter
interface, along with a variety of Cspray\DatabaseTesting\ConnectionAdapter\ConnectionAdapterFactory
implementations designed to work with common databases. Check out the example appropriate for your database below or check out the "Database Connection Adapter Reference"!
All examples below will use code from the cspray/database-testing-phpunit
extension. If you're using a different testing framework you may need to adjust your code as appropriate.
Postgres
MySql
Sqlite
Database Connection Adapter Reference
Database | ConnectionAdapterFactory |
---|---|
Postgres | Cspray\DatabaseTesting\Pdo\Postgres\PostgresConnectionAdapterFactory |
MySql | Cspray\DatabaseTesting\Pdo\Mysql\MysqlConnectionAdapterFactory |
SQLite | Cspray\DatabaseTesting\Pdo\Sqlite\SqliteConnectionAdapterFactory |
Running Tests
By the nature of this library, we need to interact with a database during our tests. This presents some challenges and concessions that otherwise wouldn't be present when writing tests. Most importantly, that means we need to have multiple running database servers. To run tests for this library you must use docker compose run --rm tests
. This will ensure the appropriate database servers are up and running so tests have something to connect to.