Bugzilla – Attachment 90796 Details for
Bug 23151
Patron self modification sends null dateofbirth
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23151: Add tests
Bug-23151-Add-tests.patch (text/plain), 2.88 KB, created by
Mark Tompsett
on 2019-06-19 14:54:33 UTC
(
hide
)
Description:
Bug 23151: Add tests
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-06-19 14:54:33 UTC
Size:
2.88 KB
patch
obsolete
>From 34c0ed40a673208b005755099b41c21cdc1ddf66 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 18 Jun 2019 22:54:27 -0500 >Subject: [PATCH] Bug 23151: Add tests > >--- > t/db_dependent/Koha/Patron/Modifications.t | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron/Modifications.t b/t/db_dependent/Koha/Patron/Modifications.t >index 377613b305..9bdf28973f 100755 >--- a/t/db_dependent/Koha/Patron/Modifications.t >+++ b/t/db_dependent/Koha/Patron/Modifications.t >@@ -374,12 +374,12 @@ subtest 'pending_count() and pending() tests' => sub { > }; > > subtest 'dateofbirth tests' => sub { >- plan tests => 3; >+ plan tests => 7; > > $schema->storage->txn_begin; > > # Cleaning the field >- my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01' } } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { dateofbirth => '1980-01-01', surname => 'a_surname' } } ); > my $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => undef } > )->store; > $patron_modification->approve; >@@ -397,17 +397,31 @@ subtest 'dateofbirth tests' => sub { > > $patron->discard_changes; > is( $patron->dateofbirth, '1980-02-02', 'dateofbirth must a been set' ); >+ is( $patron->surname, 'a_surname', 'surname must not be updated' ); > > # FIXME ->approve must have been removed it, but it did not. There may be an hidden bug here. > Koha::Patron::Modifications->search({ borrowernumber => $patron->borrowernumber })->delete; > > # Modifying a dateofbirth >- $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-03-03' } >+ $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, dateofbirth => '1980-03-03', surname => undef } > )->store; > $patron_modification->approve; > > $patron->discard_changes; > is( $patron->dateofbirth, '1980-03-03', 'dateofbirth must a been updated' ); >+ is( $patron->surname, 'a_surname', 'surname must not be updated' ); >+ >+ # FIXME ->approve must have been removed it, but it did not. There may be an hidden bug here. >+ Koha::Patron::Modifications->search({ borrowernumber => $patron->borrowernumber })->delete; >+ >+ # Modifying something else >+ $patron_modification = Koha::Patron::Modification->new( { borrowernumber => $patron->borrowernumber, surname => 'another_surname', dateofbirth => undef } >+ )->store; >+ $patron_modification->approve; >+ >+ $patron->discard_changes; >+ is( $patron->surname, 'another_surname', 'surname must be updated' ); >+ is( $patron->dateofbirth, '1980-03-03', 'dateofbirth should not have been updated if not needed' ); > > $schema->storage->txn_rollback; > }; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23151
:
90764
|
90769
|
90795
|
90796
|
90797
|
90798
|
90799
|
90805
|
90806
|
90807
|
90808
|
90809
|
91070
|
91071
|
91072
|
91073
|
91074
|
91075
|
91076
|
91614
|
91615
|
91616
|
91617
|
91618
|
91619
|
91620