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 372-374 subtest 'pending_count() and pending() tests' => sub { Link Here
372
372
373
    $schema->storage->txn_rollback;
373
    $schema->storage->txn_rollback;
374
};
374
};
375
- 
375
376
subtest 'dateofbirth tests' => sub {
377
    plan tests => 3;
378
379
    $schema->storage->txn_begin;
380
381
    # Cleaning the field
382
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01' } } );
383
    my $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => undef }
384
    )->store;
385
    $patron_modification->approve;
386
387
    $patron->discard_changes;
388
    is( $patron->dateofbirth, undef, 'dateofbirth must a been set to NULL if required' );
389
390
    # FIXME ->approve must have been removed it, but it did not. There may be an hidden bug here.
391
    Koha::Patron::Modifications->search({ borrowernumber => $patron->borrowernumber })->delete;
392
393
    # Adding a dateofbirth
394
    $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-02-02' }
395
    )->store;
396
    $patron_modification->approve;
397
398
    $patron->discard_changes;
399
    is( $patron->dateofbirth, '1980-02-02', 'dateofbirth must a been set' );
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
    # Modifying a dateofbirth
405
    $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-03-03' }
406
    )->store;
407
    $patron_modification->approve;
408
409
    $patron->discard_changes;
410
    is( $patron->dateofbirth, '1980-03-03', 'dateofbirth must a been updated' );
411
412
    $schema->storage->txn_rollback;
413
};

Return to bug 11853