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

(-)a/t/db_dependent/Koha/ArticleRequests.t (-53 / +3 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 3;
20
use Test::More tests => 2;
21
use Test::MockModule;
21
use Test::MockModule;
22
22
23
use Koha::ArticleRequest::Status;
23
use Koha::ArticleRequest::Status;
Lines 79-87 subtest 'requested() tests' => sub { Link Here
79
    $schema->storage->txn_rollback;
79
    $schema->storage->txn_rollback;
80
};
80
};
81
81
82
subtest 'filter_by_current() tests' => sub {
82
subtest 'filter_by_current / filter_by_finished tests' => sub {
83
83
84
    plan tests => 1;
84
    plan tests => 2;
85
85
86
    $schema->storage->txn_begin;
86
    $schema->storage->txn_begin;
87
87
Lines 129-183 subtest 'filter_by_current() tests' => sub { Link Here
129
129
130
    is( $current_article_requests->count, 3, 'Count is correct' );
130
    is( $current_article_requests->count, 3, 'Count is correct' );
131
131
132
    $schema->storage->txn_rollback;
133
};
134
135
subtest 'filter_by_current() tests' => sub {
136
137
    plan tests => 1;
138
139
    $schema->storage->txn_begin;
140
141
    my $ar_requested = $builder->build_object(
142
        {
143
            class => 'Koha::ArticleRequests',
144
            value => { status => Koha::ArticleRequest::Status::Requested }
145
        }
146
    );
147
    my $ar_pending = $builder->build_object(
148
        {
149
            class => 'Koha::ArticleRequests',
150
            value => { status => Koha::ArticleRequest::Status::Pending }
151
        }
152
    );
153
    my $ar_processing = $builder->build_object(
154
        {
155
            class => 'Koha::ArticleRequests',
156
            value => { status => Koha::ArticleRequest::Status::Processing }
157
        }
158
    );
159
    my $ar_completed = $builder->build_object(
160
        {
161
            class => 'Koha::ArticleRequests',
162
            value => { status => Koha::ArticleRequest::Status::Completed }
163
        }
164
    );
165
    my $ar_cancelled = $builder->build_object(
166
        {
167
            class => 'Koha::ArticleRequests',
168
            value => { status => Koha::ArticleRequest::Status::Canceled }
169
        }
170
    );
171
172
    my $article_requests = Koha::ArticleRequests->search(
173
        {
174
            id => [
175
                $ar_requested->id, $ar_pending->id, $ar_processing->id,
176
                $ar_completed->id, $ar_cancelled->id
177
            ]
178
        }
179
    );
180
181
    my $finished_article_requests = $article_requests->filter_by_finished;
132
    my $finished_article_requests = $article_requests->filter_by_finished;
182
133
183
    is( $finished_article_requests->count, 2, 'Count is correct' );
134
    is( $finished_article_requests->count, 2, 'Count is correct' );
184
- 

Return to bug 29082