my $schema = DBICTest->init_schema();
-BEGIN {
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6);
-}
-
my $art = $schema->resultset("Artist")->find(1);
isa_ok $art => 'DBICTest::Artist';
ok($art->name($name) eq $name, 'update');
-{
+{
my @changed_keys = $art->is_changed;
is( scalar (@changed_keys), 0, 'field changed but same value' );
-}
+}
$art->discard_changes;
my $art_100 = $schema->resultset("Artist")->find(100);
$art_100->artistid(101);
ok($art_100->update(), 'update allows pk mutation via column accessor');
+
+done_testing;
my $schema = DBICTest->init_schema();
-BEGIN {
- eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10);
-}
-
# test LIMIT
my $it = $schema->resultset("CD")->search( {},
{ rows => 3,
);
is( $it->count, 1, "complex abstract count ok" );
+done_testing;
my $orig_debug = $schema->storage->debug;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 33 );
-}
-
# test the abstract join => SQL generator
my $sa = new DBIx::Class::SQLAHacks;
is(cd_count(), 5, '5 rows in table cd');
is(tk_count(), 3, '3 rows in table twokeys');
}
+
+done_testing;
my $schema = DBICTest->init_schema;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 13 );
-}
-
my $where_bind = {
where => \'name like ?',
bind => [ 'Cat%' ],
bind => [ 'Spoon%' ] });
is ( $rs->count, 1, '...cookbook + chained search with extra bind' );
}
+
+done_testing;
use lib qw(t/lib);
use DBIC::SqlMakerTest;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 7 );
-}
-
use_ok('DBICTest');
use_ok('DBIC::DebugObj');
$schema->storage->sql_maker->name_sep('.');
is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
+
+done_testing;
use lib qw(t/lib);
use DBIC::SqlMakerTest;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 7 );
-}
-
use_ok('DBICTest');
use_ok('DBIC::DebugObj');
);
is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
+
+done_testing;
-use Class::C3;
use strict;
-use Test::More;
use warnings;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 4 );
-}
+use Test::More;
+use Test::Warn;
+use Test::Exception;
use lib qw(t/lib);
-
use_ok( 'DBICTest' );
use_ok( 'DBICTest::Schema' );
+
my $schema = DBICTest->init_schema;
-{
- my $warnings;
- local $SIG{__WARN__} = sub { $warnings .= $_[0] };
- eval {
- $schema->resultset('CD')
- ->create({ title => 'vacation in antarctica' })
- };
- like $@, qr/NULL/; # as opposed to some other error
- unlike( $warnings, qr/uninitialized value/, "No warning from Storage" );
-}
+warnings_are ( sub {
+ throws_ok (sub {
+ $schema->resultset('CD')->create({ title => 'vacation in antarctica' });
+ }, qr/NULL/); # as opposed to some other error
+}, [], 'No warnings besides exception' );
+done_testing;