The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::DBIC::Schema::Connector - Generate an instance of a DBIx::Class::Schema as test database

VERSION

version 0.003

SYNOPSIS

  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

DESCRIPTION

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.

FUNCTIONS

test_dbic_schema_connect($schema_package,\%options)

This function returns the connectd schema, or throws an error if not possible. The following keys for the options are possible:

env_prefix

Prefix for the ENV variables used, by default it will UPPERCASE the given schema name and replace :: with _.

user

Setting the user to the given value, ignoring the ENV variable.

pass

Setting the password to the given value, ignoring the ENV variable.

dsn

Setting the dsn to the given value, ignoring the ENV variable.

env_user

ENV variable used for the username of the connection. Defaults to env_prefix + _USER.

env_pass

ENV variable used for the password of the connection. Defaults to env_prefix + _PASS.

env_dsn

ENV variable used for the dsn of the connection. Defaults to env_prefix + _DSN.

no_deploy

Do not try to deploy the database.

autoupgrade TODO

Do not deploy the database, instead try to autoupgrade the existing one. If there is no content, it will get generated in this process.

SUPPORT

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

AUTHOR

Torsten Raudssus <torsten@raudss.us> http://raudss.us/

COPYRIGHT AND LICENSE

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.

AUTHOR

Torsten Raudssus <torsten@raudss.us> http://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 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.