Test-DBIC-SQLite
view release on metacpan or search on metacpan
lib/Test/DBIC/DBDConnector.pm view on Meta::CPAN
my $connection_parameters = shift;
my $self = shift;
my $parameters = $self->$connection_parameters(@_);
push @$parameters, undef while @$parameters < 3;
my $options = $parameters->[3] // { };
$options->{ignore_version} //= 1;
$parameters->[3] = $options;
return $parameters;
};
=begin proxy-method
=head2 builder
This method just returns C<< Test::Builder::Module->builder >>
=end proxy-method
=head2 Test::DBIC::YourDBD->MyDBD_connection_parameters()
C<MyDBD_connection_parameters> is a class method that you must implement in your class.
This role provides an C<around> for this method that makes sure the
C<ignore_version> option is added with a true value in the extra connection
options hash. One can check this in the connect method of the schema-class.
=head3 Arguments
It gets the second argument from C<dbic_connect_ok()>, this will be DBD specific.
=head3 Response
This method should return an ArrayRef with the list of arguments to pass to C<<
YourDBD::DBIC::Schema->connect() >>
=cut
=head2 Test::DBIC::YourDBD->MyDBD_check_wants_deploy()
C<MyDBD_check_wants_deploy> is a class method that you must implement in your class.
=head3 Arguments
It gets the second argument from C<dbic_connect_ok()>, this will be DBD specific.
=cut
=begin override
=head2 import_extra
This method is called by L<Test::Builder::Module>.
=end override
=cut
sub import_extra {
strict->import;
warnings->import;
Test::Builder::Module->import;
}
=begin hide
=head2 ValidationTemplates
Current templates use L<Types::Standard>:
=over
=item schema_class => StrMatch[qr{^ [A-Za-z]\w+ (?:[:]{2}[A-Za-z]\w+)* $}x]
=item dbi_connect_info => Any
=item pre_deploy_hook => CodeRef
=item post_connect_hook => CodeRef
=back
This local version of the C<ValidationTemplates()> can be augmented by using C<around>
around ValidationTemplates => sub {
my $vt = shift;
my $class = shift;
use Types::Standard qw( HashRef );
my $templates = $class->$vt;
return {
%$templates,
dbi_connect_info => { type => HashRef },
};
};
=end hide
=cut
sub ValidationTemplates {
return {
schema_class => { type => StrMatch[qr{^ [A-Za-z]\w+ (?:[:]{2}[A-Za-z]\w+)* $}x] },
dbi_connect_info => { type => Any },
pre_deploy_hook => { type => Maybe[CodeRef] },
post_connect_hook => { type => Maybe[CodeRef] },
};
}
1;
=head1 COPYRIGHT
E<copy> MMXXI - Abe Timmerman <abeltje@cpan.org>
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
( run in 4.475 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )