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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#!/usr/bin/perl
# Tests that overlay modules are automatically loaded
BEGIN {
$| = 1;
$^W = 1;
}
use Test::More tests => 7;
use File::Spec::Functions ':ALL';
use t::lib::Test;
#####################################################################
# Set up for testing
# Connect
my $file = test_db();
my $dbh = create_ok(
file => catfile(qw{ t 02_basics.sql }),
connect => [ "dbi:SQLite:$file" ],
);
# Create the test package
eval <<"END_PERL"; die $@ if $@;
package t::lib;
use strict;
use ORLite {
file => '$file',
};
1;
END_PERL
#####################################################################
# Tests for the base package update methods
isa_ok(
t::lib::TableOne->create(
col1 => 1,
col2 => 'foo',
),
't::lib::TableOne',
);
isa_ok(
t::lib::TableOne->create(
col1 => 2,
col2 => 'bar',
),
't::lib::TableOne',
);
is( t::lib::TableOne->count, 2, 'Found 2 rows' );
is(
t::lib::TableOne->count,
2,
'Count found 2 rows',
);
SCOPE: {
my $object = t::lib::TableOne->load(1);
isa_ok( $object, 't::lib::TableOne' );
is( $object->dummy, 2, '->dummy ok (overlay was loaded)' );
}
|