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

(-)a/t/db_dependent/Koha/Bookings.t (-7 / +40 lines)
Lines 33-39 my $builder = t::lib::TestBuilder->new; Link Here
33
33
34
subtest 'filter_by_active' => sub {
34
subtest 'filter_by_active' => sub {
35
35
36
    plan tests => 5;
36
    plan tests => 7;
37
37
38
    $schema->storage->txn_begin;
38
    $schema->storage->txn_begin;
39
39
Lines 50-56 subtest 'filter_by_active' => sub { Link Here
50
            value => {
50
            value => {
51
                biblio_id  => $biblio->biblionumber,
51
                biblio_id  => $biblio->biblionumber,
52
                start_date => $start_ago,
52
                start_date => $start_ago,
53
                end_date   => $end_hour
53
                end_date   => $end_hour,
54
                status     => 'new'
55
54
            }
56
            }
55
        }
57
        }
56
    );
58
    );
Lines 62-68 subtest 'filter_by_active' => sub { Link Here
62
            value => {
64
            value => {
63
                biblio_id  => $biblio->biblionumber,
65
                biblio_id  => $biblio->biblionumber,
64
                start_date => $start_ago,
66
                start_date => $start_ago,
65
                end_date   => $end_ago
67
                end_date   => $end_ago,
68
                status     => 'new'
69
66
            }
70
            }
67
        }
71
        }
68
    );
72
    );
Lines 74-80 subtest 'filter_by_active' => sub { Link Here
74
            value => {
78
            value => {
75
                biblio_id  => $biblio->biblionumber,
79
                biblio_id  => $biblio->biblionumber,
76
                start_date => $start_hour,
80
                start_date => $start_hour,
77
                end_date   => $end_hour
81
                end_date   => $end_hour,
82
                status     => 'new'
83
78
            }
84
            }
79
        }
85
        }
80
    );
86
    );
Lines 86-92 subtest 'filter_by_active' => sub { Link Here
86
            value => {
92
            value => {
87
                biblio_id  => $biblio->biblionumber,
93
                biblio_id  => $biblio->biblionumber,
88
                start_date => $start_day,
94
                start_date => $start_day,
89
                end_date   => $end_day
95
                end_date   => $end_day,
96
                status     => 'new'
90
            }
97
            }
91
        }
98
        }
92
    );
99
    );
Lines 98-104 subtest 'filter_by_active' => sub { Link Here
98
            value => {
105
            value => {
99
                biblio_id  => $biblio->biblionumber,
106
                biblio_id  => $biblio->biblionumber,
100
                start_date => $start_day,
107
                start_date => $start_day,
101
                end_date   => $end_ago
108
                end_date   => $end_ago,
109
                status     => 'new'
102
            }
110
            }
103
        }
111
        }
104
    );
112
    );
Lines 107-111 subtest 'filter_by_active' => sub { Link Here
107
        'EDGE CASE: Booking starting in future, already ended is not counted - should be impossible, but good check'
115
        'EDGE CASE: Booking starting in future, already ended is not counted - should be impossible, but good check'
108
    );
116
    );
109
117
118
    $builder->build_object(
119
        {
120
            class => 'Koha::Bookings',
121
            value => {
122
                biblio_id  => $biblio->biblionumber,
123
                start_date => $start_day,
124
                end_date   => $end_day,
125
                status     => 'cancelled'
126
            }
127
        }
128
    );
129
    is( $biblio->bookings->filter_by_active->count, 3, 'Cancelled bookings are not counted' );
130
131
    $builder->build_object(
132
        {
133
            class => 'Koha::Bookings',
134
            value => {
135
                biblio_id  => $biblio->biblionumber,
136
                start_date => $start_day,
137
                end_date   => $end_day,
138
                status     => 'completed'
139
            }
140
        }
141
    );
142
    is( $biblio->bookings->filter_by_active->count, 3, 'Completed bookings are not counted' );
143
110
    $schema->storage->txn_rollback;
144
    $schema->storage->txn_rollback;
111
};
145
};
112
- 

Return to bug 38175