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

(-)a/t/db_dependent/Koha/ILL/Request.t (-2 / +41 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::NoWarnings;
22
use Test::NoWarnings;
23
use Test::More tests => 6;
23
use Test::More tests => 7;
24
use Test::MockModule;
24
use Test::MockModule;
25
25
26
use Koha::ILL::Requests;
26
use Koha::ILL::Requests;
Lines 197-199 subtest 'get_backend_plugin() tests' => sub { Link Here
197
197
198
    $schema->storage->txn_rollback;
198
    $schema->storage->txn_rollback;
199
};
199
};
200
- 
200
201
subtest 'trim_form_params() tests' => sub {
202
203
    plan tests => 4;
204
205
    $schema->storage->txn_begin;
206
207
    my $request = $builder->build_sample_ill_request();
208
209
    my $params = {
210
        'pubmedid' => '',
211
        'doi'      => ' abc',
212
        'type'     => 'article',
213
        'backend'  => 'Standard',
214
    };
215
216
    my $trimmed_params = $request->trim_form_params($params);
217
218
    is(
219
        $trimmed_params->{doi}, 'abc',
220
        'param with leading white space is correctly trimmed'
221
    );
222
223
    is(
224
        $trimmed_params->{pubmedid}, '',
225
        'empty param remains empty'
226
    );
227
228
    is(
229
        $trimmed_params->{nonexistent}, undef,
230
        'undef param remains undef'
231
    );
232
233
    is(
234
        $trimmed_params->{type}, $trimmed_params->{type},
235
        'already trimmed param remains unchanged'
236
    );
237
238
    $schema->storage->txn_rollback;
239
};

Return to bug 39944