View | Details | Raw Unified | Return to bug 32980
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patron/siblings.t (-18 / +8 lines)
Lines 2-10 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use String::Random;
6
use Test::More tests => 1;
5
use Test::More tests => 1;
7
6
7
use t::lib::TestBuilder;
8
8
use Koha::Database;
9
use Koha::Database;
9
use Koha::Patrons;
10
use Koha::Patrons;
10
11
Lines 14-38 subtest 'Koha::Patrons::siblings should return a Koha::Patrons object even if pa Link Here
14
    plan tests => 2;
15
    plan tests => 2;
15
    $schema->txn_begin;
16
    $schema->txn_begin;
16
17
17
    my $random = String::Random->new;
18
    my $builder  = t::lib::TestBuilder->new;
18
19
    my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } );
19
    my $categorycode = $random->randpattern('CCCCCCCCCC');
20
    my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
20
    my $branchcode   = $random->randpattern('CCCCCCCCCC');
21
    my $patron   = $builder->build_object(
21
22
    my $category = $schema->resultset('Category')->create( { categorycode => $categorycode } );
23
    my $branch   = $schema->resultset('Branch')->create(
24
        {
25
            branchcode => $branchcode,
26
            branchname => 'Test branch for Koha::Patron::siblings tests',
27
        }
28
    );
29
    my $borrower = $schema->resultset('Borrower')->create(
30
        {
22
        {
31
            categorycode => $categorycode,
23
            class => 'Koha::Patrons',
32
            branchcode   => $branchcode,
24
            value => { categorycode => $category->categorycode, branchcode => $library->branchcode }
33
        }
25
        }
34
    );
26
    );
35
    my $patron = Koha::Patrons->find( $borrower->borrowernumber );
36
27
37
    my $siblings = $patron->siblings;
28
    my $siblings = $patron->siblings;
38
    isa_ok( $siblings, 'Koha::Patrons' );
29
    isa_ok( $siblings, 'Koha::Patrons' );
39
- 

Return to bug 32980