Commit | Line | Data |
e60dc79f |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | use lib qw(t/lib); |
8 | use DBICTest; |
9 | |
10 | my $schema = DBICTest->init_schema(); |
11 | |
12 | plan tests => 3; |
13 | |
14 | my $bookmark = $schema->resultset("Bookmark")->find(1); |
15 | my $link = $bookmark->link; |
16 | my $link_id = $link->id; |
17 | ok $link->id; |
18 | |
19 | $link->delete; |
20 | is $schema->resultset("Link")->search(id => $link_id)->count, 0, |
21 | "link $link_id was deleted"; |
22 | |
23 | # Get a fresh object with nothing cached |
24 | $bookmark = $schema->resultset("Bookmark")->find($bookmark->id); |
25 | |
26 | # This would create a new link row if none existed |
27 | $bookmark->link; |
28 | |
29 | is $schema->resultset("Link")->search(id => $link_id)->count, 0, |
30 | 'accessor did not create a link object where there was none'; |