use strict;
use warnings;
-use base qw/DBIx::Class::Core DBIx::Class::DB/;
-
-# Modules CDBICompat needs that DBIx::Class does not.
-my @Extra_Modules = qw(
- Class::Trigger
- DBIx::ContextualFetch
- Clone
-);
-my @didnt_load;
-for my $module (@Extra_Modules) {
- push @didnt_load, $module unless eval qq{require $module};
+BEGIN {
+ require DBIx::Class::Optional::Dependencies;
+ if (my $missing = DBIx::Class::Optional::Dependencies->req_missing_for('cdbicompat')) {
+ die "The following extra modules are required for DBIx::Class::CDBICompat: $missing\n";
+ }
}
-__PACKAGE__->throw_exception("@{[ join ', ', @didnt_load ]} are missing and are required for CDBICompat")
- if @didnt_load;
+use base qw/DBIx::Class::Core DBIx::Class::DB/;
__PACKAGE__->load_own_components(qw/
Constraints
# this prevents the "skips due to forgotten deps" issue
test_adhoc => {
req => {
+ 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
+ 'Class::DBI' => '3.000005',
'Date::Simple' => '3.03',
'YAML' => '0',
'Class::Unload' => '0.07',
+ 'Time::Piece' => '0',
+ 'Time::Piece::MySQL' => '0',
},
},
},
},
+ cdbicompat => {
+ req => {
+ 'Class::Data::Inheritable' => '0',
+ 'Class::Trigger' => '0',
+ 'DBIx::ContextualFetch' => '0',
+ 'Clone' => '0.32',
+ },
+ pod => {
+ title => 'DBIx::Class::CDBICompat support',
+ desc => 'Modules required for L<DBIx::Class::CDBICompat>'
+ },
+ },
+
test_pod => {
req => {
'Test::Pod' => '1.42',
},
},
- test_cdbicompat => {
- include => 'icdt',
- req => {
- 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
- 'Time::Piece::MySQL' => '0',
- },
- },
# this is just for completeness as SQLite
# is a core dep of DBIC for testing
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
}
{
- SKIP: {
- skip "No column objects", 1;
+ {
+ local $TODO = "No column objects";
eval { my @grps = State->__grouper->groups_for("Huh"); };
ok $@, "Huh not in groups";
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use Test::Warn;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use Test::Exception;
use DBIx::Class::_Util 'sigwarn_silencer';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
+use Test::Exception;
use lib 't/cdbi/testlib';
use Film;
like $@, qr/fails.*constraint/, "Fails listref constraint";
my $ok = eval { Film->create({ Rating => 'U' }) };
is $@, '', "Can create with rating U";
- SKIP: {
- skip "No column objects", 2;
- ok +Film->find_column('rating')->is_constrained, "Rating is constrained";
- ok +Film->find_column('director')->is_constrained, "Director is not";
+ {
+ local $TODO = "No column objects";
+ lives_ok { Film->find_column('rating')->is_constrained || die } "Rating is constrained";
+ lives_ok { Film->find_column('director')->is_constrained || die } "Director is not";
}
}
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use Test::Exception;
use DBIx::Class::_Util 'sigwarn_silencer';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat test_rdbms_mysql Time::Piece::MySQL>=0 );
+
$| = 1;
use warnings;
use strict;
use Test::More;
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');
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use Data::Dumper;
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat Time::Piece>=0 );
+
use strict;
use warnings;
+
use Test::More;
use Test::Warn;
-use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
-
-eval { require Time::Piece }
- or plan skip_all => 'Time::Piece required for this test';
-
package Temp::DBI;
use base qw(DBIx::Class::CDBICompat);
Temp::DBI->columns(All => qw(id date));
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( icdt cdbicompat );
+
use strict;
use warnings;
-use Test::More;
-use lib qw(t/cdbi/testlib);
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
-
-BEGIN {
- eval { require DateTime; DateTime->VERSION(0.55) }
- or plan skip_all => 'DateTime 0.55 required for this test';
-}
+use Test::More;
+use lib 't/lib';
+use DBICTest;
my $schema = DBICTest->init_schema();
-use DBIx::Class::Optional::Dependencies -skip_all_without => qw( rdbms_sqlite icdt );
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat rdbms_sqlite icdt );
use strict;
use warnings;
+# Columns in CDBI could be defined as Class::DBI::Column objects rather than
+# or as well as with __PACKAGE__->columns();
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat Class::DBI>=3.000005 );
+
use strict;
use warnings;
use Test::More;
-use lib 't/cdbi/testlib';
-
-# Columns in CDBI could be defined as Class::DBI::Column objects rather than
-# or as well as with __PACKAGE__->columns();
-BEGIN {
- eval { require Class::DBI and Class::DBI->VERSION('3.0.5') }
- or plan skip_all => 'The tested functionality is only available in Class::DBI >= 3.0.5'
-}
+use lib 't/cdbi/testlib';
use ColumnObject;
ok(ColumnObject->can('db_Main'), 'set_db()');
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
#----------------------------------------------------------------------
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( cdbicompat Class::DBI::Plugin::DeepAbstractSearch>=0 );
+
use strict;
use warnings;
-use Test::More;
-use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
+use Test::More;
-BEGIN {
- eval { require Class::DBI::Plugin::DeepAbstractSearch }
- or plan skip_all => 'Class::DBI::Plugin::DeepAbstractSearch required for this test';
-}
+use lib 't/lib';
+use DBICTest;
my $DB = DBICTest->_sqlite_dbname(sqlite_use_file => 1);;
-use Test::More;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
use strict;
use warnings;
+use Test::More;
+
use lib 't/cdbi/testlib';
use Film;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use Test::Warn;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
use Test::More;
-use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
-
{
package Thing;
use base qw(DBIx::Class::CDBICompat);
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
-use Test::More;
-use Class::Inspector ();
+use Test::More;
use lib 't/cdbi/testlib';
use Director;
-# Test that has_many() will load the foreign class.
+# Test that has_many() will load the foreign class
+require Class::Inspector;
ok !Class::Inspector->loaded( 'Film' );
-ok eval { Director->has_many( films => 'Film' ); 1; } || diag $@;
+ok eval { Director->has_many( films => 'Film' ); 1; } or diag $@;
my $shan_hua = Director->create({
Name => "Shan Hua",
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
package Foo;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
#----------------------------------------------------------------------
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
$| = 1;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
+
use Test::More;
use lib 't/cdbi/testlib';
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( icdt cdbicompat );
+
use strict;
use warnings;
-use Test::More;
+use Test::More;
use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite (); # this will issue the necessary SKIPs on missing reqs
-
-BEGIN {
- eval { require DateTime; DateTime->VERSION(0.55) }
- or plan skip_all => 'DateTime 0.55 required for this test';
-}
-
# Don't use Test::NoWarnings because of an unrelated DBD::SQLite warning.
my @warnings;
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( icdt cdbicompat );
+
use strict;
use warnings;
+
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 { require DateTime; DateTime->VERSION(0.55) }
- or plan skip_all => 'DateTime 0.55 required for this test';
-}
{
package Thing;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
use strict;
use warnings;
use Test::More;
-use lib 't/cdbi/testlib';
-use DBIC::Test::SQLite;
+use lib 't/lib';
+use DBICTest;
DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/);
package # hide from PAUSE
DBIC::Test::SQLite;
+use strict;
+use warnings;
+
=head1 NAME
DBIx::Class::Test::SQLite - Base class for running Class::DBI tests against DBIx::Class compat layer, shamelessly ripped from Class::DBI::Test::SQLite
=cut
-use strict;
-use warnings;
-
-use Test::More;
-
# adding implicit search criteria to the iterator will alter the test
# mechanics - leave everything as-is instead, and hope SQLite won't
# change too much
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/);
use base qw(DBIx::Class::CDBICompat);
-our $dbh;
-
-my $err;
-if (! $ENV{DBICTEST_MYSQL_DSN} ) {
- $err = 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test';
-}
-elsif ( ! DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql') ) {
- $err = 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mysql')
-}
-
-if ($err) {
- my $t = eval { Test::Builder->new };
- if ($t and ! $t->current_test) {
- $t->skip_all ($err);
- }
- else {
- die "$err\n";
- }
-}
-
my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0});
# this is only so we grab a lock on mysql
{
my $x = DBICTest::Schema->connect(@connect);
}
-$dbh = DBI->connect(@connect) or die DBI->errstr;
+our $dbh = DBI->connect(@connect) or die DBI->errstr;
my @table;
END {