File: 14-relatives.t

package info (click to toggle)
libvalidation-class-perl 7.900057-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 1,616 kB
  • sloc: perl: 21,493; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (5)
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
use Test::More tests => 11;

BEGIN {
    use FindBin;
    use lib $FindBin::Bin . "/modules";
}

use_ok 'MyVal';

my $rules = MyVal->new(params => {flag => 1});

my $chk_person = $rules->class('person');
my $chk_ticket = $rules->class('ticket');

ok "MyVal::Person" eq ref($chk_person), 'person class loaded successfully';
ok "MyVal::Ticket" eq ref($chk_ticket), 'ticket class loaded successfully';

ok $chk_person->fields->{name},  'person class has name';
ok $chk_person->fields->{email}, 'person class has email';
ok !$chk_person->fields->{description}, 'person class doesnt have description';
ok !$chk_person->fields->{priority},    'person class doesnt have priority';

ok !$chk_ticket->fields->{name},  'ticket class doesnt have name';
ok !$chk_ticket->fields->{email}, 'ticket class doesnt have email';
ok $chk_ticket->fields->{description}, 'ticket class has description';
ok $chk_ticket->fields->{priority},    'ticket class has priority';