Bugzilla – Attachment 165863 Details for
Bug 32610
Add ability to specify patron attribute as a date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32610: (QA follow-up) Fix unit tests
Bug-32610-QA-follow-up-Fix-unit-tests.patch (text/plain), 6.57 KB, created by
Martin Renvoize (ashimema)
on 2024-04-30 11:56:23 UTC
(
hide
)
Description:
Bug 32610: (QA follow-up) Fix unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-30 11:56:23 UTC
Size:
6.57 KB
patch
obsolete
>From cf8036e62d630d50bec21ecc7dcc5f07a8ab137d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 30 Apr 2024 12:40:14 +0100 >Subject: [PATCH] Bug 32610: (QA follow-up) Fix unit tests > >With the introduction of data type checking based on the is_date flag we >need to update the tests to ensure we're setting the attribute types >consistently to not date when we're testing for other flags. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Patron/Attribute.t | 71 ++++++++++++++++---------- > 1 file changed, 45 insertions(+), 26 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t >index 3caccd0b960..f68692e57b8 100755 >--- a/t/db_dependent/Koha/Patron/Attribute.t >+++ b/t/db_dependent/Koha/Patron/Attribute.t >@@ -43,8 +43,9 @@ subtest 'store() tests' => sub { > > my $patron = $builder->build( { source => 'Borrower' } )->{borrowernumber}; > my $attribute_type_1 = $builder->build( >- { source => 'BorrowerAttributeType', >- value => { repeatable => 1 } >+ { >+ source => 'BorrowerAttributeType', >+ value => { repeatable => 1, is_date => 0 } > } > ); > Koha::Patron::Attribute->new( >@@ -67,8 +68,9 @@ subtest 'store() tests' => sub { > '2 repeatable attributes stored and retrieved correcctly' ); > > my $attribute_type_2 = $builder->build( >- { source => 'BorrowerAttributeType', >- value => { repeatable => 0 } >+ { >+ source => 'BorrowerAttributeType', >+ value => { repeatable => 0, is_date => 0 } > } > ); > >@@ -107,20 +109,22 @@ subtest 'store() tests' => sub { > }; > > subtest 'is_date attributes tests' => sub { >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > >- my $patron = $builder->build( { source => 'Borrower' } )->{borrowernumber}; >+ my $patron = $builder->build( { source => 'Borrower' } )->{borrowernumber}; > my $attribute_type_1 = $builder->build( >- { source => 'BorrowerAttributeType', >+ { >+ source => 'BorrowerAttributeType', > value => { is_date => 1 } > } > ); > > throws_ok { > Koha::Patron::Attribute->new( >- { borrowernumber => $patron, >+ { >+ borrowernumber => $patron, > code => $attribute_type_1->{code}, > attribute => 'not_a_date' > } >@@ -131,25 +135,24 @@ subtest 'store() tests' => sub { > > is( > "$@", >- "Tried to use an invalid value for attribute type. type=" >- . $attribute_type_1->{code} >- . " value=not_a_date", >+ "Tried to use an invalid value for attribute type. type=" . $attribute_type_1->{code} . " value=not_a_date", > 'Exception stringified correctly, attribute passed correctly' > ); > > Koha::Patron::Attribute->new( >- { borrowernumber => $patron, >+ { >+ borrowernumber => $patron, > code => $attribute_type_1->{code}, > attribute => '2024-03-04' > } > )->store; > >- my $attr_count >- = Koha::Patron::Attributes->search( >- { borrowernumber => $patron, code => $attribute_type_1->{code} } ) >- ->count; >- is( $attr_count, 1, >- '1 date attribute stored and retrieved correctly' ); >+ my $attr_count = >+ Koha::Patron::Attributes->search( { borrowernumber => $patron, code => $attribute_type_1->{code} } )->count; >+ is( >+ $attr_count, 1, >+ '1 date attribute stored and retrieved correctly' >+ ); > > $schema->storage->txn_rollback; > }; >@@ -164,8 +167,9 @@ subtest 'store() tests' => sub { > my $patron_2 = $builder->build( { source => 'Borrower' } )->{borrowernumber}; > > my $attribute_type_1 = $builder->build( >- { source => 'BorrowerAttributeType', >- value => { unique_id => 0 } >+ { >+ source => 'BorrowerAttributeType', >+ value => { unique_id => 0, is_date => 0 } > } > ); > Koha::Patron::Attribute->new( >@@ -188,8 +192,9 @@ subtest 'store() tests' => sub { > '2 non-unique attributes stored and retrieved correcctly' ); > > my $attribute_type_2 = $builder->build( >- { source => 'BorrowerAttributeType', >- value => { unique_id => 1 } >+ { >+ source => 'BorrowerAttributeType', >+ value => { unique_id => 1, is_date => 0 } > } > ); > >@@ -239,7 +244,8 @@ subtest 'store() tests' => sub { > class => 'Koha::Patron::Attribute::Types', > value => { > unique_id => 0, >- repeatable => 0 >+ repeatable => 0, >+ is_date => 0 > } > } > ); >@@ -278,6 +284,7 @@ subtest 'store() tests' => sub { > mandatory => 0, > repeatable => 0, > unique_id => 1, >+ is_date => 0, > category_code => undef > } > } >@@ -352,19 +359,31 @@ subtest 'merge_and_replace_with' => sub { > my $unique_attribute_type = $builder->build_object( > { > class => 'Koha::Patron::Attribute::Types', >- value => { unique_id=> 1, repeatable => 0 } >+ value => { >+ unique_id => 1, >+ repeatable => 0, >+ is_date => 0 >+ } > } > ); > my $repeatable_attribute_type = $builder->build_object( > { > class => 'Koha::Patron::Attribute::Types', >- value => { unique_id => 0, repeatable => 1 } >+ value => { >+ unique_id => 0, >+ repeatable => 1, >+ is_date => 0 >+ } > } > ); > my $normal_attribute_type = $builder->build_object( > { > class => 'Koha::Patron::Attribute::Types', >- value => { unique_id => 0, repeatable => 0 } >+ value => { >+ unique_id => 0, >+ repeatable => 0, >+ is_date => 0 >+ } > } > ); > my $non_existent_attribute_type = $builder->build_object( >-- >2.44.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 32610
:
148400
|
148401
|
148402
|
148403
|
148404
|
148405
|
148825
|
148826
|
148827
|
148828
|
148829
|
148830
|
157862
|
157863
|
157864
|
157865
|
157866
|
157867
|
157868
|
158994
|
158995
|
158996
|
158997
|
158998
|
158999
|
159000
|
165747
|
165750
|
165854
|
165855
|
165856
|
165857
|
165858
|
165859
|
165860
|
165861
|
165862
| 165863 |
165864
|
165865
|
165925
|
165926