File: 21-row_by_pk-exception.t

package info (click to toggle)
libalzabo-perl 0.92-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,172 kB
  • ctags: 794
  • sloc: perl: 15,060; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (5)
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
31
32
33
34
#!/usr/bin/perl -w

use strict;

use File::Spec;

use lib '.', File::Spec->catdir( File::Spec->curdir, 't', 'lib' );

use Alzabo::Runtime;
use Alzabo::Test::Utils;

use Test::More;

Alzabo::Test::Utils->remove_all_schemas;

my $schema = Alzabo::Test::Utils->any_connected_runtime_schema;

if ($schema)
{
    plan tests => 2;
}
else
{
    plan skip_all => 'no test config provided';
    exit;
}

my $emp_t = $schema->table('employee');

# value of pk is irrelevant, as long as it doesn't exist
my $row = eval { $emp_t->row_by_pk( pk => 1258125 ) };

is( $row, undef, 'no row matched the given pk' );
is( $@, '', 'no exception was thrown with invalid pk' );