Test::DBIC::Schema::Connector - Generate an instance of a DBIx::Class::Schema as test database
version 0.003
use Test::DBIC::Schema::Connector; my $schema = test_dbic_schema_connect('MySchema'); # MYSCHEMA_DSN will be used as DSN if given # MYSCHEMA_USER will be used as username if given # MYSCHEMA_PASS will be used as password if given my $schema = test_dbic_schema_connect('MySchema',{ env_prefix => 'I_LOVE', user => 'peter', env_pass => 'I_HATE_PASS', }); # I_LOVE_DSN will be used as DSN if given # The user is fixed to be peter # I_HATE_PASS will be used as password if given
This distribution connects a schema to a test database, given by ENV variables, or if not given, by deploying a SQLite version of the database.
This function returns the connectd schema, or throws an error if not possible. The following keys for the options are possible:
Prefix for the ENV variables used, by default it will UPPERCASE the given schema name and replace :: with _.
Setting the user to the given value, ignoring the ENV variable.
Setting the password to the given value, ignoring the ENV variable.
Setting the dsn to the given value, ignoring the ENV variable.
ENV variable used for the username of the connection. Defaults to env_prefix + _USER.
ENV variable used for the password of the connection. Defaults to env_prefix + _PASS.
ENV variable used for the dsn of the connection. Defaults to env_prefix + _DSN.
Do not try to deploy the database.
Do not deploy the database, instead try to autoupgrade the existing one. If there is no content, it will get generated in this process.
IRC
Join #dbix-class on irc.perl.org and ask for Getty.
Repository
http://github.com/Getty/p5-test-dbic-schema-connector Pull request and additional contributors are welcome
Issue Tracker
http://github.com/Getty/p5-test-dbic-schema-connector/issues
Torsten Raudssus <torsten@raudss.us> http://raudss.us/
This software is copyright (c) 2011 by Raudssus Social Software.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
This software is copyright (c) 2015 by Raudssus Social Software.
To install Test::DBIC::Schema::Connector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::DBIC::Schema::Connector
CPAN shell
perl -MCPAN -e shell install Test::DBIC::Schema::Connector
For more information on module installation, please visit the detailed CPAN module installation guide.