File: proxy-resultset-method.t

package info (click to toggle)
libdbix-class-helpers-perl 2.013002-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 420 kB
  • sloc: perl: 1,931; sql: 73; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 668 bytes parent folder | download
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
29
30
31
32
33
34
#!perl

use strict;
use warnings;

use lib 't/lib';
use Test::More;
use Test::Deep;

use TestSchema;
my $schema = TestSchema->deploy_or_connect();
$schema->prepopulate;

my $g = $schema->resultset('Gnarly')->search({
   id => 1
})->single;

subtest 'unloaded data' => sub {
   is($g->id_plus_one, 2, 'basic test');
   is($g->id_plus_two, 3, 'slot and specified method');
   is($g->id_plus_two, 3, 'slot and specified method(2)');
};

my $g2 = $schema->resultset('Gnarly')->with_id_plus_one->search({
   id => 2
})->single;

subtest 'loaded data' => sub {
   is($g2->id_plus_one, 3, 'basic');
   is($g2->id_plus_two, 4, 'slot and specified method');
};

done_testing;