Test2::Tools::QuickDB - Quickly spin up temporary Database servers for tests.
This is a test library build around DBIx::QuickDB.
use Test2::V0 -target => DBIx::QuickDB::Driver::PostgreSQL;
skipall_unless_can_db(driver => 'PostgreSQL');
my $db = get_db(driver => 'PostgreSQL', load_sql => 't/schema/postgresql.sql'});
This will look for a usable driver. If no usable driver is found, this will issue a skip_all to skip the current test or subtest. If at least one suable driver is found then the first one found will be returned.
If you pass in 1 argument it should either be a driver to try, or an arrayref of drivers to try.
If you passing multiple argument then you should follow the specifications in "SPEC HASH" in DBIx::QuickDB.
Feel free to ignore the return value.
Get a database.
With no arguments it will give you an instance of the first working driver it finds.
You can provide a name for the db, the same instance can then be retrieved anywhere GLOBALLY using the same name.
You can provide a spec hashref which can contain any arguments documented in "SPEC HASH" in DBIx::QuickDB.
This combines get_db() and skipall_unless_can_db(). The arguments supported are identical to get_db().
The source code repository for DBIx-QuickDB can be found at https://github.com/exodist/DBIx-QuickDB/.
Copyright 2020 Chad Granum <email@example.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBIx::QuickDB, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.