Test::SQLite - SQLite setup/teardown for tests
version 0.0104
use DBI; use Test::SQLite; my $sqlite = Test::SQLite->new( database => '/some/where/production.db', ); my $dbh = DBI->connect($sqlite->dsn, '', ''); $sqlite = Test::SQLite->new( schema => '/some/where/schema.sql', ); $dbh = $sqlite->dbh;
Test::SQLite is loosely inspired by Test::PostgreSQL and Test::mysqld, and creates a temporary db to use in tests. Unlike those modules, it is limited to setup/teardown of the test db given a database or schema SQL file. Also this module will return the database dbh handle and dsn connection string.
Test::SQLite
The database to copy.
Boolean indicating that a database file was provided to the constructor.
The SQL schema to create a test database.
Boolean indicating that a schema file was provided to the constructor.
The database connection string.
A connected database handle.
$sqlite = Test::SQLite->new(%arguments);
Create a new Test::SQLite object.
Ensure that we are not given both a database and a schema.
Kaitlyn Parkhurst <symkat@symkat.com>
DBI
File::Copy
File::Temp
Moo
Gene Boggs <gene@cpan.org>
This software is copyright (c) 2020 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::SQLite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::SQLite
CPAN shell
perl -MCPAN -e shell install Test::SQLite
For more information on module installation, please visit the detailed CPAN module installation guide.