Lines 19-25
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use utf8; |
20 |
use utf8; |
21 |
|
21 |
|
22 |
use Test::More tests => 7; |
22 |
use Test::More tests => 8; |
|
|
23 |
use Test::NoWarnings; |
23 |
use Test::Exception; |
24 |
use Test::Exception; |
24 |
|
25 |
|
25 |
use t::lib::TestBuilder; |
26 |
use t::lib::TestBuilder; |
Lines 49-57
subtest 'new() tests' => sub {
Link Here
|
49 |
|
50 |
|
50 |
Koha::Patron::Modifications->search->delete; |
51 |
Koha::Patron::Modifications->search->delete; |
51 |
|
52 |
|
|
|
53 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
54 |
|
52 |
# Create new pending modification |
55 |
# Create new pending modification |
53 |
Koha::Patron::Modification->new( |
56 |
Koha::Patron::Modification->new( |
54 |
{ |
57 |
{ |
|
|
58 |
borrowernumber => $patron->borrowernumber, |
55 |
verification_token => '1234567890', |
59 |
verification_token => '1234567890', |
56 |
changed_fields => 'surname,firstname', |
60 |
changed_fields => 'surname,firstname', |
57 |
surname => 'Hall', |
61 |
surname => 'Hall', |
Lines 443-451
subtest 'dateofbirth tests' => sub {
Link Here
|
443 |
{ class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01', surname => 'a_surname' } } ); |
447 |
{ class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01', surname => 'a_surname' } } ); |
444 |
my $patron_modification = Koha::Patron::Modification->new( |
448 |
my $patron_modification = Koha::Patron::Modification->new( |
445 |
{ |
449 |
{ |
446 |
changed_fields => 'borrowernumber,dateofbirth', |
450 |
verification_token => '1234567890', |
447 |
borrowernumber => $patron->borrowernumber, |
451 |
changed_fields => 'borrowernumber,dateofbirth', |
448 |
dateofbirth => undef |
452 |
borrowernumber => $patron->borrowernumber, |
|
|
453 |
dateofbirth => undef |
449 |
} |
454 |
} |
450 |
)->store; |
455 |
)->store; |
451 |
$patron_modification->approve; |
456 |
$patron_modification->approve; |
Lines 459-467
subtest 'dateofbirth tests' => sub {
Link Here
|
459 |
# Adding a dateofbirth |
464 |
# Adding a dateofbirth |
460 |
$patron_modification = Koha::Patron::Modification->new( |
465 |
$patron_modification = Koha::Patron::Modification->new( |
461 |
{ |
466 |
{ |
462 |
changed_fields => 'borrowernumber,dateofbirth', |
467 |
verification_token => '1234567890', |
463 |
borrowernumber => $patron->borrowernumber, |
468 |
changed_fields => 'borrowernumber,dateofbirth', |
464 |
dateofbirth => '1980-02-02' |
469 |
borrowernumber => $patron->borrowernumber, |
|
|
470 |
dateofbirth => '1980-02-02' |
465 |
} |
471 |
} |
466 |
)->store; |
472 |
)->store; |
467 |
$patron_modification->approve; |
473 |
$patron_modification->approve; |
Lines 476-485
subtest 'dateofbirth tests' => sub {
Link Here
|
476 |
# Modifying a dateofbirth |
482 |
# Modifying a dateofbirth |
477 |
$patron_modification = Koha::Patron::Modification->new( |
483 |
$patron_modification = Koha::Patron::Modification->new( |
478 |
{ |
484 |
{ |
479 |
changed_fields => 'borrowernumber,dateofbirth', |
485 |
verification_token => '1234567890', |
480 |
borrowernumber => $patron->borrowernumber, |
486 |
changed_fields => 'borrowernumber,dateofbirth', |
481 |
dateofbirth => '1980-03-03', |
487 |
borrowernumber => $patron->borrowernumber, |
482 |
surname => undef |
488 |
dateofbirth => '1980-03-03', |
|
|
489 |
surname => undef |
483 |
} |
490 |
} |
484 |
)->store; |
491 |
)->store; |
485 |
$patron_modification->approve; |
492 |
$patron_modification->approve; |
Lines 494-503
subtest 'dateofbirth tests' => sub {
Link Here
|
494 |
# Modifying something else |
501 |
# Modifying something else |
495 |
$patron_modification = Koha::Patron::Modification->new( |
502 |
$patron_modification = Koha::Patron::Modification->new( |
496 |
{ |
503 |
{ |
497 |
changed_fields => 'borrowernumber,surname', |
504 |
verification_token => '1234567890', |
498 |
borrowernumber => $patron->borrowernumber, |
505 |
changed_fields => 'borrowernumber,surname', |
499 |
surname => 'another_surname', |
506 |
borrowernumber => $patron->borrowernumber, |
500 |
dateofbirth => undef |
507 |
surname => 'another_surname', |
|
|
508 |
dateofbirth => undef |
501 |
} |
509 |
} |
502 |
)->store; |
510 |
)->store; |
503 |
$patron_modification->approve; |
511 |
$patron_modification->approve; |
504 |
- |
|
|