Skip to content
Snippets Groups Projects
Commit 2645315f authored by Tiago Grego's avatar Tiago Grego
Browse files

Added biotype.t test to check warning in fetch_all_by_object_type

parent 795b13b0
No related branches found
No related tags found
2 merge requests!228Biotype in Core schema,!228Biotype in Core schema
...@@ -17,7 +17,7 @@ use strict; ...@@ -17,7 +17,7 @@ use strict;
use warnings; use warnings;
use Test::More; use Test::More;
use Test::Warnings qw( allow_warnings ); use Test::Warnings qw( warning );
use Test::Exception; use Test::Exception;
use Bio::EnsEMBL::Test::MultiTestDB; use Bio::EnsEMBL::Test::MultiTestDB;
...@@ -26,7 +26,6 @@ use Bio::EnsEMBL::Test::TestUtils; ...@@ -26,7 +26,6 @@ use Bio::EnsEMBL::Test::TestUtils;
our $verbose = 0; #set to 1 to turn on debug printouts our $verbose = 0; #set to 1 to turn on debug printouts
# Get a DBAdaptor to from the test system # Get a DBAdaptor to from the test system
my $multi = Bio::EnsEMBL::Test::MultiTestDB->new; my $multi = Bio::EnsEMBL::Test::MultiTestDB->new;
ok($multi, "Test DB loaded successfully"); ok($multi, "Test DB loaded successfully");
...@@ -93,5 +92,13 @@ my $biotypes = $biotype_adaptor->fetch_all_by_object_type('gene'); ...@@ -93,5 +92,13 @@ my $biotypes = $biotype_adaptor->fetch_all_by_object_type('gene');
is(ref $biotypes, 'ARRAY', 'Got an array'); is(ref $biotypes, 'ARRAY', 'Got an array');
is(scalar @{$biotypes}, '2', 'of size 2'); is(scalar @{$biotypes}, '2', 'of size 2');
is_deeply($biotypes, [$biotype1, $biotype3], 'with the correct objects'); is_deeply($biotypes, [$biotype1, $biotype3], 'with the correct objects');
my $warning = warning { $biotypes = $biotype_adaptor->fetch_all_by_object_type('none') };
like( $warning,
qr/No objects retrieved. Check if object_type 'none' is correct./,
"Got a warning from fetch_all_by_object_type('none') ",
) or diag 'Got warning: ', explain($warning);
is(ref $biotypes, 'ARRAY', 'Got an array');
is(scalar @{$biotypes}, '0', 'of size 0');
is_deeply($biotypes, [], 'totally empty');
done_testing(); done_testing();
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment