Bio::C...::Test(3pm)

πŸ’– Bio::C...::Test(3pm) πŸ’–

okay bestie, gather round, because this is the manual page for Bio::Chado::Schema::Test from the User Contributed Perl Documentation, and it is literally the little helper module that makes writing tests against Bio::Chado::Schema not a whole ordeal. she's the backstage crew of the test suite. no cap. ✨


🌸 NAME 🌸

Bio::Chado::Schema::Test β€” a library meant to be used by Bio::Chado::Schema test scripts. that's her whole job and she does it gorgeously. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use lib qw(t/lib);
use Bio::Chado::Schema::Test;
use Test::More;

my $schema = Bio::Chado::Schema::Test->init_schema();

look at that. four lines. she's serving simplicity. πŸ¦‹


✨ DESCRIPTION ✨

This module hands you the basic utilities you need to write tests against Bio::Chado::Schema. it's giving infrastructure but make it cute. you bring the assertions, she brings the 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'
  },
);

okay so here's the tea β˜• β€” this method removes the test SQLite database sitting at t/var/BCS.db, and then creates a brand-new, empty database in its place. out with the old, in with the fresh. πŸ”₯

  • by default this method will call deploy_schema() β€” unless you set the deploy flag to 0, in which case she minds her business and doesn't.
  • this method will call populate_schema() only if the populate argument is set to a true value. no true value, no populating. simple as that. πŸ’–
bestie, note the vibe: the default behavior is to deploy. if you don't want that, you gotta say so with deploy => 0. πŸ‘‘

🧚 has_custom_dsn

Returns true if the BCS_TEST_DSN environment variable is set. that's it. that's the method. short queen behavior. πŸ’œ

πŸ“ deploy_schema

Bio::Chado::Schema::Test->deploy_schema( $schema );

This method does one of two things to the schema, and she picks based on the environment, which is very main character of her:

  • If the BCSTEST_SQLT_DEPLOY environment variable is set, she'll call the experimental $schema->deploy(). πŸ‘€
  • Otherwise, the default is to read in the t/lib/sqlite.sql file and execute the SQL inside it.

either way you end up with a fresh set of tables for testing. same destination, two routes, both iconic. ✨

heads up: $schema->deploy() is flagged experimental in the original, so don't come for her if the experimental path does experimental things. πŸ™ˆ

🌸 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. deploy first, populate second β€” that's the order, bestie, don't fight it. πŸŽ€


πŸ’« SEE ALSO πŸ’«

there are no SEE ALSO references in this page, which is honestly so real of her. she's self-contained. she's enough. periodt. πŸ’…


🫢 SIGN-OFF 🫢

this page is from the User Contributed Perl Documentation, generated for perl v5.32.0, dated 2020-12-04. thanks for coming to my TED talk, go write some tests, and remember: init_schema() first, everything else after. mwah. πŸ’–βœ¨πŸŒˆπŸ¦‹

πŸ“¦ where this page comes from