| 1 |
use strict; |
| 2 |
use Test::More; |
| 3 |
use Class::DBI::Sweet; |
| 4 |
Class::DBI::Sweet->default_search_attributes({ use_resultset_cache => 0 }); |
| 5 |
Class::DBI::Sweet->cache(Cache::MemoryCache->new( |
| 6 |
{ namespace => "SweetTest", default_expires_in => 60 } ) ); |
| 7 |
|
| 8 |
#---------------------------------------------------------------------- |
| 9 |
# Make sure subclasses can be themselves subclassed |
| 10 |
#---------------------------------------------------------------------- |
| 11 |
|
| 12 |
BEGIN { |
| 13 |
eval "use Cache::MemoryCache"; |
| 14 |
plan skip_all => "needs Cache::Cache for testing" if $@; |
| 15 |
eval "use DBD::SQLite"; |
| 16 |
plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6); |
| 17 |
} |
| 18 |
|
| 19 |
use lib 't/cdbi-t/testlib'; |
| 20 |
use Film; |
| 21 |
|
| 22 |
INIT { @Film::Threat::ISA = qw/Film/; } |
| 23 |
|
| 24 |
ok(Film::Threat->db_Main->ping, 'subclass db_Main()'); |
| 25 |
is_deeply [ sort Film::Threat->columns ], [ sort Film->columns ], |
| 26 |
'has the same columns'; |
| 27 |
|
| 28 |
my $bt = Film->create_test_film; |
| 29 |
ok my $btaste = Film::Threat->retrieve('Bad Taste'), "subclass retrieve"; |
| 30 |
isa_ok $btaste => "Film::Threat"; |
| 31 |
isa_ok $btaste => "Film"; |
| 32 |
is $btaste->Title, 'Bad Taste', 'subclass get()'; |