Commit | Line | Data |
0e773352 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use Test::Warn; |
6 | use Test::Exception; |
7 | use lib qw(t/lib); |
8 | use 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 | |
20 | my $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') } ); |
25 | CREATE 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 | ) |
31 | EOS |
32 | |
33 | my $legacy = sub { $schema->resultset('Artist')->search({ name => 'foo'})->next }; |
34 | if (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 | } |
41 | else { |
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 | |
49 | done_testing; |