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

(-)a/t/db_dependent/Koha/Patron.t (-2 / +32 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 30;
22
use Test::More tests => 31;
23
use Test::Exception;
23
use Test::Exception;
24
use Test::Warn;
24
use Test::Warn;
25
use Time::Fake;
25
use Time::Fake;
Lines 29-34 use Koha::Database; Link Here
29
use Koha::DateUtils qw(dt_from_string);
29
use Koha::DateUtils qw(dt_from_string);
30
use Koha::ArticleRequests;
30
use Koha::ArticleRequests;
31
use Koha::Patrons;
31
use Koha::Patrons;
32
use Koha::List::Patron qw(AddPatronList AddPatronsToList);
32
use Koha::Patron::Relationships;
33
use Koha::Patron::Relationships;
33
use C4::Circulation qw( AddIssue AddReturn );
34
use C4::Circulation qw( AddIssue AddReturn );
34
35
Lines 2114-2116 subtest 'update_lastseen tests' => sub { Link Here
2114
    Time::Fake->reset;
2115
    Time::Fake->reset;
2115
    $schema->storage->txn_rollback;
2116
    $schema->storage->txn_rollback;
2116
};
2117
};
2117
- 
2118
2119
subtest 'get_lists_with_patron() tests' => sub {
2120
2121
    plan tests => 4;
2122
2123
    $schema->storage->txn_begin;
2124
2125
    my $owner = $builder->build_object( { class => 'Koha::Patrons' } );
2126
2127
    my $list_1 = AddPatronList( { name => ' Ya',  owner => $owner->id } );
2128
    my $list_2 = AddPatronList( { name => 'Hey!', owner => $owner->id } );
2129
2130
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
2131
2132
    my @lists = $patron->get_lists_with_patron();
2133
2134
    is( scalar @lists, 0, 'Patron not included in any list' );
2135
2136
    AddPatronsToList( { list => $list_1, cardnumbers => [ $patron->cardnumber ] } );
2137
    AddPatronsToList( { list => $list_2, cardnumbers => [ $patron->cardnumber ] } );
2138
2139
    @lists = $patron->get_lists_with_patron();
2140
    foreach my $list (@lists) {
2141
        is( ref($list), 'Koha::Schema::Result::PatronList', 'Type is correct' );
2142
    }
2143
2144
    is( join( ' ', map { $_->name } @lists ), ' Ya Hey!', 'Lists are the correct ones, and sorted alphabetically' );
2145
2146
    $schema->storage->txn_rollback;
2147
};

Return to bug 32730