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 => 8;
23
use Test::More tests => 9;
24
use Test::MockModule;
24
use Test::MockModule;
25
25
26
use Koha::ILL::Requests;
26
use Koha::ILL::Requests;
Lines 299-301 subtest 'add_or_update_attributes() tests' => sub { Link Here
299
299
300
    $schema->storage->txn_rollback;
300
    $schema->storage->txn_rollback;
301
};
301
};
302
- 
302
303
subtest 'trim_form_params() tests' => sub {
304
305
    plan tests => 4;
306
307
    $schema->storage->txn_begin;
308
309
    my $request = $builder->build_sample_ill_request();
310
311
    my $params = {
312
        'pubmedid' => '',
313
        'doi'      => ' abc',
314
        'type'     => 'article',
315
        'backend'  => 'Standard',
316
    };
317
318
    my $trimmed_params = $request->trim_form_params($params);
319
320
    is(
321
        $trimmed_params->{doi}, 'abc',
322
        'param with leading white space is correctly trimmed'
323
    );
324
325
    is(
326
        $trimmed_params->{pubmedid}, '',
327
        'empty param remains empty'
328
    );
329
330
    is(
331
        $trimmed_params->{nonexistent}, undef,
332
        'undef param remains undef'
333
    );
334
335
    is(
336
        $trimmed_params->{type}, $trimmed_params->{type},
337
        'already trimmed param remains unchanged'
338
    );
339
340
    $schema->storage->txn_rollback;
341
};

Return to bug 39944