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

(-)a/t/db_dependent/Koha/Patron/Modifications.t (-2 / +40 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use utf8;
20
use utf8;
21
21
22
use Test::More tests => 6;
22
use Test::More tests => 7;
23
use Test::Exception;
23
use Test::Exception;
24
24
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
Lines 383-385 sub set_logged_in_user { Link Here
383
        '',                      ''
383
        '',                      ''
384
    );
384
    );
385
}
385
}
386
- 
386
387
subtest 'dateofbirth tests' => sub {
388
    plan tests => 3;
389
390
    $schema->storage->txn_begin;
391
392
    # Cleaning the field
393
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01' } } );
394
    my $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => undef }
395
    )->store;
396
    $patron_modification->approve;
397
398
    $patron->discard_changes;
399
    is( $patron->dateofbirth, undef, 'dateofbirth must a been set to NULL if required' );
400
401
    # FIXME ->approve must have been removed it, but it did not. There may be an hidden bug here.
402
    Koha::Patron::Modifications->search({ borrowernumber => $patron->borrowernumber })->delete;
403
404
    # Adding a dateofbirth
405
    $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-02-02' }
406
    )->store;
407
    $patron_modification->approve;
408
409
    $patron->discard_changes;
410
    is( $patron->dateofbirth, '1980-02-02', 'dateofbirth must a been set' );
411
412
    # FIXME ->approve must have been removed it, but it did not. There may be an hidden bug here.
413
    Koha::Patron::Modifications->search({ borrowernumber => $patron->borrowernumber })->delete;
414
415
    # Modifying a dateofbirth
416
    $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-03-03' }
417
    )->store;
418
    $patron_modification->approve;
419
420
    $patron->discard_changes;
421
    is( $patron->dateofbirth, '1980-03-03', 'dateofbirth must a been updated' );
422
423
    $schema->storage->txn_rollback;
424
};

Return to bug 11853