Deprecate emulate_limit() - can not be sanely supported by DQ
[dbsrgits/DBIx-Class.git] / t / storage / source_bind_compat.t
CommitLineData
0e773352 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Warn;
6use Test::Exception;
7use lib qw(t/lib);
8use DBICTest;
9
10{
11 package DBICTest::Legacy::Storage;
12 use base 'DBIx::Class::Storage::DBI::SQLite';
13
14 use Data::Dumper::Concise;
15
16 sub source_bind_attributes { return {} }
17}
18
19
20my $schema = DBICTest::Schema->clone;
21$schema->storage_type('DBICTest::Legacy::Storage');
22$schema->connection('dbi:SQLite::memory:');
23
24$schema->storage->dbh_do( sub { $_[1]->do(<<'EOS') } );
25CREATE TABLE artist (
26 artistid INTEGER PRIMARY KEY NOT NULL,
27 name varchar(100),
28 rank integer NOT NULL DEFAULT 13,
29 charfield char(10)
30)
31EOS
32
33my $legacy = sub { $schema->resultset('Artist')->search({ name => 'foo'})->next };
34if (DBIx::Class->VERSION >= 0.09) {
35 &throws_ok(
36 $legacy,
37 qr/XXXXXXXXX not sure what error to put here yet XXXXXXXXXXXXXXX/,
38 'deprecated use of source_bind_attributes throws',
39 );
40}
41else {
42 &warnings_exist (
43 $legacy,
44 qr/\QThe source_bind_attributes() override in DBICTest::Legacy::Storage relies on a deprecated codepath/,
45 'Warning issued during invocation of legacy storage codepath',
46 );
47}
48
49done_testing;