More robust behavior of ANFANG.pm, also guard against sitecustomize.pl
[dbsrgits/DBIx-Class.git] / t / resultset_overload.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
e60dc79f 3use strict;
f54428ab 4use warnings;
e60dc79f 5
6use Test::More;
c0329273 7
e60dc79f 8use DBICTest;
9
10my $schema = DBICTest->init_schema();
11
e60dc79f 12{
13 my $rs = $schema->resultset("CD")->search({});
14
15 ok $rs->count;
16 is $rs, $rs->count, "resultset as number with results";
17 ok $rs, "resultset as boolean always true";
18}
19
20{
21 my $rs = $schema->resultset("CD")->search({ title => "Does not exist" });
f54428ab 22
e60dc79f 23 ok !$rs->count;
24 is $rs, $rs->count, "resultset as number without results";
25 ok $rs, "resultset as boolean always true";
f54428ab 26}
27
28done_testing;