Bio::Chado::Schema::Test(3pm) User Contributed Perl Documentation Bio::Chado::Schema::Test(3pm)NAME
Bio::Chado::Schema::Test - Library to be used by Bio::Chado::Schema test scripts.
SYNOPSIS
use lib qw(t/lib);
use Bio::Chado::Schema::Test;
use Test::More;
my $schema = Bio::Chado::Schema::Test->init_schema();
DESCRIPTION
This module provides the basic utilities to write tests against Bio::Chado::Schema.
METHODS
init_schema
my $schema = Bio::Chado::Schema::Test->init_schema(
deploy => 1,
populate => 1,
storage_type => '::DBI::Replicated',
storage_type_args => {
balancer_type=>'DBIx::Class::Storage::DBI::Replicated::Balancer::Random'
},
);
This method removes the test SQLite database in t/var/BCS.db and then creates a new, empty database.
This method will call deploy_schema() by default, unless the deploy flag is set to 0.
This method will call populate_schema() if the populate argument is set to a true value.
has_custom_dsn
Returns true if the BCS_TEST_DSN environment variable is set.
deploy_schema
Bio::Chado::Schema::Test->deploy_schema( $schema );
This method does one of two things to the schema. It can either call the experimental $schema->deploy() if the BCSTEST_SQLT_DEPLOY
environment variable is set, otherwise the default is to read in the t/lib/sqlite.sql file and execute the SQL within. Either way you end
up with a fresh set of tables for testing.
populate_schema
Bio::Chado::Schema::Test->populate_schema( $schema );
After you deploy your schema you can use this method to populate the tables with test data.
perl v5.14.2 2011-11-08 Bio::Chado::Schema::Test(3pm)
Check Out this Related Man Page
Bio::Chado::Schema::Util(3pm) User Contributed Perl Documentation Bio::Chado::Schema::Util(3pm)NAME
Bio::Chado::Schema::Util - utility functions shared by Bio::Chado::Schema objects
SYNOPSIS
sub create_organismprops {
my ($self, $props, $opts) = @_;
# process opts
$opts ||= {};
$opts->{cv_name} = 'organism_property'
unless defined $opts->{cv_name};
return Bio::Chado::Schema::Util->create_props
( properties => $props,
options => $opts,
row => $self,
prop_relation_name => 'organismprops',
);
}
DESCRIPTION
Helper functions used by several schema classes.
Important Note: This package is located in the Schema.pm file as secondary package and it haven't a file for itself. Nevertheless, the use
will be the same.
PACKAGE METHODS
create_properties
Usage: *::Util->create_properties( row => $self,
properties => { baz => 2, foo => 'bar' },
options => { cv_name => autocreate => 0, ...},
prop_relation_name => 'organismprops',
);
Desc : Chado has a number of <thing>prop tables with a similar
structure. This utility function is used by a number of
modules to create properties in these kinds of tables.
Args : row => the DBIC row object to create properties for,
prop_relation_name => the DBIC relation name for the
properties table to operate on,
e.g. 'featureprops',
properties => hashref of { propname => value, ...},
options => options hashref as:
{
autocreate => 0,
(optional) boolean, if passed, automatically create cv,
cvterm, and dbxref rows if one cannot be found for the
given featureprop name. Default false.
cv_name => cv.name to use for the given featureprops.
Defaults to 'feature_property',
db_name => db.name to use for autocreated dbxrefs,
default 'null',
allow_duplicate_values => default false.
If true, allow duplicate instances of the same cvterm
and value in the properties of the feature. Duplicate
values will have different ranks.
dbxref_accession_prefix => optional, default
'autocreated:',
definitions => optional hashref of:
{ cvterm_name => definition,
}
to load into the cvterm table when autocreating cvterms
}
Ret : hashref of { propname => new row object in property table }
AUTHOR
Robert Buels, <rmb32@cornell.edu>
Naama Menda, <naama.menda@gmail.com>
COPYRIGHT & LICENSE
Copyright 2009 Boyce Thompson Institute for Plant Research
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2011-11-08 Bio::Chado::Schema::Util(3pm)