Add changelog entry on 90c9dd1d, 757891ed and 89203568
[dbsrgits/DBIx-Class.git] / t / resultset / find.t
CommitLineData
d0289ee1 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3use strict;
4use warnings;
5
6use Test::More;
7use Test::Exception;
8
9use DBICTest;
10
11my $schema = DBICTest->init_schema();
12
13# this has been warning for 4 years, killing
14throws_ok {
15 $schema->resultset('Artist')->find(artistid => 4);
16} qr|expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint|;
17
18{
19 my $exception_callback_count = 0;
20
21 my $ea = $schema->exception_action(sub {
22 $exception_callback_count++;
23 die @_;
24 });
25
26 # No, this is not a great idea.
27 # Yes, people do it anyway.
28 # Might as well test that we have fixed it for good, by never invoking
29 # a potential __DIE__ handler in internal_try() stacks
30 local $SIG{__DIE__} = sub { $ea->(@_) };
31
32 # test find on non-unique non-existing value
33 is (
34 $schema->resultset('Artist')->find({ rank => 666 }),
35 undef
36 );
37
38 # test find on an unresolvable condition
39 is(
40 $schema->resultset('Artist')->find({ artistid => [ -and => 1, 2 ]}),
41 undef
42 );
43
44 is $exception_callback_count, 0, 'exception_callback never invoked';
45}
46
47done_testing;