GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DBICx::TestDatabase(3) User Contributed Perl Documentation DBICx::TestDatabase(3)

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

Given a DBIx::Class::Schema at "MyApp::Schema", create a test database like this:

   use DBICx::TestDatabase;
   my $schema = DBICx::TestDatabase->new('MyApp::Schema');

Then you can use $schema normally:

   $schema->resultset('Blah')->create({ blah => '123' });

When your program exits, the temporary database will go away.

This module creates a temporary SQLite database, deploys your DBIC schema, and then connects to it. This lets you easily test your DBIC 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.

Loads $schema and returns a connection to it.

Alias for new.

You can control the behavior of this module at runtime by setting environment variables.

If this variable is true, then the test database will not be deleted at "END" time. Instead, a message containing the paths of the test databases will be printed.

This is good if you want to look at the database your test generated, for debugging.

(Note that the database will never exist on disk if you don't set this to a true value.)

Jonathan Rockway "<jrockway@cpan.org>"

Copyright (c) 2007 Jonathan Rockway.

This program is free software. You may use, modify, and redistribute it under the same terms as Perl itself.

2013-07-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.