.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "DBICx::TestDatabase 3pm" .TH DBICx::TestDatabase 3pm "2018-01-27" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBICx::TestDatabase \- create a temporary database from a DBIx::Class::Schema .SH "SYNOPSIS" .IX Header "SYNOPSIS" Given a DBIx::Class::Schema at \f(CW\*(C`MyApp::Schema\*(C'\fR, create a test database like this: .PP .Vb 2 \& use DBICx::TestDatabase; \& my $schema = DBICx::TestDatabase\->new(\*(AqMyApp::Schema\*(Aq); .Ve .PP Then you can use \f(CW$schema\fR normally: .PP .Vb 1 \& $schema\->resultset(\*(AqBlah\*(Aq)\->create({ blah => \*(Aq123\*(Aq }); .Ve .PP When your program exits, the temporary database will go away. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module creates a temporary SQLite database, deploys your \s-1DBIC\s0 schema, and then connects to it. This lets you easily test your \s-1DBIC\s0 schema. Since you have a fresh database for every test, you don't have to worry about cleaning up after your tests, ordering of tests affecting failure, etc. .SH "METHODS" .IX Header "METHODS" .SS "new($schema)" .IX Subsection "new($schema)" Loads \f(CW$schema\fR and returns a connection to it. .SS "connect" .IX Subsection "connect" Alias for new. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" You can control the behavior of this module at runtime by setting environment variables. .SS "\s-1DBIC_KEEP_TEST\s0" .IX Subsection "DBIC_KEEP_TEST" If this variable is true, then the test database will not be deleted at \f(CW\*(C`END\*(C'\fR time. Instead, a message containing the paths of the test databases will be printed. .PP This is good if you want to look at the database your test generated, for debugging. .PP (Note that the database will never exist on disk if you don't set this to a true value.) .SH "AUTHOR" .IX Header "AUTHOR" Jonathan Rockway \f(CW\*(C`\*(C'\fR .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2007 Jonathan Rockway. .PP This program is free software. You may use, modify, and redistribute it under the same terms as Perl itself.