1DBICx::TestDatabase(3)User Contributed Perl DocumentationDBICx::TestDatabase(3)
2
3
4

NAME

6       DBICx::TestDatabase - create a temporary database from a
7       DBIx::Class::Schema
8

SYNOPSIS

10       Given a DBIx::Class::Schema at "MyApp::Schema", create a test database
11       like this:
12
13          use DBICx::TestDatabase;
14          my $schema = DBICx::TestDatabase->new('MyApp::Schema');
15
16       Then you can use $schema normally:
17
18          $schema->resultset('Blah')->create({ blah => '123' });
19
20       When your program exits, the temporary database will go away.
21

DESCRIPTION

23       This module creates a temporary SQLite database, deploys your DBIC
24       schema, and then connects to it.  This lets you easily test your DBIC
25       schema.  Since you have a fresh database for every test, you don't have
26       to worry about cleaning up after your tests, ordering of tests
27       affecting failure, etc.
28

METHODS

30   new($schema)
31       Loads $schema and returns a connection to it.
32
33   connect
34       Alias for new.
35

ENVIRONMENT

37       You can control the behavior of this module at runtime by setting
38       environment variables.
39
40   DBIC_KEEP_TEST
41       If this variable is true, then the test database will not be deleted at
42       "END" time.  Instead, a message containing the paths of the test
43       databases will be printed.
44
45       This is good if you want to look at the database your test generated,
46       for debugging.
47
48       (Note that the database will never exist on disk if you don't set this
49       to a true value.)
50

AUTHOR

52       Jonathan Rockway "<jrockway@cpan.org>"
53

LICENSE

55       Copyright (c) 2007 Jonathan Rockway.
56
57       This program is free software.  You may use, modify, and redistribute
58       it under the same terms as Perl itself.
59
60
61
62perl v5.34.0                      2021-07-22            DBICx::TestDatabase(3)
Impressum