bauhaus / dbasserture
DB fixture and assertion for integration tests
Installs: 9 725
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 4
Requires
- php: ^8.0
- ext-pdo: *
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-21 00:26:16 UTC
README
DB Asserture
This tool aims to help the DB setup and assertion in a integration tests context.
use Bauhaus\DbAsserture\DbAssertureFactory; $factory = new DbAssertureFactory(); $dbAsserture = $factory->fromDsn('mysql://user:pass@host:port/dbname'); // Clean tables $dbAsserture->clean('table_name', 'another_table_name'); // Insert registers $dbAsserture->insert('table_name', ['id' => 1, 'name' => 'Name']); $dbAsserture->insert('table_name', ['id' => 1, 'name' => 'Name'], ['id' => 2, 'name' => 'Another name'], ); // Select registers $dbAsserture->select('table_name', ['name' => 'John']); // return many registers with all fields matching provided filter $dbAsserture->selectOne('table_name', ['id' => 1]); // return one register with all fields matching provided filters // Assert if is registered in database $dbAsserture->assertOneIsRegistered('table_name', ['id' => 1, 'name' => 'Name']); // return true or throw exception