File: get_cvterm.t

package info (click to toggle)
libbio-chado-schema-perl 0.10010-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,800 kB
  • sloc: perl: 15,043; makefile: 7; sql: 3
file content (30 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;
use FindBin;

use Test::More tests => 5;
use Test::Exception;

use lib "$FindBin::RealBin/lib";
use Bio::Chado::Schema::Test;

my $schema = Bio::Chado::Schema::Test->init_schema();
isa_ok( $schema, 'DBIx::Class::Schema' );

is $schema->get_cvterm('nonexistent:thingy'), undef, 'got undef for nonexistent cvterm';

throws_ok {
    $schema->get_cvterm_or_die('nonexistent','thing')
} qr/nonexistent thing not found/i, 'get_cvterm_or_die dies for nonexistent cvterm';


my $cvterm = $schema->resultset('Cv::Cvterm')
             ->create_with({
                 name => 'tester',
                 cv   => 'testing cv',
                 db   => 'fake db',
                 dbxref => 'fake accession',
             });

is $schema->get_cvterm('testing cv:tester')->name, 'tester', 'got the cvterm';
is $schema->get_cvterm_or_die('testing cv','tester')->name, 'tester', 'got the cvterm here also';