Bugzilla – Attachment 119378 Details for
Bug 28031
Koha::Patron::Attribute->_check_repeatable doesn't exclude the object's ID
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28031: test remove type from parameter
Bug-28031-test-remove-type-from-parameter.patch (text/plain), 3.96 KB, created by
Jonathan Druart
on 2021-04-09 13:11:55 UTC
(
hide
)
Description:
Bug 28031: test remove type from parameter
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-04-09 13:11:55 UTC
Size:
3.96 KB
patch
obsolete
>From 841d9d991c50bcd3dc614f969a1895ba047cc829 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Apr 2021 15:11:39 +0200 >Subject: [PATCH] Bug 28031: test remove type from parameter > >--- > Koha/Patron/Attribute.pm | 22 ++++++--------- > t/db_dependent/Koha/Patron/Attribute.t | 37 +------------------------- > 2 files changed, 9 insertions(+), 50 deletions(-) > >diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm >index 3a5caa84eab..d5592638faa 100644 >--- a/Koha/Patron/Attribute.pm >+++ b/Koha/Patron/Attribute.pm >@@ -60,10 +60,10 @@ sub store { > unless $type; > > Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self ) >- unless $self->repeatable_ok($type); >+ unless $self->repeatable_ok(); > > Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw( attribute => $self ) >- unless $self->unique_ok($type); >+ unless $self->unique_ok(); > > return $self->SUPER::store(); > } >@@ -146,7 +146,7 @@ sub to_api_mapping { > > =head3 repeatable_ok > >- if ( $attr->repeatable_ok( $type ) ) { ... } >+ if ( $attr->repeatable_ok() ) { ... } > > Checks if the attribute type is repeatable and returns a boolean representing > whether storing the current object state would break the repeatable constraint. >@@ -155,13 +155,10 @@ whether storing the current object state would break the repeatable constraint. > > sub repeatable_ok { > >- my ( $self, $type ) = @_; >- >- Koha::Exceptions::MissingParameter->throw( "The type parameter is mandatory" ) >- unless $type; >+ my ( $self ) = @_; > > my $ok = 1; >- if ( !$type->repeatable ) { >+ if ( !$self->type->repeatable ) { > my $params = { > borrowernumber => $self->borrowernumber, > code => $self->code >@@ -178,7 +175,7 @@ sub repeatable_ok { > > =head3 unique_ok > >- if ( $attr->unique_ok( $type ) ) { ... } >+ if ( $attr->unique_ok() ) { ... } > > Checks if the attribute type is marked as unique and returns a boolean representing > whether storing the current object state would break the unique constraint. >@@ -187,13 +184,10 @@ whether storing the current object state would break the unique constraint. > > sub unique_ok { > >- my ( $self, $type ) = @_; >- >- Koha::Exceptions::MissingParameter->throw( "The type parameter is mandatory" ) >- unless $type; >+ my ( $self ) = @_; > > my $ok = 1; >- if ( $type->unique_id ) { >+ if ( $self->type->unique_id ) { > my $params = { code => $self->code, attribute => $self->attribute }; > > $params->{borrowernumber} = { '!=' => $self->borrowernumber } if $self->borrowernumber; >diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t >index a05809c4e14..6faa232a13c 100755 >--- a/t/db_dependent/Koha/Patron/Attribute.t >+++ b/t/db_dependent/Koha/Patron/Attribute.t >@@ -19,13 +19,12 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 2; > > use t::lib::TestBuilder; > use Test::Exception; > > use Koha::Database; >-use Koha::Patron::Attribute; > use Koha::Patron::Attributes; > > my $schema = Koha::Database->new->schema; >@@ -288,37 +287,3 @@ subtest 'type() tests' => sub { > > $schema->storage->txn_rollback; > }; >- >-subtest 'repeatable_ok() tests' => sub { >- >- plan tests => 1; >- >- my $attr = Koha::Patron::Attribute->new( >- { >- attribute => 'something', >- code => 'some code' >- } >- ); >- >- throws_ok >- { $attr->repeatable_ok(); } >- 'Koha::Exceptions::MissingParameter', >- 'Exception on missing type attribute'; >-}; >- >-subtest 'unique_ok() tests' => sub { >- >- plan tests => 1; >- >- my $attr = Koha::Patron::Attribute->new( >- { >- attribute => 'something', >- code => 'some code' >- } >- ); >- >- throws_ok >- { $attr->unique_ok(); } >- 'Koha::Exceptions::MissingParameter', >- 'Exception on missing type attribute'; >-}; >-- >2.20.1
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 28031
:
118792
|
118793
|
118794
|
118828
|
118829
|
118830
|
118831
|
118833
|
118859
|
118860
|
118861
|
118862
|
118863
|
119377
|
119378
|
119379
|
119380
|
119382