Merge 'trunk' into 'replication_dedux'
[dbsrgits/DBIx-Class.git] / t / relationship_doesnt_exist.t
CommitLineData
e60dc79f 1#!/usr/bin/perl -w
2
3use strict;
4use warnings;
5
6use Test::More;
7use lib qw(t/lib);
8use DBICTest;
9
10my $schema = DBICTest->init_schema();
11
12plan tests => 3;
13
14my $bookmark = $schema->resultset("Bookmark")->find(1);
15my $link = $bookmark->link;
16my $link_id = $link->id;
17ok $link->id;
18
19$link->delete;
20is $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
29is $schema->resultset("Link")->search(id => $link_id)->count, 0,
30 'accessor did not create a link object where there was none';