File: doesnt_exist.t

package info (click to toggle)
libdbix-class-perl 0.082843-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (28 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest->init_schema();

plan tests => 3;

my $bookmark = $schema->resultset("Bookmark")->find(1);
my $link = $bookmark->link;
my $link_id = $link->id;
ok $link->id;

$link->delete;
is $schema->resultset("Link")->search({id => $link_id})->count, 0,
    "link $link_id was deleted";

# Get a fresh object with nothing cached
$bookmark = $schema->resultset("Bookmark")->find($bookmark->id);

# This would create a new link row if none existed
$bookmark->link;

is $schema->resultset("Link")->search({id => $link_id})->count, 0,
    'accessor did not create a link object where there was none';