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

(-)a/t/db_dependent/Koha/ILL/Request.t (-2 / +20 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 3;
23
use Test::MockModule;
23
24
24
use Koha::ILL::Requests;
25
use Koha::ILL::Requests;
25
26
Lines 30-40 my $schema = Koha::Database->new->schema; Link Here
30
31
31
subtest 'patron() tests' => sub {
32
subtest 'patron() tests' => sub {
32
33
33
    plan tests => 3;
34
    plan tests => 5;
34
35
35
    $schema->storage->txn_begin;
36
    $schema->storage->txn_begin;
36
37
37
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
38
    my $patron_module = Test::MockModule->new('Koha::Patron');
39
40
    my $patroncategory = $builder->build_object(
41
        {
42
            class => 'Koha::Patron::Categories',
43
            value => { can_place_ill_in_opac => 1, BlockExpiredPatronOpacActions => 'ill_request' }
44
        }
45
    );
46
    my $patron =
47
        $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patroncategory->id } } );
38
    my $request =
48
    my $request =
39
        $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } );
49
        $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } );
40
50
Lines 46-51 subtest 'patron() tests' => sub { Link Here
46
56
47
    is( $request->patron, undef );
57
    is( $request->patron, undef );
48
58
59
    # patron is not expired, is allowed
60
    $patron_module->mock( 'is_expired', sub { return 0; } );
61
    is( $request->can_patron_place_ill_in_opac($patron), 1 );
62
63
    # patron is expired, is not allowed
64
    $patron_module->mock( 'is_expired', sub { return 1; } );
65
    is( $request->can_patron_place_ill_in_opac($patron), 0 );
66
49
    $schema->storage->txn_rollback;
67
    $schema->storage->txn_rollback;
50
};
68
};
51
69
(-)a/t/db_dependent/Koha/Patron/Categories.t (-3 / +3 lines)
Lines 103-110 subtest 'get_expiry_date' => sub { Link Here
103
};
103
};
104
104
105
subtest 'BlockExpiredPatronOpacActions' => sub {
105
subtest 'BlockExpiredPatronOpacActions' => sub {
106
    plan tests => 3;
106
    plan tests => 4;
107
    t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold');
107
    t::lib::Mocks::mock_preference( 'BlockExpiredPatronOpacActions', 'hold,ill_request' );
108
    my $category = Koha::Patron::Category->new({
108
    my $category = Koha::Patron::Category->new({
109
        categorycode => 'ya_cat',
109
        categorycode => 'ya_cat',
110
        category_type => 'A',
110
        category_type => 'A',
Lines 113-118 subtest 'BlockExpiredPatronOpacActions' => sub { Link Here
113
        BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions',
113
        BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions',
114
    })->store;
114
    })->store;
115
    is( $category->effective_BlockExpiredPatronOpacActions_contains('hold'), 1 );
115
    is( $category->effective_BlockExpiredPatronOpacActions_contains('hold'), 1 );
116
    is( $category->effective_BlockExpiredPatronOpacActions_contains('ill_request'), 1 );
116
    is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), undef );
117
    is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), undef );
117
    $category->BlockExpiredPatronOpacActions('renew')->store;
118
    $category->BlockExpiredPatronOpacActions('renew')->store;
118
    is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), 1 );
119
    is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), 1 );
119
- 

Return to bug 34597