Class-DBI-Sweet
view release on metacpan or search on metacpan
t/cdbi-t-ocache/11-triggers.t
t/cdbi-t-ocache/12-filter.t
t/cdbi-t-ocache/13-constraint.t
t/cdbi-t-ocache/14-might_have.t
t/cdbi-t-ocache/16-reserved.t
t/cdbi-t-ocache/17-data_type.t
t/cdbi-t-ocache/18-has_a.t
t/cdbi-t-ocache/19-set_sql.t
t/cdbi-t-ocache/21-iterator.t
t/cdbi-t-ocache/22-deflate_order.t
t/cdbi-t-ocache/23-cascade.t
t/cdbi-t-ocache/24-meta_info.t
t/cdbi-t-ocache/25-closures_in_meta.t
t/cdbi-t-ocache/97-pod.t
t/cdbi-t-ocache/98-failure.t
t/cdbi-t-ocache/99-misc.t
t/cdbi-t-ocache/testlib/Actor.pm
t/cdbi-t-ocache/testlib/Binary.pm
t/cdbi-t-ocache/testlib/Blurb.pm
t/cdbi-t-ocache/testlib/CDBase.pm
t/cdbi-t-ocache/testlib/Director.pm
t/cdbi-t-rescache/11-triggers.t
t/cdbi-t-rescache/12-filter.t
t/cdbi-t-rescache/13-constraint.t
t/cdbi-t-rescache/14-might_have.t
t/cdbi-t-rescache/16-reserved.t
t/cdbi-t-rescache/17-data_type.t
t/cdbi-t-rescache/18-has_a.t
t/cdbi-t-rescache/19-set_sql.t
t/cdbi-t-rescache/21-iterator.t
t/cdbi-t-rescache/22-deflate_order.t
t/cdbi-t-rescache/23-cascade.t
t/cdbi-t-rescache/24-meta_info.t
t/cdbi-t-rescache/25-closures_in_meta.t
t/cdbi-t-rescache/97-pod.t
t/cdbi-t-rescache/98-failure.t
t/cdbi-t-rescache/99-misc.t
t/cdbi-t-rescache/testlib/Actor.pm
t/cdbi-t-rescache/testlib/Binary.pm
t/cdbi-t-rescache/testlib/Blurb.pm
t/cdbi-t-rescache/testlib/CDBase.pm
t/cdbi-t-rescache/testlib/Director.pm
t/cdbi-t/10-mysql.t
t/cdbi-t/11-triggers.t
t/cdbi-t/12-filter.t
t/cdbi-t/13-constraint.t
t/cdbi-t/14-might_have.t
t/cdbi-t/17-data_type.t
t/cdbi-t/18-has_a.t
t/cdbi-t/19-set_sql.t
t/cdbi-t/21-iterator.t
t/cdbi-t/22-deflate_order.t
t/cdbi-t/23-cascade.t
t/cdbi-t/24-meta_info.t
t/cdbi-t/25-closures_in_meta.t
t/cdbi-t/97-pod.t
t/cdbi-t/98-failure.t
t/cdbi-t/99-misc.t
t/cdbi-t/testlib/Actor.pm
t/cdbi-t/testlib/Binary.pm
t/cdbi-t/testlib/Blurb.pm
t/cdbi-t/testlib/CDBase.pm
t/cdbi-t/testlib/Director.pm
t/cdbi-t-ocache/10-mysql.t view on Meta::CPAN
ok MyStar->has_many(filmids => [ MyStarLink => 'film', 'id' ]),
"**** Multi-map";
my @filmid = $s1->filmids;
ok !ref $filmid[0], "Film-id is not a reference";
my $first = $s1->filmids->first;
ok !ref $first, "First is not a reference";
is $first, $filmid[0], "But it's the same as filmid[0]";
}
{ # cascades correctly
my $lenin = MyFilm->insert({ title => "Leningrad Cowboys Go America" });
my $pimme = MyStar->insert({ name => "Pimme Korhonen" });
my $cowboy = MyStarLink->insert({ film => $lenin, star => $pimme });
$lenin->delete;
is MyStar->search(name => 'Pimme Korhonen')->count, 1, "Pimme still exists";
is MyStarLink->search(star => $pimme->id)->count, 0, "But in no films";
}
{
ok MyStar->has_many(filmids_mcpk => [ MyStarLinkMCPK => 'film', 'id' ]),
t/cdbi-t-ocache/14-might_have.t view on Meta::CPAN
is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way";
ok $bt->blurb("New blurb"), "We can set the blurb";
$bt->update;
is $bt->blurb, $info->blurb, "Blurb has been set";
$bt->rating(18);
eval { $bt->update };
is $@, '', "No problems updating when do have";
is $bt->rating, 18, "Updated OK";
# cascade delete?
{
my $blurb = Blurb->retrieve('Bad Taste');
isa_ok $blurb => "Blurb";
$bt->delete;
$blurb = Blurb->retrieve('Bad Taste');
is $blurb, undef, "Blurb has gone";
}
}
t/cdbi-t-ocache/23-cascade.t view on Meta::CPAN
plan skip_all => "needs Cache::Cache for testing" if $@;
eval "use DBD::SQLite";
plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5);
}
use lib 't/cdbi-t/testlib';
use Film;
use Director;
{ # Cascade Strategies
Director->has_many(nasties => Film => { cascade => 'Fail' });
my $dir = Director->insert({ name => "Nasty Noddy" });
my $kk = $dir->add_to_nasties({ Title => 'Killer Killers' });
is $kk->director, $dir, "Director set OK";
is $dir->nasties, 1, "We have one nasty";
eval { $dir->delete };
like $@, qr/1/, "Can't delete while films exist";
my $rr = $dir->add_to_nasties({ Title => 'Revenge of the Revengers' });
eval { $dir->delete };
like $@, qr/2/, "Still can't delete";
t/cdbi-t-rescache/10-mysql.t view on Meta::CPAN
ok MyStar->has_many(filmids => [ MyStarLink => 'film', 'id' ]),
"**** Multi-map";
my @filmid = $s1->filmids;
ok !ref $filmid[0], "Film-id is not a reference";
my $first = $s1->filmids->first;
ok !ref $first, "First is not a reference";
is $first, $filmid[0], "But it's the same as filmid[0]";
}
{ # cascades correctly
my $lenin = MyFilm->insert({ title => "Leningrad Cowboys Go America" });
my $pimme = MyStar->insert({ name => "Pimme Korhonen" });
my $cowboy = MyStarLink->insert({ film => $lenin, star => $pimme });
$lenin->delete;
is MyStar->search(name => 'Pimme Korhonen')->count, 1, "Pimme still exists";
is MyStarLink->search(star => $pimme->id)->count, 0, "But in no films";
}
{
ok MyStar->has_many(filmids_mcpk => [ MyStarLinkMCPK => 'film', 'id' ]),
t/cdbi-t-rescache/14-might_have.t view on Meta::CPAN
is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way";
ok $bt->blurb("New blurb"), "We can set the blurb";
$bt->update;
is $bt->blurb, $info->blurb, "Blurb has been set";
$bt->rating(18);
eval { $bt->update };
is $@, '', "No problems updating when do have";
is $bt->rating, 18, "Updated OK";
# cascade delete?
{
my $blurb = Blurb->retrieve('Bad Taste');
isa_ok $blurb => "Blurb";
$bt->delete;
$blurb = Blurb->retrieve('Bad Taste');
is $blurb, undef, "Blurb has gone";
}
}
t/cdbi-t-rescache/23-cascade.t view on Meta::CPAN
plan skip_all => "needs Cache::Cache for testing" if $@;
eval "use DBD::SQLite";
plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5);
}
use lib 't/cdbi-t/testlib';
use Film;
use Director;
{ # Cascade Strategies
Director->has_many(nasties => Film => { cascade => 'Fail' });
my $dir = Director->insert({ name => "Nasty Noddy" });
my $kk = $dir->add_to_nasties({ Title => 'Killer Killers' });
is $kk->director, $dir, "Director set OK";
is $dir->nasties, 1, "We have one nasty";
eval { $dir->delete };
like $@, qr/1/, "Can't delete while films exist";
my $rr = $dir->add_to_nasties({ Title => 'Revenge of the Revengers' });
eval { $dir->delete };
like $@, qr/2/, "Still can't delete";
t/cdbi-t/10-mysql.t view on Meta::CPAN
ok MyStar->has_many(filmids => [ MyStarLink => 'film', 'id' ]),
"**** Multi-map";
my @filmid = $s1->filmids;
ok !ref $filmid[0], "Film-id is not a reference";
my $first = $s1->filmids->first;
ok !ref $first, "First is not a reference";
is $first, $filmid[0], "But it's the same as filmid[0]";
}
{ # cascades correctly
my $lenin = MyFilm->insert({ title => "Leningrad Cowboys Go America" });
my $pimme = MyStar->insert({ name => "Pimme Korhonen" });
my $cowboy = MyStarLink->insert({ film => $lenin, star => $pimme });
$lenin->delete;
is MyStar->search(name => 'Pimme Korhonen')->count, 1, "Pimme still exists";
is MyStarLink->search(star => $pimme->id)->count, 0, "But in no films";
}
{
ok MyStar->has_many(filmids_mcpk => [ MyStarLinkMCPK => 'film', 'id' ]),
t/cdbi-t/14-might_have.t view on Meta::CPAN
is $bt->blurb, $info->blurb, "Blurb is the same as fetching the long way";
ok $bt->blurb("New blurb"), "We can set the blurb";
$bt->update;
is $bt->blurb, $info->blurb, "Blurb has been set";
$bt->rating(18);
eval { $bt->update };
is $@, '', "No problems updating when do have";
is $bt->rating, 18, "Updated OK";
# cascade delete?
{
my $blurb = Blurb->retrieve('Bad Taste');
isa_ok $blurb => "Blurb";
$bt->delete;
$blurb = Blurb->retrieve('Bad Taste');
is $blurb, undef, "Blurb has gone";
}
}
t/cdbi-t/23-cascade.t view on Meta::CPAN
BEGIN {
eval "use DBD::SQLite";
plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5);
}
use lib 't/cdbi-t/testlib';
use Film;
use Director;
{ # Cascade Strategies
Director->has_many(nasties => Film => { cascade => 'Fail' });
my $dir = Director->insert({ name => "Nasty Noddy" });
my $kk = $dir->add_to_nasties({ Title => 'Killer Killers' });
is $kk->director, $dir, "Director set OK";
is $dir->nasties, 1, "We have one nasty";
eval { $dir->delete };
like $@, qr/1/, "Can't delete while films exist";
my $rr = $dir->add_to_nasties({ Title => 'Revenge of the Revengers' });
eval { $dir->delete };
like $@, qr/2/, "Still can't delete";
( run in 1.158 second using v1.01-cache-2.11-cpan-49f99fa48dc )