test_cdbicompat => {
req => {
- 'DBIx::ContextualFetch' => '0',
+ 'Class::DBI' => 0,
'Class::DBI::Plugin::DeepAbstractSearch' => '0',
- 'Class::Trigger' => '0',
+ %$datetime_basic,
'Time::Piece::MySQL' => '0',
- 'Clone' => '0',
'Date::Simple' => '3.03',
},
},
use Test::More;
use lib 't/cdbi/testlib';
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") : (tests=> 24);
-}
-
#-----------------------------------------------------------------------
# Make sure that we can set up columns properly
is join (' ', sort A::B->columns), 'b1 id', "A::B columns";
is join (' ', sort A::C->columns), 'c1 c2 c3 id', "A::C columns";
+done_testing;
use namespace::clean;
$| = 1;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 98;
-}
-
INIT {
use lib 't/cdbi/testlib';
use Film;
"Creating and retrieving gives ref to same object";
}
+
+done_testing;
# Make sure subclasses can be themselves subclassed
#----------------------------------------------------------------------
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
- }
- plan tests => 6;
-}
-
use lib 't/cdbi/testlib';
use Film;
isa_ok $btaste => "Film::Threat";
isa_ok $btaste => "Film";
is $btaste->Title, 'Bad Taste', 'subclass get()';
+
+done_testing;
# Test lazy loading
#----------------------------------------------------------------------
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@
- ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required')
- : (tests => 36)
- ;
-}
-
INIT {
use lib 't/cdbi/testlib';
use Lazy;
# I'm too lazy to set up the proper inflation test.
ok !exists $l->{_column_data}{orp};
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- }
- plan tests => 24;
-}
-
@YA::Film::ISA = 'Film';
#local $SIG{__WARN__} = sub { };
isa_ok $foo, "Film", "Object in after_create trigger";
}
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required')
- : (tests=> 3);
-}
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite;
package A;
@A::ISA = qw(DBIx::Class::CDBICompat);
is join (' ', sort A->columns), 'id', "A columns";
is join (' ', sort A::B->columns), 'b1 id', "A::B columns";
is join (' ', sort A::C->columns), 'c1 c2 c3 id', "A::C columns";
+
+done_testing;
use strict;
use Test::More;
-
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
- plan tests => 31;
-}
-
-
use lib 't/cdbi/testlib';
use Film;
use Actor;
is_deeply [sort map { $_->id } $other_thing->things], [1,2];
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
- }
- plan tests => 13;
-}
-
use lib 't/cdbi/testlib';
use Film;
});
Film->create({director => "Me"});
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
- }
- plan tests => 50;
-}
-
use lib 't/cdbi/testlib';
use Actor;
use Film;
eval { $film->actors->delete_all };
is $@, '', "Deleting again does no harm";
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 23;
-}
-
use lib 't/cdbi/testlib';
use Film;
is $freeaa && $freeaa->codirector, '2001-03-03', "Set the codirector";
}
+done_testing;
+
__DATA__
use CGI::Untaint;
return 1;
});
}
-
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 22;
-}
-
use lib 't/cdbi/testlib';
use Film;
use Blurb;
ok $host->info->delete;
$host->discard_changes;
ok !$host->info, 'relationships rechecked after discard_changes';
-}
\ No newline at end of file
+}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 75;
-}
-
INIT {
#local $SIG{__WARN__} =
#sub { like $_[0], qr/clashes with built-in method/, $_[0] };
$_->discard_changes for ($naked, $sandl);
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 5;
-}
-
use lib 't/cdbi/testlib';
-require Film;
-require Order;
+use Film;
+use Order;
Film->has_many(orders => 'Order');
Order->has_a(film => 'Film');
isa_ok $infilm, "Film";
is $infilm->id, $film->id, "Orders hasa Film";
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 41;
-}
-
use lib 't/cdbi/testlib';
use Film;
use Director;
eval { Film->has_a(driector => "Director") };
like $@, qr/driector/, "Sensible error from has_a with incorrect column: $@";
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 20;
-}
-
use lib 't/cdbi/testlib';
use Film;
use Actor;
is $apg[1]->title, "B", "and B";
}
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- }
- plan tests => 37;
-}
-
use lib 't/cdbi/testlib';
use Film;
is $it, 0;
ok !$it, "iterator returns false when no results";
}
+
+done_testing;
use Test::More;
-eval "use DBIx::Class::CDBICompat; use Time::Piece::MySQL;";
-if ($@) {
- plan (skip_all => "Time::Piece::MySQL, Class::Trigger and DBIx::ContextualFetch required: $@");
-}
-
use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
+
+eval { require Time::Piece::MySQL }
+ or plan skip_all => 'Time::Piece::MySQL required for this test';
+
use_ok ('Log');
package main;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 2);
-}
-
use strict;
use lib 't/cdbi/testlib';
is( scalar @aliases, 1, 'proper number of aliases' );
is( $aliases[ 0 ]->name, 'Second', 'proper alias' );
-
+done_testing;
use Test::More;
use Data::Dumper;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 12;
-}
-
INIT {
use lib 't/cdbi/testlib';
use Film;
# ok eval { $dir->delete };
# is $@, '', "Can delete once films are gone";
#}
+
+done_testing;
use strict;
use Test::More;
-
-BEGIN {
- eval "use DBIx::Class::CDBICompat;use Time::Piece;";
- plan skip_all => "Time::Piece, Class::Trigger and DBIx::ContextualFetch required: $@"
- if $@;
-
- plan tests => 12;
-}
-
use Test::Warn;
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
+
package Temp::DBI;
use base qw(DBIx::Class::CDBICompat);
Temp::DBI->columns(All => qw(id date));
is $date->accessor, 'date';
is $date->args->{inflate}, $strptime_inflate;
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
- if $@;
- plan tests => 6;
-}
-
use lib 't/cdbi/testlib';
require Film;
};
is $@, '', "No errors";
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 6;
-}
-
use lib 't/cdbi/testlib';
use Film;
is( $pager->entries_on_this_page, 2, "entries on second page ok" );
is( $it->next->title, "Film 4", "second page first title ok" );
+
+done_testing;
use warnings;
use Test::More;
-use lib qw(t/lib);
-use DBICTest;
+use lib qw(t/cdbi/testlib);
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
BEGIN {
- eval "use DBIx::Class::CDBICompat; use DateTime 0.55; use Clone;";
- plan skip_all => "Clone, DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required"
- if $@;
+ eval { require DateTime; DateTime->VERSION(0.55) }
+ or plan skip_all => 'DateTime 0.55 required for this test';
}
-plan tests => 6;
-
my $schema = DBICTest->init_schema();
DBICTest::Schema::CD->load_components(qw/CDBICompat::Relationships/);
($cd) = $schema->resultset("CD")->search({ year => $now->year });
is( $cd->year->year, $now->year, 'deflate ok' );
+done_testing;
# Test database failures
#----------------------------------------------------------------------
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 7;
-}
-
use lib 't/cdbi/testlib';
use Film;
}
}
+done_testing;
use strict;
use Test::More;
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
+
BEGIN {
- eval "use DBIx::Class::CDBICompat; require Class::DBI::Plugin::DeepAbstractSearch;";
- if ($@) {
- plan (skip_all => "Class::DBI::Plugin::DeepAbstractSearch, Class::Trigger and DBIx::ContextualFetch required: $@");
- }
- plan tests => 19;
+ eval { require Class::DBI::Plugin::DeepAbstractSearch }
+ or plan skip_all => 'Class::DBI::Plugin::DeepAbstractSearch required for this test';
}
-my $DB = "t/var/cdbi_testdb";
-unlink $DB if -e $DB;
+my $DB = DBICTest->_sqlite_dbname(sqlite_use_file => 1);;
# not usre why this test needs an AutoCommit => 0 and a commit further
# down - EDONOTCARE
"CDs from Sony or Supraphon";
}
+done_testing;
+
END { unlink $DB if -e $DB }
use strict;
use warnings;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@");
- }
- plan tests => 10;
-}
-
INIT {
use lib 't/cdbi/testlib';
use Film;
[map $_->Title, @all],
"limit_dialect ignored";
+done_testing;
use Test::More;
use Test::Warn;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@" if $@;
-}
-
use lib 't/cdbi/testlib';
use Film;
use Test::More;
use lib 't/cdbi/testlib';
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 5);
-}
-
{
package Thing;
is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' );
is( $thing->foo, 42, 'custom routine not overwritten by temp column' );
is( $thing->bar, "that", 'temp column accessor generated' );
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 5);
-}
-
INIT {
use lib 't/cdbi/testlib';
use Film;
::is $film->temp_thing, 23, "construct sets temp columns";
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 4);
-}
-
INIT {
use lib 't/cdbi/testlib';
}
$new_film = $film->copy(42);
is $new_film->id, 42, "copy() with new id";
+done_testing;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@" if $@;
-}
-
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
{
package Thing;
use Test::More;
use Class::Inspector ();
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
- plan tests => 3;
-}
-
use lib 't/cdbi/testlib';
use Director;
Director => "Yu Wang",
});
-is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];
\ No newline at end of file
+is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required')
- : (tests=> 2);
-}
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
package Foo;
#::is $@, '';
::is(Foo->table, "foo");
::is_deeply [sort map lc, Foo->columns], [sort map lc, qw(foo bar)];
+
+::done_testing;
# Test database failures
#----------------------------------------------------------------------
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
- plan tests => 2;
-}
-
use lib 't/cdbi/testlib';
use Film;
is( Film->maximum_value_of("numexplodingsheep"), 10 );
is( Film->minimum_value_of("numexplodingsheep"), 2 );
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
-}
-
INIT {
use lib 't/cdbi/testlib';
require Film;
use Test::More;
use lib 't/cdbi/testlib';
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 3);
-}
-
{
package Thing;
is $thing->baz, 99;
$thing->discard_changes;
+
+done_testing;
use Test::More;
$| = 1;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- }
-}
INIT {
use lib 't/cdbi/testlib';
$film1->discard_changes;
}
+
+done_testing;
use strict;
use Test::More;
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 3);
-}
-
INIT {
use lib 't/cdbi/testlib';
use Film;
is @films, 2, "retrieve_from_sql with LIMIT";
is( $_->director, "Peter Jackson" ) for @films;
}
+
+done_testing;
use strict;
use Test::More;
+
use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
BEGIN {
- eval "use DBIx::Class::CDBICompat;use DateTime 0.55;";
- plan skip_all => "DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required: $@"
- if $@;
- plan tests => 2;
+ eval { require DateTime; DateTime->VERSION(0.55) }
+ or plan skip_all => 'DateTime 0.55 required for this test';
}
$thing->discard_changes;
is @warnings, 0, 'no warnings';
+
+done_testing;
use strict;
use Test::More;
use Test::Exception;
+
use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
BEGIN {
- eval "use DBIx::Class::CDBICompat;use DateTime 0.55;";
- plan skip_all => "DateTime 0.55, Class::Trigger and DBIx::ContextualFetch required: $@"
- if $@;
- plan tests => 1;
+ eval { require DateTime; DateTime->VERSION(0.55) }
+ or plan skip_all => 'DateTime 0.55 required for this test';
}
{
$thing->set( date => $date );
};
-
-
$thing->discard_changes;
+
+done_testing;
use Test::More;
-use lib 't/lib';
-use DBICTest;
-
-BEGIN {
- eval "use DBIx::Class::CDBICompat;";
- if ($@) {
- plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
- next;
- }
- plan tests => 9;
-}
+use lib 't/cdbi/testlib';
+use DBIC::Test::SQLite;
DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/);
no warnings qw/redefine once/;
*DBICTest::schema = sub {};
}
+
+done_testing;
use strict;
use warnings;
+use Test::More;
+
+use lib 't/lib';
+use DBICTest;
+
+BEGIN {
+ eval { require DBIx::Class::CDBICompat }
+ or plan skip_all => 'Class::DBI required for this test';
+}
+
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/CDBICompat Core DB/);