Bugzilla – Attachment 192028 Details for
Bug 41076
Perltidy config needs to be refined to not cause changes with perltidy 20250105
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41076: Adjust our perl tidiness for v20250105
bca9fa1.patch (text/plain), 525.14 KB, created by
Martin Renvoize (ashimema)
on 2026-01-26 13:51:26 UTC
(
hide
)
Description:
Bug 41076: Adjust our perl tidiness for v20250105
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-01-26 13:51:26 UTC
Size:
525.14 KB
patch
obsolete
>From bca9fa18af2ddaa11d7ecae503689b234bd405d0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 23 Jan 2026 09:57:03 +0100 >Subject: [PATCH] Bug 41076: Adjust our perl tidiness for v20250105 > >Generated using > `perl misc/devel/tidy.pl --perl` > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > C4/Auth.pm | 2 +- > C4/Biblio.pm | 2 +- > C4/Circulation.pm | 2 +- > C4/InstallAuth.pm | 2 +- > C4/Letters.pm | 6 +- > Koha/Item.pm | 11 +- > Koha/List/Patron.pm | 7 +- > Koha/Object/Limit/Library.pm | 6 +- > Koha/Patron.pm | 2 +- > Koha/Patrons/Import.pm | 2 +- > Koha/Plugins.pm | 4 +- > Koha/Policy/Patrons/Cardnumber.pm | 2 +- > Koha/REST/V1/Suggestions.pm | 6 +- > Koha/Schema/Loader/mysql.pm | 2 +- > Koha/Subscription.pm | 4 +- > Koha/Suggestion.pm | 2 +- > Koha/Uploader.pm | 2 +- > Makefile.PL | 28 +-- > acqui/basketheader.pl | 8 +- > admin/preferences.pl | 4 +- > ill/ill-requests.pl | 4 +- > installer/data/mysql/db_revs/221200010.pl | 2 +- > ...fix_unclosed_nonaccruing_fines_bug17135.pl | 2 +- > installer/data/mysql/updatedatabase.pl | 4 +- > installer/install.pl | 2 +- > members/maninvoice.pl | 2 +- > members/memberentry.pl | 5 +- > members/notices.pl | 4 +- > misc/cronjobs/cart_to_shelf.pl | 2 +- > misc/cronjobs/fines.pl | 2 +- > misc/cronjobs/harvest_oai.pl | 2 +- > misc/cronjobs/process_message_queue.pl | 2 +- > misc/cronjobs/purge_suggestions.pl | 2 +- > misc/cronjobs/staticfines.pl | 2 +- > misc/migration_tools/import_lexile.pl | 2 +- > misc/migration_tools/koha-svc.pl | 2 +- > misc/translator/TmplTokenizer.pm | 4 +- > opac/opac-memberentry.pl | 2 +- > opac/opac-registration-verify.pl | 2 +- > reserve/request.pl | 3 +- > t/00-valid-xml.t | 2 +- > t/Edifact.t | 2 +- > t/Koha/REST/Plugin/Query.t | 58 ++++-- > t/Test/Dates.t | 4 +- > t/db_dependent/Auth.t | 8 +- > t/db_dependent/Auth_with_shibboleth.t | 26 ++- > t/db_dependent/Circulation.t | 20 +- > .../Circulation/maxsuspensiondays.t | 2 +- > t/db_dependent/Filter_MARC_ViewPolicy.t | 2 +- > t/db_dependent/Hold.t | 12 +- > .../HoldsQueue/TransportCostOptimizations.t | 28 +-- > t/db_dependent/Koha/Account.t | 30 +-- > t/db_dependent/Koha/Account/Line.t | 2 +- > t/db_dependent/Koha/Account/Lines.t | 6 +- > t/db_dependent/Koha/Acquisition/Orders.t | 8 +- > t/db_dependent/Koha/AdditionalContents.t | 4 +- > t/db_dependent/Koha/Charges/Sales.t | 2 +- > t/db_dependent/Koha/Checkouts.t | 6 +- > t/db_dependent/Koha/Holds.t | 10 +- > t/db_dependent/Koha/ILL/Request/Config.t | 2 +- > t/db_dependent/Koha/ILL/Requests.t | 2 +- > t/db_dependent/Koha/Item.t | 2 +- > t/db_dependent/Koha/Objects.t | 2 +- > t/db_dependent/Koha/Patrons.t | 31 +-- > t/db_dependent/Koha/Plugins/Plugins.t | 20 +- > t/db_dependent/Koha/REST/Plugin/Auth/IdP.t | 15 +- > .../Koha/REST/Plugin/Auth/PublicRoutes.t | 21 +- > t/db_dependent/Koha/REST/Plugin/Objects.t | 170 ++++++++++++---- > t/db_dependent/Koha/REST/Plugin/Pagination.t | 34 ++-- > t/db_dependent/Koha/UI/Form/Builder/Item.t | 2 +- > t/db_dependent/Patrons.t | 9 +- > .../Reserves/CancelExpiredReserves.t | 2 +- > t/db_dependent/SocialData.t | 3 +- > t/db_dependent/TestBuilder.t | 3 +- > t/db_dependent/api/v1/acquisitions_baskets.t | 11 +- > t/db_dependent/api/v1/acquisitions_funds.t | 3 +- > t/db_dependent/api/v1/acquisitions_orders.t | 39 ++-- > .../api/v1/acquisitions_vendor_issues.t | 6 +- > t/db_dependent/api/v1/acquisitions_vendors.t | 138 +++++++++---- > t/db_dependent/api/v1/additional_contents.t | 9 +- > .../api/v1/advanced_editor_macros.t | 48 +++-- > t/db_dependent/api/v1/article_requests.t | 21 +- > t/db_dependent/api/v1/auth.t | 3 +- > .../api/v1/auth_authenticate_api_request.t | 13 +- > t/db_dependent/api/v1/auth_basic.t | 15 +- > t/db_dependent/api/v1/authorised_values.t | 15 +- > t/db_dependent/api/v1/authorities.t | 24 ++- > t/db_dependent/api/v1/biblios.t | 140 ++++++++----- > t/db_dependent/api/v1/bookings.t | 39 ++-- > t/db_dependent/api/v1/cash_registers.t | 3 +- > t/db_dependent/api/v1/cashups.t | 15 +- > t/db_dependent/api/v1/checkouts.t | 186 ++++++++++++------ > t/db_dependent/api/v1/circulation_rules.t | 33 ++-- > t/db_dependent/api/v1/cities.t | 31 ++- > t/db_dependent/api/v1/clubs_holds.t | 30 ++- > t/db_dependent/api/v1/deleted_biblios.t | 16 +- > t/db_dependent/api/v1/edifact_files.t | 6 +- > t/db_dependent/api/v1/erm_agreements.t | 58 ++++-- > t/db_dependent/api/v1/erm_counter_files.t | 18 +- > t/db_dependent/api/v1/erm_counter_logs.t | 9 +- > t/db_dependent/api/v1/erm_custom_reports.t | 42 ++-- > t/db_dependent/api/v1/erm_documents.t | 9 +- > .../api/v1/erm_eholdings_packages.t | 49 +++-- > .../api/v1/erm_eholdings_resources.t | 15 +- > t/db_dependent/api/v1/erm_eholdings_titles.t | 69 ++++--- > t/db_dependent/api/v1/erm_licenses.t | 46 +++-- > .../api/v1/erm_usage_data_providers.t | 36 ++-- > t/db_dependent/api/v1/erm_usage_titles.t | 12 +- > t/db_dependent/api/v1/erm_users.t | 12 +- > .../api/v1/extended_attribute_types.t | 21 +- > t/db_dependent/api/v1/file_transports.t | 30 ++- > t/db_dependent/api/v1/holds.t | 165 ++++++++++------ > t/db_dependent/api/v1/ill_backends.t | 6 +- > t/db_dependent/api/v1/ill_batches.t | 74 ++++--- > t/db_dependent/api/v1/ill_batchstatuses.t | 43 ++-- > t/db_dependent/api/v1/ill_requests.t | 36 ++-- > t/db_dependent/api/v1/import_batch_profiles.t | 18 +- > t/db_dependent/api/v1/import_record_matches.t | 3 +- > t/db_dependent/api/v1/item_groups.t | 9 +- > t/db_dependent/api/v1/item_types.t | 14 +- > t/db_dependent/api/v1/items.t | 70 ++++--- > t/db_dependent/api/v1/items/bundled_items.t | 6 +- > t/db_dependent/api/v1/jobs.t | 16 +- > t/db_dependent/api/v1/libraries.t | 65 ++++-- > t/db_dependent/api/v1/oauth.t | 42 ++-- > t/db_dependent/api/v1/pagination.t | 93 +++++---- > t/db_dependent/api/v1/password_validation.t | 30 ++- > t/db_dependent/api/v1/patron_categories.t | 15 +- > t/db_dependent/api/v1/patrons.t | 174 ++++++++++------ > t/db_dependent/api/v1/patrons_accounts.t | 80 +++++--- > t/db_dependent/api/v1/patrons_checkouts.t | 12 +- > .../api/v1/patrons_extended_attributes.t | 48 +++-- > t/db_dependent/api/v1/patrons_hold_groups.t | 18 +- > t/db_dependent/api/v1/patrons_holds.t | 24 ++- > t/db_dependent/api/v1/patrons_password.t | 21 +- > .../api/v1/patrons_password_expiration.t | 6 +- > t/db_dependent/api/v1/patrons_recalls.t | 15 +- > .../api/v1/preservation_Processings.t | 32 +-- > t/db_dependent/api/v1/preservation_Trains.t | 59 ++++-- > t/db_dependent/api/v1/public/lists.t | 3 +- > t/db_dependent/api/v1/query.t | 18 +- > t/db_dependent/api/v1/record_sources.t | 43 ++-- > t/db_dependent/api/v1/return_claims.t | 6 +- > t/db_dependent/api/v1/search_filters.t | 22 ++- > t/db_dependent/api/v1/sip2_accounts.t | 42 ++-- > t/db_dependent/api/v1/sip2_institutions.t | 46 +++-- > .../api/v1/sip2_system_preference_overrides.t | 39 ++-- > t/db_dependent/api/v1/smtp_servers.t | 40 ++-- > t/db_dependent/api/v1/stockrotation_rotas.t | 31 ++- > t/db_dependent/api/v1/stockrotationstage.t | 12 +- > t/db_dependent/api/v1/suggestions.t | 52 +++-- > t/db_dependent/api/v1/ticket_updates.t | 74 ++++--- > t/db_dependent/api/v1/tickets.t | 45 +++-- > t/db_dependent/api/v1/transfer_limits.t | 45 +++-- > t/db_dependent/mojo/csrf.t | 18 +- > t/db_dependent/mojo/rest-auth.t | 14 +- > t/db_dependent/selenium/regressions.t | 4 +- > t/lib/QA/TemplateFilters.pm | 4 +- > tags/review.pl | 2 +- > tools/stockrotation.pl | 4 +- > xt/find-license-problems.t | 2 +- > 161 files changed, 2477 insertions(+), 1259 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index ddea45206b7..b5308ae4a42 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1236,7 +1236,7 @@ sub checkauth { > : Koha::Cash::Registers->search( > { branch => $branchcode, branch_default => 1 }, > { rows => 1 } >- )->single; >+ )->single; > $register_id = $register->id if ($register); > $register_name = $register->name if ($register); > } >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index cdfde492d65..1f1f897e544 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1562,7 +1562,7 @@ sub GetAuthorisedValueDesc { > Koha::AuthorisedValues->search( > { category => $category }, > { columns => [ 'authorised_value', 'lib_opac', 'lib' ] } >- )->as_list >+ )->as_list > }; > $cache->set_in_cache( $cache_key, $av_descriptions ); > } >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 1e025cc56a7..1f0dfeaf943 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3307,7 +3307,7 @@ sub CanBookBeRenewed { > unless CanItemBeReserved( > $patron_with_reserve, $other_item, undef, > { ignore_hold_counts => 1 } >- )->{status} eq 'OK'; >+ )->{status} eq 'OK'; > > # NOTE: At checkin we call 'CheckReserves' which checks hold 'policy' > # CanItemBeReserved checks 'rules' and 'policies' which means >diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm >index 7e3271dd2e4..8c84b532cbe 100644 >--- a/C4/InstallAuth.pm >+++ b/C4/InstallAuth.pm >@@ -352,7 +352,7 @@ sub checkauth { > # else we have a problem... > # get the inputs from the incoming query > my @inputs = (); >- foreach my $name ( param $query) { >+ foreach my $name ( param $query ) { > (next) if ( $name eq 'userid' || $name eq 'password' ); > my $value = $query->param($name); > push @inputs, { name => $name, value => $value }; >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 26d866d7f04..e24338b0263 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -214,8 +214,8 @@ sub GetLettersAvailableForALibrary { > } > > return [ >- map { $letters{$_} } >- sort { $letters{$a}->{name} cmp $letters{$b}->{name} } >+ map { $letters{$_} } >+ sort { $letters{$a}->{name} cmp $letters{$b}->{name} } > keys %letters > ]; > >@@ -1211,7 +1211,7 @@ sub GetQueuedMessages { > my $params = shift; > > my $dbh = C4::Context->dbh(); >- my $statement = << 'ENDSQL'; >+ my $statement = <<'ENDSQL'; > SELECT message_id, borrowernumber, subject, content, message_transport_type, status, time_queued, updated_on, failure_code, from_address, to_address, cc_address > FROM message_queue > ENDSQL >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 52f1d1862a6..19b939cefa9 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -179,7 +179,7 @@ sub store { > > # If the field has changed otherwise, we much update > # the 'on' field >- elsif (exists $updated_columns{$field} >+ elsif ( exists $updated_columns{$field} > && $updated_columns{$field} > && !$pre_mod_item->$field ) > { >@@ -376,7 +376,7 @@ sub safe_to_delete { > { > itemnumber => undef, > } >- )->count; >+ )->count; > > if ($error) { > return Koha::Result::Boolean->new(0)->add_message( { message => $error } ); >@@ -1525,8 +1525,8 @@ sub columns_to_str { > $subfield > ? $subfield->{authorised_value} > ? C4::Biblio::GetAuthorisedValueDesc( >- $itemtagfield, >- $subfield->{tagsubfield}, $value, '', $tagslib >+ $itemtagfield, >+ $subfield->{tagsubfield}, $value, '', $tagslib > ) > : $value > : $value; >@@ -1750,7 +1750,8 @@ sub _set_found_trigger { > if ($lost_fee_payment) { > my $today = dt_from_string(); > my $payment_age_in_days = >- dt_from_string( $lost_fee_payment->created_on )->delta_days($today) >+ dt_from_string( $lost_fee_payment->created_on ) >+ ->delta_days($today) > ->in_units('days'); > if ( $payment_age_in_days > $no_refund_if_lost_fee_paid_age ) { > $self->add_message( >diff --git a/Koha/List/Patron.pm b/Koha/List/Patron.pm >index e658bd469c0..87134b349c8 100644 >--- a/Koha/List/Patron.pm >+++ b/Koha/List/Patron.pm >@@ -213,8 +213,11 @@ sub DelPatronsFromList { > > return unless ( $list && $patron_list_patrons ); > >- return Koha::Database->new()->schema()->resultset('PatronListPatron') >- ->search( { patron_list_patron_id => { 'IN' => $patron_list_patrons } } )->delete(); >+ return Koha::Database->new() >+ ->schema() >+ ->resultset('PatronListPatron') >+ ->search( { patron_list_patron_id => { 'IN' => $patron_list_patrons } } ) >+ ->delete(); > } > > =head1 AUTHOR >diff --git a/Koha/Object/Limit/Library.pm b/Koha/Object/Limit/Library.pm >index ad5e7a9801a..4e975b6af13 100644 >--- a/Koha/Object/Limit/Library.pm >+++ b/Koha/Object/Limit/Library.pm >@@ -78,8 +78,10 @@ It returns undef if no library limits defined. > sub get_library_limits { > my ($self) = @_; > >- my @branchcodes = $self->_library_limit_rs->search( { $self->_library_limits->{id} => $self->id } ) >- ->get_column( $self->_library_limits->{library} )->all(); >+ my @branchcodes = >+ $self->_library_limit_rs->search( { $self->_library_limits->{id} => $self->id } ) >+ ->get_column( $self->_library_limits->{library} ) >+ ->all(); > > return unless @branchcodes; > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index b174636cdd4..95a10bd8614 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1088,7 +1088,7 @@ sub set_password { > module => 'members', > letter_code => 'PASSWORD_CHANGE', > branchcode => $self_from_storage->branchcode, >- , >+ > lang => $self_from_storage->lang || 'default', > tables => { > 'branches' => $self_from_storage->branchcode, >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 9c043ef05c9..da17e7f1697 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -518,7 +518,7 @@ LINE: while ( my $borrowerline = <$handle> ) { > my $letter = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index ee5ddde144e..d75a650c17a 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -235,8 +235,8 @@ sub GetPlugins { > { > enable_plugins => $self->{'enable_plugins'} > >- # loads even if plugins are disabled >- # FIXME: is this for testing without bothering to mock config? >+ # loads even if plugins are disabled >+ # FIXME: is this for testing without bothering to mock config? > } > ); > } catch { >diff --git a/Koha/Policy/Patrons/Cardnumber.pm b/Koha/Policy/Patrons/Cardnumber.pm >index 24513795219..4e68f0e7f72 100644 >--- a/Koha/Policy/Patrons/Cardnumber.pm >+++ b/Koha/Policy/Patrons/Cardnumber.pm >@@ -60,7 +60,7 @@ sub is_valid { > cardnumber => $cardnumber, > ( $patron ? ( borrowernumber => { '!=' => $patron->borrowernumber } ) : () ) > } >- )->count; >+ )->count; > > my ( $min_length, $max_length ) = $class->get_valid_length(); > return Koha::Result::Boolean->new(0)->add_message( { message => "invalid_length" } ) >diff --git a/Koha/REST/V1/Suggestions.pm b/Koha/REST/V1/Suggestions.pm >index 449c8d61358..c1e3fd8e56d 100644 >--- a/Koha/REST/V1/Suggestions.pm >+++ b/Koha/REST/V1/Suggestions.pm >@@ -102,8 +102,10 @@ sub add { > > if ( $max_total and $days_range ) { > >- my $total = Koha::Suggestions->search( { suggestedby => $body->{suggested_by} } ) >- ->filter_by_suggested_days_range($days_range)->count; >+ my $total = >+ Koha::Suggestions->search( { suggestedby => $body->{suggested_by} } ) >+ ->filter_by_suggested_days_range($days_range) >+ ->count; > > if ( $total >= $max_total ) { > return $c->render( >diff --git a/Koha/Schema/Loader/mysql.pm b/Koha/Schema/Loader/mysql.pm >index 1ac6f75f5f1..4c36f2c93ef 100644 >--- a/Koha/Schema/Loader/mysql.pm >+++ b/Koha/Schema/Loader/mysql.pm >@@ -43,7 +43,7 @@ sub _extra_column_info { > $extra_info{extra}{list} = $dbi_info->{mysql_values}; > } > if ( >- ( not blessed $dbi_info) # isa $sth >+ ( not blessed $dbi_info ) # isa $sth > && lc( $dbi_info->{COLUMN_DEF} ) =~ m/^current_timestamp/ > && lc( $dbi_info->{mysql_type_name} ) eq 'timestamp' > ) >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index c5b5f39b164..6477470b5b4 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -74,7 +74,9 @@ sub subscribers { > my ($self) = @_; > my $schema = Koha::Database->new->schema; > my @borrowernumbers = >- $schema->resultset('Alert')->search( { externalid => $self->subscriptionid } )->get_column('borrowernumber') >+ $schema->resultset('Alert') >+ ->search( { externalid => $self->subscriptionid } ) >+ ->get_column('borrowernumber') > ->all; > return Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } } ); > } >diff --git a/Koha/Suggestion.pm b/Koha/Suggestion.pm >index 8c1481c57ac..fc31513cc23 100644 >--- a/Koha/Suggestion.pm >+++ b/Koha/Suggestion.pm >@@ -61,7 +61,7 @@ sub store { > category => 'SUGGEST_STATUS', > authorised_value => $self->STATUS > } >- )->count; >+ )->count; > > $self->branchcode(undef) if defined $self->branchcode && $self->branchcode eq ''; > unless ( $self->suggesteddate() ) { >diff --git a/Koha/Uploader.pm b/Koha/Uploader.pm >index b215b5992a7..2b96e64937b 100644 >--- a/Koha/Uploader.pm >+++ b/Koha/Uploader.pm >@@ -138,7 +138,7 @@ sub count { > > sub result { > my ($self) = @_; >- my @a = map { $self->{files}->{$_}->{id} } >+ my @a = map { $self->{files}->{$_}->{id} } > grep { !exists $self->{files}->{$_}->{errcode} } > keys %{ $self->{files} }; > return @a ? ( join ',', @a ) : undef; >diff --git a/Makefile.PL b/Makefile.PL >index bac08cbd7ba..6e849fe9911 100644 >--- a/Makefile.PL >+++ b/Makefile.PL >@@ -340,8 +340,8 @@ my $target_map = { > './members' => 'INTRANET_CGI_DIR', > './misc' => { target => 'SCRIPT_NONDEV_DIR', trimdir => -1 }, > './misc/bin' => { target => 'SCRIPT_DIR', trimdir => -1 }, >- './misc/release_notes' => { target => 'DOC_DIR', trimdir => 2 }, >- './misc/translator' => { target => 'MISC_DIR', trimdir => 2 }, >+ './misc/release_notes' => { target => 'DOC_DIR', trimdir => 2 }, >+ './misc/translator' => { target => 'MISC_DIR', trimdir => 2 }, > './misc/koha-install-log' => { target => 'MISC_DIR', trimdir => -1 }, > './misc/installer_devel_notes' => 'NONE', > './opac' => 'OPAC_CGI_DIR', >@@ -368,18 +368,18 @@ my $target_map = { > './skel/var/log/koha' => { target => 'LOG_DIR', trimdir => -1 }, > './skel/var/spool/koha' => { target => 'BACKUP_DIR', trimdir => -1 }, > './skel/var/run/koha/zebradb' => { target => 'ZEBRA_RUN_DIR', trimdir => -1 }, >- './skel/var/lock/koha/zebradb/authorities' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/authorities/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/authorities/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/authorities/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/authorities/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lock/koha/zebradb/biblios' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/biblios/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/biblios/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/biblios/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lib/koha/zebradb/biblios/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >- './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >- './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 }, >+ './skel/var/lock/koha/zebradb/authorities' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/authorities/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/authorities/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/authorities/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/authorities/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lock/koha/zebradb/biblios' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/biblios/key' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/biblios/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/biblios/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/zebradb/biblios/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 }, > './sms' => 'INTRANET_CGI_DIR', > './suggestion' => 'INTRANET_CGI_DIR', > './svc' => 'INTRANET_CGI_DIR', >diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl >index 5a1162d5b43..9809e6172f3 100755 >--- a/acqui/basketheader.pl >+++ b/acqui/basketheader.pl >@@ -178,9 +178,11 @@ if ( $op eq 'add_form' ) { > > # This basket was created from an EDI order/quote > # Check if the vendor EDI account is configured to use purchase order numbers >- my $schema = Koha::Database->new()->schema(); >- my $vendor_edi_account = $schema->resultset('VendorEdiAccount') >- ->search( { vendor_id => scalar $input->param('basketbooksellerid') } )->first; >+ my $schema = Koha::Database->new()->schema(); >+ my $vendor_edi_account = >+ $schema->resultset('VendorEdiAccount') >+ ->search( { vendor_id => scalar $input->param('basketbooksellerid') } ) >+ ->first; > > if ( $vendor_edi_account && $vendor_edi_account->po_is_basketname ) { > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index 27461786a7b..475f8fc3728 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -167,7 +167,7 @@ sub _get_chunk { > @values = split /,/, $value if defined($value); > $chunk->{'CHOICES'} = [ > sort { $a->{'text'} cmp $b->{'text'} } >- map { >+ map { > my $c = $_; > { > text => $options{'choices'}->{$c}, >@@ -190,7 +190,7 @@ sub _get_chunk { > $chunk->{type} = 'multiple'; > $chunk->{CHOICES} = [ > sort { $a->{'text'} cmp $b->{'text'} } >- map { >+ map { > my $option_value = $_; > { > text => $options{multiple}->{$option_value}, >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index d637503d755..d1b671fdc77 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -144,12 +144,12 @@ if ($backends_available) { > $op = 'historycheck'; > $template->param( $history_check->history_check_template_params($params) ) > >- # ILLCheckAvailability operation >+ # ILLCheckAvailability operation > } elsif ( $availability->show_availability($request) ) { > $op = 'availability'; > $template->param( $availability->availability_template_params($params) ) > >- # ILLModuleDisclaimerByType operation >+ # ILLModuleDisclaimerByType operation > } elsif ( $type_disclaimer->show_type_disclaimer($request) ) { > $op = 'typedisclaimer'; > $template->param( $type_disclaimer->type_disclaimer_template_params($params) ); >diff --git a/installer/data/mysql/db_revs/221200010.pl b/installer/data/mysql/db_revs/221200010.pl >index fea5faeeeed..e19d135ffdb 100755 >--- a/installer/data/mysql/db_revs/221200010.pl >+++ b/installer/data/mysql/db_revs/221200010.pl >@@ -86,7 +86,7 @@ return { > )[0] == 0 > ) > { # Check to make idempotent >- my $cc_template = <<~ 'END_TEMPLATE'; >+ my $cc_template = <<~'END_TEMPLATE'; > **Describe the concern** > A clear and concise description of what the concern is. > >diff --git a/installer/data/mysql/fix_unclosed_nonaccruing_fines_bug17135.pl b/installer/data/mysql/fix_unclosed_nonaccruing_fines_bug17135.pl >index 51928e3d89e..a9c3cc7c1be 100755 >--- a/installer/data/mysql/fix_unclosed_nonaccruing_fines_bug17135.pl >+++ b/installer/data/mysql/fix_unclosed_nonaccruing_fines_bug17135.pl >@@ -37,7 +37,7 @@ GetOptions( > 'p|print' => \$stdout_log > ); > >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > > Script for fixing unclosed (FU), non accruing fine records, which > may still need FU -> F correction post-Bug 15675. For details, >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index e3853a74325..fa0acc38c29 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -2136,7 +2136,7 @@ VALUES > ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo') > END_SQL > >- $dbh->do( <<'END_SQL'); >+ $dbh->do(<<'END_SQL'); > INSERT INTO `letter` > (module, code, name, title, content) > VALUES >@@ -3682,7 +3682,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > > $DBversion = '3.01.00.080'; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >- $dbh->do(<<BUDG_PERM ); >+ $dbh->do(<<BUDG_PERM); > INSERT INTO permissions (module_bit, code, description) VALUES > (11, 'vendors_manage', 'Manage vendors'), > (11, 'contracts_manage', 'Manage contracts'), >diff --git a/installer/install.pl b/installer/install.pl >index 1060f0462c0..d1d5f0c770c 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -415,7 +415,7 @@ if ( $step && $step == 1 ) { > my $cmd = C4::Context->config("intranetdir") > . "/installer/data/$info{dbms}/updatedatabase.pl >> $logfilepath 2>> $logfilepath_errors"; > >- system($cmd ); >+ system($cmd); > > my $fh; > open( $fh, "<:encoding(utf-8)", $logfilepath ) >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 1e898b728cb..a24172e6650 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -140,7 +140,7 @@ if ( $op eq 'cud-add' ) { > borrowernumber => $borrowernumber > }, > { order_by => { -desc => 'returndate' }, rows => 1 } >- )->next; >+ )->next; > $issue_id = $checkout ? $checkout->issue_id : undef; > } > } >diff --git a/members/memberentry.pl b/members/memberentry.pl >index ec02bec7d16..44b29184cb3 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -302,7 +302,8 @@ if ( ( $op eq 'cud-save' || $op eq 'cud-insert' ) && $guarantors_to_be_validated > # If $patron's categorycode is about to change, check guarantor requirements against > # the new category but keep the original $patron object intact > # (this clone()s the $patron) >- ( bless {%$patron}, ref $patron )->categorycode($categorycode) >+ ( bless {%$patron}, ref $patron ) >+ ->categorycode($categorycode) > ->can_be_guaranteed_by($guarantors_to_be_validated); > } > } else { >@@ -517,7 +518,7 @@ if ( ( !$nok ) and $nodouble and ( $op eq 'cud-insert' or $op eq 'cud-save' ) ) > my $letter = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >diff --git a/members/notices.pl b/members/notices.pl >index e3b55b8d311..f563bfc1cc3 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -76,7 +76,7 @@ if ( $op eq 'send_welcome' ) { > my $letter = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >@@ -99,7 +99,7 @@ if ( $op eq 'send_welcome' ) { > my $print = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >diff --git a/misc/cronjobs/cart_to_shelf.pl b/misc/cronjobs/cart_to_shelf.pl >index 196273669b0..cd2f18b68ec 100755 >--- a/misc/cronjobs/cart_to_shelf.pl >+++ b/misc/cronjobs/cart_to_shelf.pl >@@ -42,7 +42,7 @@ cronlogaction( { info => $command_line_options } ); > > GetOptions( 'h|hours=s' => \$hours, ); > >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > cart_to_shelf.pl: This cron script will set any item of the location CART ( Shelving Cart ) to it's original shelving location > after the given number of hours has passed. > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index e0671902811..4765eff3cdf 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -61,7 +61,7 @@ GetOptions( > 'm|maxdays:i' => \$maxdays, > 'i|verifyissue' => \$verify_issue, > ); >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > > This script calculates and charges overdue fines > to patron accounts. The Koha system preference 'finesMode' controls >diff --git a/misc/cronjobs/harvest_oai.pl b/misc/cronjobs/harvest_oai.pl >index d417241202c..14b65adcfb7 100755 >--- a/misc/cronjobs/harvest_oai.pl >+++ b/misc/cronjobs/harvest_oai.pl >@@ -41,7 +41,7 @@ GetOptions( > 'l|list' => \$list, > 'f|force' => \$force, > ); >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > > This script starts an OAI Harvest > >diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl >index 740a2db9913..fddf013c810 100755 >--- a/misc/cronjobs/process_message_queue.pl >+++ b/misc/cronjobs/process_message_queue.pl >@@ -52,7 +52,7 @@ GetOptions( > 'w|where:s' => \$where, > 'e|exit-on-plugin-failure' => \$exit_on_plugin_failure, > ); >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > > This script processes the message queue in the message_queue database > table. It sends out the messages in that queue and marks them >diff --git a/misc/cronjobs/purge_suggestions.pl b/misc/cronjobs/purge_suggestions.pl >index 14903bbcc54..34503f5f3b4 100755 >--- a/misc/cronjobs/purge_suggestions.pl >+++ b/misc/cronjobs/purge_suggestions.pl >@@ -38,7 +38,7 @@ GetOptions( > 'v|verbose' => \$verbose, > ); > >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > This script deletes old suggestions > Parameters: > -help|? This message >diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl >index 9b62638c107..966109b5978 100755 >--- a/misc/cronjobs/staticfines.pl >+++ b/misc/cronjobs/staticfines.pl >@@ -64,7 +64,7 @@ GetOptions( > 'u|use-borrower-library' => \$useborrowerlibrary, > 'b|borrower:i' => \$borrowernumberlimit > ); >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > > This script calculates and charges overdue fines to patron accounts. > >diff --git a/misc/migration_tools/import_lexile.pl b/misc/migration_tools/import_lexile.pl >index 5fcd73c8c87..5531cef16a6 100755 >--- a/misc/migration_tools/import_lexile.pl >+++ b/misc/migration_tools/import_lexile.pl >@@ -67,7 +67,7 @@ GetOptions( > 'source-value=s' => $subfield_source_value, > ); > >-my $usage = << 'ENDUSAGE'; >+my $usage = <<'ENDUSAGE'; > import_lexile.pl: Import lexile scores for records from csv. > > import_lexile.pl -f /path/to/LexileTitles.txt >diff --git a/misc/migration_tools/koha-svc.pl b/misc/migration_tools/koha-svc.pl >index e1e728f203f..52961005a27 100755 >--- a/misc/migration_tools/koha-svc.pl >+++ b/misc/migration_tools/koha-svc.pl >@@ -36,7 +36,7 @@ if ( $#ARGV >= 3 && !caller ) { # process command-line params only if not cal > if ( !$file ) { > my $marcxml = $svc->get($biblionumber); > my $file = "bib-$biblionumber.xml"; >- write_file $file , $marcxml; >+ write_file $file, $marcxml; > print "saved $file ", -s $file, " bytes\n"; > print $marcxml; > } else { >diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm >index 34be9a5c3c9..a7c0c8524be 100644 >--- a/misc/translator/TmplTokenizer.pm >+++ b/misc/translator/TmplTokenizer.pm >@@ -71,8 +71,8 @@ sub new { > filename => $filename, > _parser => $parser > >- # , handle => $handle >- # , readahead => [] >+ # , handle => $handle >+ # , readahead => [] > }, > __PACKAGE__; > } >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index ce530d4bb15..1daa2daf2c0 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -277,7 +277,7 @@ if ( $op eq 'cud-create' ) { > my $letter = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 76386e02939..d2a6fd45ae1 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -133,7 +133,7 @@ if ( $rego_found > my $letter = GetPreparedLetter( > module => 'members', > letter_code => 'WELCOME', >- branchcode => $patron->branchcode,, >+ branchcode => $patron->branchcode, > lang => $patron->lang || 'default', > tables => { > 'branches' => $patron->branchcode, >diff --git a/reserve/request.pl b/reserve/request.pl >index fbb94fbed3a..672482bc413 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -341,7 +341,8 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > if ( $patron && $multi_hold ) { > my @multi_pickup_locations = >- Koha::Biblios->search( { biblionumber => \@biblionumbers } )->pickup_locations( { patron => $patron } ) >+ Koha::Biblios->search( { biblionumber => \@biblionumbers } ) >+ ->pickup_locations( { patron => $patron } ) > ->as_list; > $template->param( multi_pickup_locations => \@multi_pickup_locations ); > } >diff --git a/t/00-valid-xml.t b/t/00-valid-xml.t >index 0fb4127d897..d8e70fa8fd0 100755 >--- a/t/00-valid-xml.t >+++ b/t/00-valid-xml.t >@@ -43,7 +43,7 @@ find( > } > }, > }, >- , >+ > File::Spec->curdir() > ); > >diff --git a/t/Edifact.t b/t/Edifact.t >index ee1358148ea..e09e8a261f0 100755 >--- a/t/Edifact.t >+++ b/t/Edifact.t >@@ -224,7 +224,7 @@ my $mock_line_data = { > sub_location_code => 'REFERENCE', # LSL field > branch => 'BRANCH2' > >- # sequence_code missing for this item >+ # sequence_code missing for this item > } > ] > }; >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 66426f1f4ea..e465ecca93a 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -391,30 +391,32 @@ subtest 'extract_reserved_params() tests' => sub { > > my $t = Test::Mojo->new; > >- $t->get_ok('/query?_page=2&_per_page=3&firstname=Manuel&surname=Cohen%20Arazi')->status_is(200) >+ $t->get_ok('/query?_page=2&_per_page=3&firstname=Manuel&surname=Cohen%20Arazi') >+ ->status_is(200) > ->json_is( '/filtered_params' => { firstname => 'Manuel', surname => 'Cohen Arazi' } ) > ->json_is( '/reserved_params' => { _page => 2, _per_page => 3 } ); > > $t->get_ok( > '/query_full/with/path?_match=exact&_order_by=blah&_page=2&_per_page=3&firstname=Manuel&surname=Cohen%20Arazi') >- ->status_is(200)->json_is( >+ ->status_is(200) >+ ->json_is( > '/filtered_params' => { > firstname => 'Manuel', > surname => 'Cohen Arazi' > } >- )->json_is( >+ )->json_is( > '/reserved_params' => { > _page => 2, > _per_page => 3, > _match => 'exact', > _order_by => 'blah' > } >- )->json_is( >+ )->json_is( > '/path_params' => { > id => 'with', > subid => 'path' > } >- ); >+ ); > > }; > >@@ -424,8 +426,11 @@ subtest 'dbic_merge_sorting() tests' => sub { > > my $t = Test::Mojo->new; > >- $t->get_ok('/dbic_merge_sorting')->status_is(200)->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >- ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( >+ $t->get_ok('/dbic_merge_sorting') >+ ->status_is(200) >+ ->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >+ ->json_is( '/b' => 'b', 'Existing values are kept (b)' ) >+ ->json_is( > '/order_by' => [ > 'uno', > { -desc => 'dos' }, >@@ -434,9 +439,11 @@ subtest 'dbic_merge_sorting() tests' => sub { > ] > ); > >- $t->get_ok('/dbic_merge_sorting_result_set')->status_is(200) >+ $t->get_ok('/dbic_merge_sorting_result_set') >+ ->status_is(200) > ->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >- ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( >+ ->json_is( '/b' => 'b', 'Existing values are kept (b)' ) >+ ->json_is( > '/order_by' => [ > 'city_name', > { -desc => 'city_zipcode' }, >@@ -445,12 +452,17 @@ subtest 'dbic_merge_sorting() tests' => sub { > ] > ); > >- $t->get_ok('/dbic_merge_sorting_date')->status_is(200)->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >+ $t->get_ok('/dbic_merge_sorting_date') >+ ->status_is(200) >+ ->json_is( '/a' => 'a', 'Existing values are kept (a)' ) > ->json_is( '/b' => 'b', 'Existing values are kept (b)' ) > ->json_is( '/order_by' => [ { -desc => 'reservedate' } ] ); > >- $t->get_ok('/dbic_merge_sorting_single')->status_is(200)->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >- ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( '/order_by' => [ { '-desc' => 'uno' } ] ); >+ $t->get_ok('/dbic_merge_sorting_single') >+ ->status_is(200) >+ ->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >+ ->json_is( '/b' => 'b', 'Existing values are kept (b)' ) >+ ->json_is( '/order_by' => [ { '-desc' => 'uno' } ] ); > }; > > subtest '/dbic_merge_prefetch' => sub { >@@ -458,7 +470,9 @@ subtest '/dbic_merge_prefetch' => sub { > > my $t = Test::Mojo->new; > >- $t->get_ok('/dbic_merge_prefetch')->status_is(200)->json_is( '/prefetch/0' => { 'biblio' => 'orders' } ) >+ $t->get_ok('/dbic_merge_prefetch') >+ ->status_is(200) >+ ->json_is( '/prefetch/0' => { 'biblio' => 'orders' } ) > ->json_is( '/prefetch/1' => 'item' ); > > $t->get_ok('/dbic_merge_prefetch_recursive')->status_is(200)->json_is( >@@ -519,23 +533,28 @@ subtest '_build_query_params_from_api' => sub { > my $t = Test::Mojo->new; > > # _match => contains >- $t->get_ok('/build_query?_match=contains&title=Ender&author=Orson')->status_is(200) >+ $t->get_ok('/build_query?_match=contains&title=Ender&author=Orson') >+ ->status_is(200) > ->json_is( '/query' => { author => { like => '%Orson%' }, title => { like => '%Ender%' } } ); > > # _match => starts_with >- $t->get_ok('/build_query?_match=starts_with&title=Ender&author=Orson')->status_is(200) >+ $t->get_ok('/build_query?_match=starts_with&title=Ender&author=Orson') >+ ->status_is(200) > ->json_is( '/query' => { author => { like => 'Orson%' }, title => { like => 'Ender%' } } ); > > # _match => ends_with >- $t->get_ok('/build_query?_match=ends_with&title=Ender&author=Orson')->status_is(200) >+ $t->get_ok('/build_query?_match=ends_with&title=Ender&author=Orson') >+ ->status_is(200) > ->json_is( '/query' => { author => { like => '%Orson' }, title => { like => '%Ender' } } ); > > # _match => exact >- $t->get_ok('/build_query?_match=exact&title=Ender&author=Orson')->status_is(200) >+ $t->get_ok('/build_query?_match=exact&title=Ender&author=Orson') >+ ->status_is(200) > ->json_is( '/query' => { author => 'Orson', title => 'Ender' } ); > > # _match => blah >- $t->get_ok('/build_query?_match=blah&title=Ender&author=Orson')->status_is(400) >+ $t->get_ok('/build_query?_match=blah&title=Ender&author=Orson') >+ ->status_is(400) > ->json_is( '/exception_msg' => 'Invalid value for _match param (blah)' ) > ->json_is( '/exception_type' => 'Koha::Exceptions::WrongParameter' ); > >@@ -580,7 +599,8 @@ subtest 'stash_embed() tests' => sub { > } > )->json_is( '/strings' => 1 ); > >- $t->get_ok( '/stash_embed_no_spec' => { 'x-koha-embed' => 'checkouts,checkouts.item,patron' } )->status_is(400) >+ $t->get_ok( '/stash_embed_no_spec' => { 'x-koha-embed' => 'checkouts,checkouts.item,patron' } ) >+ ->status_is(400) > ->json_is( '/error' => > qq{Exception 'Koha::Exceptions::BadParameter' thrown 'Embedding objects is not allowed on this endpoint.'\n} > ); >diff --git a/t/Test/Dates.t b/t/Test/Dates.t >index cf202847777..8cc6fe0972d 100755 >--- a/t/Test/Dates.t >+++ b/t/Test/Dates.t >@@ -10,10 +10,10 @@ my $dt_1 = dt_from_string($date_1); > my $dt_2 = dt_from_string($date_2); > > is( t::lib::Dates::compare( $dt_1, $dt_2 ), -1, '2017 is before 2018' ); >-is( t::lib::Dates::compare( $dt_2, $dt_1 ), 1, '2018 is after 2017' ); >+is( t::lib::Dates::compare( $dt_2, $dt_1 ), 1, '2018 is after 2017' ); > > is( t::lib::Dates::compare( $date_1, $date_2 ), -1, '2017 is before 2018 (strings comparison)' ); >-is( t::lib::Dates::compare( $date_2, $date_1 ), 1, '2018 is after 2017 (strings comparison)' ); >+is( t::lib::Dates::compare( $date_2, $date_1 ), 1, '2018 is after 2017 (strings comparison)' ); > > my $dt_3 = $dt_1->clone->subtract( seconds => 5 ); > is( >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index cd5f379d858..f52359afa95 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -1192,7 +1192,7 @@ subtest 'checkpw() return values tests' => sub { > $password_expired = 1; > @return = checkpw( $patron->userid, $password, undef, ); > >- is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( scalar @return, 2, "Two results on expired password scenario" ); > is( $return[0], -2, '-2 returned' ); > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); >@@ -1200,7 +1200,7 @@ subtest 'checkpw() return values tests' => sub { > t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); > @return = checkpw( $patron->userid, $password, undef, ); > >- is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( scalar @return, 2, "Two results on expired password scenario" ); > is( $return[0], -3, '-3 returned' ); > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); >@@ -1284,14 +1284,14 @@ subtest 'checkpw() return values tests' => sub { > $password_expired = 1; > @return = checkpw( $patron->userid, $password, $query, ); > >- is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( scalar @return, 2, "Two results on expired password scenario" ); > is( $return[0], -2, '-2 returned' ); > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); > > t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); > @return = checkpw( $patron->userid, $password, undef, ); >- is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( scalar @return, 2, "Two results on expired password scenario" ); > is( $return[0], -3, '-3 returned' ); > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); >diff --git a/t/db_dependent/Auth_with_shibboleth.t b/t/db_dependent/Auth_with_shibboleth.t >index 01a229d1929..8a101ac07e6 100755 >--- a/t/db_dependent/Auth_with_shibboleth.t >+++ b/t/db_dependent/Auth_with_shibboleth.t >@@ -168,7 +168,8 @@ subtest "get_login_shib tests" => sub { > > my $login = get_login_shib(); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > is( $login, "test1234", "good config, attribute value returned" ); > }; > >@@ -207,7 +208,8 @@ subtest "checkpw_shib tests" => sub { > is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); > > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > > # bad user > $shib_login = 'martin'; >@@ -217,7 +219,8 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, undef ); > is( $retpatron, undef ); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > > # duplicated matchpoint > change_config( { matchpoint => 'email', mapping => { email => { is => 'email' } } } ); >@@ -228,7 +231,8 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, undef ); > is( $retpatron, undef ); > $logger->debug_is( "koha borrower field to match: email", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: email", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: email", "shib match attribute debug info" ) >+ ->clear(); > > ( $retval, $retcard, $retuserid, $retpatron ) = checkpw_shib($shib_login); > is( $retval, 0 ); >@@ -236,10 +240,11 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, undef ); > is( $retpatron, undef ); > $logger->debug_is( "koha borrower field to match: email", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: email", "shib match attribute debug info" )->warn_is( >+ ->debug_is( "shibboleth attribute to match: email", "shib match attribute debug info" ) >+ ->warn_is( > 'There are several users with email of kid@clamp.io, matchpoints must be unique', > "duplicated matchpoint warned with debug" >- )->clear(); >+ )->clear(); > > # autocreate user (welcome) > change_config( { autocreate => 1, welcome => 1 } ); >@@ -261,7 +266,8 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, "test4321", "expected userid returned" ); > is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > > ok my $new_user = $schema->resultset('Borrower')->search( { 'userid' => 'test4321' }, { rows => 1 } ), > "new user found"; >@@ -280,7 +286,8 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, $shib_login, "expected userid returned" ); > is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > > ok my $sync_user = $schema->resultset('Borrower')->search( { 'userid' => 'test4321' }, { rows => 1 } ), > "sync user found"; >@@ -301,7 +308,8 @@ subtest "checkpw_shib tests" => sub { > is( $retuserid, "test1234", "expected userid returned" ); > is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) >- ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); >+ ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" ) >+ ->clear(); > > # bad user > $shib_login = "martin"; >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 540108a3c1d..eb220502de7 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1185,7 +1185,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1335,7 +1335,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1445,7 +1445,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > > # Patron is expired and BlockExpiredPatronOpacActions='' > # => auto renew is allowed >@@ -1497,7 +1497,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1618,7 +1618,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -2020,7 +2020,7 @@ subtest "GetUpcomingDueIssues" => sub { > my $a_borrower = Koha::Patrons->find($a_borrower_borrowernumber); > > my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); >- my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); >+ my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); > my $today = DateTime->today( time_zone => C4::Context->tz() ); > > my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); >@@ -3932,7 +3932,7 @@ subtest 'AddReturn | is_overdue' => sub { > is( $line->status, 'RETURNED', "Overdue fine is fixed" ); > $line = $lines->next; > is( $line->amount + 0, -2, "Original payment amount remains as 2" ); >- is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); >+ is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); > $line = $lines->next; > is( $line->amount + 0, -1, "Refund amount correctly set to 1" ); > is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" ); >@@ -4886,7 +4886,7 @@ subtest '_FixOverduesOnReturn' => sub { > my $credit = $offset->credit; > is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); > is( $credit->amount + 0, -99, "Credit amount is set correctly" ); >- is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); >+ is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); > > # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive > $accountline->set( >@@ -7637,7 +7637,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > { > borrowernumber => $patron->id, > date => '1970-01-01 14:00:01', >- amountoutstanding => 0, >+ amountoutstanding => 0, > amount => -5, > interface => 'commandline', > credit_type_code => 'PAYMENT' >@@ -7693,7 +7693,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > borrowernumber => $patron2->id, > date => '1970-01-01 14:00:01', > amount => -5, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > credit_type_code => 'PAYMENT' > } >diff --git a/t/db_dependent/Circulation/maxsuspensiondays.t b/t/db_dependent/Circulation/maxsuspensiondays.t >index 1da7c873572..0bee50f8adf 100755 >--- a/t/db_dependent/Circulation/maxsuspensiondays.t >+++ b/t/db_dependent/Circulation/maxsuspensiondays.t >@@ -76,7 +76,7 @@ $dbh->do('DELETE FROM special_holidays'); > $dbh->do('DELETE FROM repeatable_holidays'); > > my $daysago20 = dt_from_string->add_duration( DateTime::Duration->new( days => -20 ) ); >-my $daysafter40 = dt_from_string->add_duration( DateTime::Duration->new( days => 40 ) ); >+my $daysafter40 = dt_from_string->add_duration( DateTime::Duration->new( days => 40 ) ); > > AddIssue( $patron, $barcode, $daysago20 ); > AddReturn( $barcode, $branchcode ); >diff --git a/t/db_dependent/Filter_MARC_ViewPolicy.t b/t/db_dependent/Filter_MARC_ViewPolicy.t >index 35281692e78..12626b50e11 100755 >--- a/t/db_dependent/Filter_MARC_ViewPolicy.t >+++ b/t/db_dependent/Filter_MARC_ViewPolicy.t >@@ -53,7 +53,7 @@ sub run_hiding_tests { > my @valid_hidden_values = ( -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8 ); > > my $hidden = { >- 'opac' => [ -8, 1, 2, 3, 4, 5, 6, 7, 8 ], >+ 'opac' => [ -8, 1, 2, 3, 4, 5, 6, 7, 8 ], > 'intranet' => [ -8, -7, -4, -3, -2, 2, 3, 5, 8 ] > }; > >diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t >index 61babaf78de..f7f831f7799 100755 >--- a/t/db_dependent/Hold.t >+++ b/t/db_dependent/Hold.t >@@ -358,7 +358,8 @@ subtest "delete() tests" => sub { > > my $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count; >+ ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } ) >+ ->count; > is( $number_of_logs, 0, 'With HoldsLogs, Koha::Hold->delete shouldn\'t have been logged' ); > > # Enable logging >@@ -379,7 +380,8 @@ subtest "delete() tests" => sub { > > $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count; >+ ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } ) >+ ->count; > is( $number_of_logs, 1, 'With HoldsLogs, Koha::Hold->delete should have been logged' ); > > $schema->storage->txn_rollback(); >@@ -471,7 +473,8 @@ subtest 'suspend() tests' => sub { > t::lib::Mocks::mock_preference( 'HoldsLog', 1 ); > > my $logs_count = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) > ->count; > > $hold = $builder->build_object( >@@ -483,7 +486,8 @@ subtest 'suspend() tests' => sub { > > $hold->suspend_hold; > my $new_logs_count = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) > ->count; > > is( $new_logs_count, $logs_count + 1, 'If logging is enabled, suspending a hold gets logged' ); >diff --git a/t/db_dependent/HoldsQueue/TransportCostOptimizations.t b/t/db_dependent/HoldsQueue/TransportCostOptimizations.t >index 933ab22e3fd..21e3b923f86 100755 >--- a/t/db_dependent/HoldsQueue/TransportCostOptimizations.t >+++ b/t/db_dependent/HoldsQueue/TransportCostOptimizations.t >@@ -273,8 +273,8 @@ test_allocation( > test_allocation( > "different costs 1", > [ >- [ 0, 2, 2 ], >- [ 1, 0, 1 ], >+ [ 0, 2, 2 ], >+ [ 1, 0, 1 ], > [ -1, -1, 0 ] > ], > [ 3, 3, 0 ], >@@ -286,8 +286,8 @@ test_allocation( > test_allocation( > "different costs 2", > [ >- [ 0, 2, 2 ], >- [ 1, 0, 1 ], >+ [ 0, 2, 2 ], >+ [ 1, 0, 1 ], > [ -1, -1, 0 ] > ], > [ 2, 2, 0 ], >@@ -299,8 +299,8 @@ test_allocation( > test_allocation( > "allocation prohibited", > [ >- [ 0, -1 ], >- [ -1, 0 ], >+ [ 0, -1 ], >+ [ -1, 0 ], > ], > [ 2, 0 ], > [ 0, 2 ], >@@ -311,9 +311,9 @@ test_allocation( > test_allocation( > "some allocation prohibited", > [ >- [ 0, -1, -1 ], >- [ -1, 0, 1 ], >- [ -1, -1, 0 ] >+ [ 0, -1, -1 ], >+ [ -1, 0, 1 ], >+ [ -1, -1, 0 ] > ], > [ 2, 2, 0 ], > [ 0, 0, 4 ], >@@ -337,11 +337,11 @@ test_allocation( > test_allocation( > "prefer fewer fails", > [ >- [ 0, 1, 1, 1, 1 ], >- [ -1, 0, -1, -1, 1 ], >- [ -1, -1, 0, -1, -1 ], >- [ -1, -1, -1, 0, -1 ], >- [ -1, -1, -1, -1, 0 ] >+ [ 0, 1, 1, 1, 1 ], >+ [ -1, 0, -1, -1, 1 ], >+ [ -1, -1, 0, -1, -1 ], >+ [ -1, -1, -1, 0, -1 ], >+ [ -1, -1, -1, -1, 0 ] > ], > [ 1, 1, 0, 0, 0 ], > [ 0, 0, 1, 1, 1 ], >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 97349cae1aa..242a06601ee 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -132,7 +132,7 @@ subtest 'outstanding_debits() tests' => sub { > { > borrowernumber => $patron_4->id, > amount => -3, >- amountoutstanding => 3, >+ amountoutstanding => 3, > interface => 'commandline', > credit_type_code => 'PAYMENT' > } >@@ -176,7 +176,7 @@ subtest 'outstanding_credits() tests' => sub { > Koha::Account::Line->new( > { > borrowernumber => $patron_2->id, >- amount => 2, >+ amount => 2, > amountoutstanding => -3, > interface => 'commandline', > debit_type_code => 'OVERDUE' >@@ -544,13 +544,13 @@ subtest 'reconcile_balance' => sub { > )->store; > > is( $account->balance(), -5, "Account balance is -5" ); >- is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); >+ is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); > is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' ); > > $account->reconcile_balance(); > > is( $account->balance(), -5, "Account balance is -5" ); >- is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' ); >+ is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' ); > is( $account->outstanding_credits->total_outstanding, -5, 'Outstanding credits sum -5' ); > > $schema->storage->txn_rollback; >@@ -597,8 +597,8 @@ subtest 'reconcile_balance' => sub { > } > )->store; > >- is( $account->balance(), 0, "Account balance is 0" ); >- is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); >+ is( $account->balance(), 0, "Account balance is 0" ); >+ is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); > is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' ); > > $account->reconcile_balance(); >@@ -652,8 +652,8 @@ subtest 'reconcile_balance' => sub { > } > )->store; > >- is( $account->balance(), 5, "Account balance is 5" ); >- is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' ); >+ is( $account->balance(), 5, "Account balance is 5" ); >+ is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' ); > is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' ); > > $account->reconcile_balance(); >@@ -683,8 +683,8 @@ subtest 'reconcile_balance' => sub { > my $debit_2 = $account->add_debit( { amount => 2, interface => 'commandline', type => 'OVERDUE' } ); > my $debit_3 = $account->add_debit( { amount => 3, interface => 'commandline', type => 'OVERDUE' } ); > >- is( $account->balance(), 2, "Account balance is 2" ); >- is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' ); >+ is( $account->balance(), 2, "Account balance is 2" ); >+ is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' ); > is( $account->outstanding_credits->total_outstanding, -4, 'Outstanding credits sum -4' ); > > $account->reconcile_balance(); >@@ -1019,7 +1019,7 @@ subtest 'pay() handles lost items when paying by amount ( not specifying the los > > $account->pay( > { >- amount => .5,, >+ amount => .5, > library_id => $library->id, > } > ); >@@ -1363,7 +1363,7 @@ subtest 'Koha::Account::payout_amount() tests' => sub { > my $credit_3 = $account->add_credit( { amount => 5, interface => 'commandline' } ); > my $credit_4 = $account->add_credit( { amount => 10, interface => 'commandline' } ); > my $credits = $account->outstanding_credits(); >- is( $credits->count, 4, "Found 4 credits with outstanding amounts" ); >+ is( $credits->count, 4, "Found 4 credits with outstanding amounts" ); > is( $credits->total_outstanding + 0, -20, "Total -20 outstanding credit" ); > > my $payout = $account->payout_amount($payout_params); >@@ -1371,7 +1371,7 @@ subtest 'Koha::Account::payout_amount() tests' => sub { > is( $payout->amount + 0, 10, "Payout amount recorded correctly" ); > is( $payout->amountoutstanding + 0, 0, "Full amount was paid out" ); > $credits = $account->outstanding_credits(); >- is( $credits->count, 1, "Payout was applied against oldest outstanding credits first" ); >+ is( $credits->count, 1, "Payout was applied against oldest outstanding credits first" ); > is( $credits->total_outstanding + 0, -10, "Total of 10 outstanding credit remaining" ); > > my $offsets = Koha::Account::Offsets->search( { debit_id => $payout->id } ); >@@ -1400,7 +1400,7 @@ subtest 'Koha::Account::payout_amount() tests' => sub { > $payout = $account->payout_amount($payout_params); > > $credits = $account->outstanding_credits(); >- is( $credits->count, 2, "Second credit not fully paid off" ); >+ is( $credits->count, 2, "Second credit not fully paid off" ); > is( $credits->total_outstanding + 0, -12.50, "12.50 outstanding credit remaining" ); > $credit_4->discard_changes; > $credit_5->discard_changes; >@@ -1496,7 +1496,7 @@ subtest 'Koha::Account::payin_amount() tests' => sub { > my $payin = $account->payin_amount($payin_params); > is( ref($payin), 'Koha::Account::Line', 'Return the Koha::Account::Line object for the payin' ); > is( $payin->amount + 0, -10, "Payin amount recorded correctly" ); >- is( $payin->amountoutstanding + 0, 0, "Full amount was used to pay debts" ); >+ is( $payin->amountoutstanding + 0, 0, "Full amount was used to pay debts" ); > $debits = $account->outstanding_debits(); > is( $debits->count, 1, "Payin was applied against oldest outstanding debits first" ); > is( $debits->total_outstanding + 0, 10, "Total of 10 outstanding debit remaining" ); >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 30b623d0901..7655fb92d10 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -966,7 +966,7 @@ subtest "void() tests" => sub { > is( $account_payment->credit_type_code, 'PAYMENT', 'Voided payment credit_type_code is still PAYMENT' ); > is( $account_payment->status, 'VOID', 'Voided payment status is VOID' ); > is( $account_payment->amount + 0, -30, 'Voided payment amount is still -30' ); >- is( $account_payment->amountoutstanding + 0, 0, 'Voided payment amount outstanding is 0' ); >+ is( $account_payment->amountoutstanding + 0, 0, 'Voided payment amount outstanding is 0' ); > > is( $line1->amountoutstanding + 0, 10, 'First fee again has amount outstanding of 10' ); > is( $line2->amountoutstanding + 0, 20, 'Second fee again has amount outstanding of 20' ); >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index ccbc8372b13..830b849ba94 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -311,7 +311,7 @@ subtest 'debits_total() tests' => sub { > borrowernumber => $patron->id, > credit_type_code => "PAYMENT", > amount => -10, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > } > )->store; >@@ -324,7 +324,7 @@ subtest 'debits_total() tests' => sub { > borrowernumber => $patron->id, > credit_type_code => "PAYMENT", > amount => -10, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > } > )->store; >@@ -337,7 +337,7 @@ subtest 'debits_total() tests' => sub { > borrowernumber => $patron->id, > credit_type_code => "PAYMENT", > amount => -100, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > } > )->store; >diff --git a/t/db_dependent/Koha/Acquisition/Orders.t b/t/db_dependent/Koha/Acquisition/Orders.t >index bfe90e684df..f9bb533633a 100755 >--- a/t/db_dependent/Koha/Acquisition/Orders.t >+++ b/t/db_dependent/Koha/Acquisition/Orders.t >@@ -178,8 +178,12 @@ subtest 'filter_by_obsolete and cancel' => sub { > > # First make order 1 obsolete by removing biblio, and order 3 by status problem. > my $date = Koha::DateUtils::dt_from_string->subtract( days => 7 ); >- $order_1->orderstatus('ordered')->quantity(2)->quantityreceived(0)->datecancellationprinted(undef) >- ->entrydate($date)->store; >+ $order_1->orderstatus('ordered') >+ ->quantity(2) >+ ->quantityreceived(0) >+ ->datecancellationprinted(undef) >+ ->entrydate($date) >+ ->store; > Koha::Biblios->find( $order_1->biblionumber )->delete; > $order_1->discard_changes; > $order_2->orderstatus('ordered')->quantity(3)->quantityreceived(0)->datecancellationprinted(undef)->store; >diff --git a/t/db_dependent/Koha/AdditionalContents.t b/t/db_dependent/Koha/AdditionalContents.t >index 8606af7a50e..6811e480e33 100755 >--- a/t/db_dependent/Koha/AdditionalContents.t >+++ b/t/db_dependent/Koha/AdditionalContents.t >@@ -110,7 +110,7 @@ subtest '->is_expired' => sub { > > my $today = dt_from_string; > my $yesterday = dt_from_string->add( days => -1 ); >- my $tomorrow = dt_from_string->add( days => 1 ); >+ my $tomorrow = dt_from_string->add( days => 1 ); > my $new_today = $builder->build_object( > { > class => 'Koha::AdditionalContents', >@@ -200,7 +200,7 @@ subtest '->search_for_display' => sub { > > my $today = dt_from_string; > my $yesterday = dt_from_string->add( days => -1 ); >- my $tomorrow = dt_from_string->add( days => 1 ); >+ my $tomorrow = dt_from_string->add( days => 1 ); > my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); > my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); > >diff --git a/t/db_dependent/Koha/Charges/Sales.t b/t/db_dependent/Koha/Charges/Sales.t >index 0cc474b7add..2c06aefdca0 100755 >--- a/t/db_dependent/Koha/Charges/Sales.t >+++ b/t/db_dependent/Koha/Charges/Sales.t >@@ -231,7 +231,7 @@ subtest 'purchase tests' => sub { > ok( $credit->is_credit, "return is a credit for payment" ); > is( $credit->credit_type_code, 'PURCHASE', "credit_type_code set correctly to 'PURCHASE' for payment" ); > is( $credit->amount * 1, -5, "amount is calculated correctly for payment" ); >- is( $credit->amountoutstanding * 1, 0, "amountoutstanding is set to zero for payment" ); >+ is( $credit->amountoutstanding * 1, 0, "amountoutstanding is set to zero for payment" ); > is( $credit->manager_id, $staff->borrowernumber, "manager_id set correctionly for payment" ); > is( $credit->register_id, $cash_register->id, "register_id set correctly for payment" ); > is( $credit->payment_type, 'CASH', "payment_type set correctly for payment" ); >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 12a307a663a..b053baddfe9 100755 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -78,9 +78,9 @@ is( > subtest 'is_overdue' => sub { > plan tests => 6; > my $ten_days_ago = dt_from_string->add( days => -10 ); >- my $ten_days_later = dt_from_string->add( days => 10 ); >+ my $ten_days_later = dt_from_string->add( days => 10 ); > my $yesterday = dt_from_string->add( days => -1 ); >- my $tomorrow = dt_from_string->add( days => 1 ); >+ my $tomorrow = dt_from_string->add( days => 1 ); > > $retrieved_checkout_1->date_due($ten_days_ago)->store; > is( >@@ -299,7 +299,7 @@ subtest 'Koha::Old::Checkouts->filter_by_todays_checkins' => sub { > itemnumber => $item->itemnumber, > branchcode => $library->{branchcode}, > } >- )->store; >+ )->store; > } > > # Checkin 3 today - 2 days >diff --git a/t/db_dependent/Koha/Holds.t b/t/db_dependent/Koha/Holds.t >index 4443be5c42d..537ea72b28a 100755 >--- a/t/db_dependent/Koha/Holds.t >+++ b/t/db_dependent/Koha/Holds.t >@@ -466,7 +466,8 @@ subtest 'cancel' => sub { > my $reserve_id = C4::Reserves::AddReserve($hold_info); > Koha::Holds->find($reserve_id)->cancel; > my $number_of_logs = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'CANCEL', object => $reserve_id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'CANCEL', object => $reserve_id } ) > ->count; > is( $number_of_logs, 0, 'Without HoldsLog, Koha::Hold->cancel should not have logged' ); > >@@ -474,7 +475,8 @@ subtest 'cancel' => sub { > $reserve_id = C4::Reserves::AddReserve($hold_info); > Koha::Holds->find($reserve_id)->cancel; > $number_of_logs = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'CANCEL', object => $reserve_id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'CANCEL', object => $reserve_id } ) > ->count; > is( $number_of_logs, 1, 'With HoldsLog, Koha::Hold->cancel should have logged' ); > }; >@@ -828,8 +830,8 @@ subtest 'get_items_that_can_fill' => sub { > my $item_4 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $itype_1->itemtype } ) > ; # in transfer > my $item_5 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $itype_2->itemtype } ); >- my $lost = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itemlost => 1 } ); >- my $withdrawn = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, withdrawn => 1 } ); >+ my $lost = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itemlost => 1 } ); >+ my $withdrawn = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, withdrawn => 1 } ); > my $notforloan = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => -1 } ); > > my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); >diff --git a/t/db_dependent/Koha/ILL/Request/Config.t b/t/db_dependent/Koha/ILL/Request/Config.t >index 38d91e90a8c..69ef6e992ad 100755 >--- a/t/db_dependent/Koha/ILL/Request/Config.t >+++ b/t/db_dependent/Koha/ILL/Request/Config.t >@@ -142,7 +142,7 @@ subtest 'opac_available_backends() tests' => sub { > }; > > my $base_limits = { >- branch => { CPL => { count => 1, method => 'annual' } }, >+ branch => { CPL => { count => 1, method => 'annual' } }, > brw_cat => { A => { count => -1, method => 'active' } }, > default => { count => 10, method => 'annual' }, > }; >diff --git a/t/db_dependent/Koha/ILL/Requests.t b/t/db_dependent/Koha/ILL/Requests.t >index d31ffb04d48..9723c2c867b 100755 >--- a/t/db_dependent/Koha/ILL/Requests.t >+++ b/t/db_dependent/Koha/ILL/Requests.t >@@ -1011,7 +1011,7 @@ subtest 'Backend core methods' => sub { > ); > > Koha::AdditionalContents->search->delete; >- my $tomorrow = dt_from_string->add( days => 1 ); >+ my $tomorrow = dt_from_string->add( days => 1 ); > my $yesterday = dt_from_string->add( days => -1 ); > > my $library_additional_contents = $builder->build_object( >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 24859287702..4a85726d176 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -2863,7 +2863,7 @@ subtest 'store() tests' => sub { > { > borrowernumber => $patron->id, > date => '1970-01-01 14:00:01', >- amountoutstanding => 0, >+ amountoutstanding => 0, > amount => -5, > interface => 'commandline', > credit_type_code => 'PAYMENT' >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 868577a027b..ec5de1c6d8c 100755 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -1254,7 +1254,7 @@ subtest "filter_by_last_update" => sub { > class => 'Koha::Patrons', > value => { updated_on => $now->clone->subtract( days => $i ) } > } >- )->borrowernumber; >+ )->borrowernumber; > } > > my $patrons = Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } } ); >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 6dad68f2893..728e5853844 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -502,7 +502,8 @@ subtest 'renew_account' => sub { > ); > my $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; >+ ->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } ) >+ ->count; > is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->renew_account should have logged' ); > > t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); >@@ -518,7 +519,8 @@ subtest 'renew_account' => sub { > is( dt_from_string($retrieved_expiry_date), $a_year_later, "today + 12 months must be $a_year_later" ); > $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; >+ ->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } ) >+ ->count; > is( $number_of_logs, 1, 'Without BorrowersLog, Koha::Patron->renew_account should not have logged' ); > > t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' ); >@@ -654,7 +656,8 @@ subtest "delete" => sub { > > my $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } )->count; >+ ->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } ) >+ ->count; > is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->delete should have logged' ); > > # Test deletion with designated fallback owner >@@ -727,7 +730,8 @@ subtest 'add_enrolment_fee_if_needed' => sub { > foreach ( keys %{$enrolmentfees} ) { > ( Koha::Patron::Categories->find($_) > // $builder->build_object( { class => 'Koha::Patron::Categories', value => { categorycode => $_ } } ) ) >- ->enrolmentfee( $enrolmentfees->{$_} )->store; >+ ->enrolmentfee( $enrolmentfees->{$_} ) >+ ->store; > } > my $enrolmentfee_K = $enrolmentfees->{K}; > my $enrolmentfee_J = $enrolmentfees->{J}; >@@ -2475,7 +2479,8 @@ subtest '->set_password' => sub { > > my $number_of_logs = > $schema->resultset('ActionLog') >- ->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count; >+ ->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } ) >+ ->count; > is( $number_of_logs, 0, 'Without BorrowersLog, Koha::Patron->set_password doesn\'t log password changes' ); > > # Enable logging password changes >@@ -3005,8 +3010,8 @@ subtest "search_patrons_to_update_category tests" => sub { > class => 'Koha::Patrons', > value => { > categorycode => $category_code, >- dateofbirth => >- $current_dt->clone->subtract( years => $category->upperagelimit + 1 )->subtract( days => 1 ) >+ dateofbirth => $current_dt->clone->subtract( years => $category->upperagelimit + 1 ) >+ ->subtract( days => 1 ) > ->ymd, > } > } >@@ -3456,7 +3461,8 @@ subtest 'filter_by_have_permission' => sub { > is_deeply( > [ > Koha::Patrons->search( { branchcode => $library->branchcode } ) >- ->filter_by_have_permission('suggestions.suggestions_manage')->get_column('borrowernumber') >+ ->filter_by_have_permission('suggestions.suggestions_manage') >+ ->get_column('borrowernumber') > ], > [ $patron_1->borrowernumber, $patron_2->borrowernumber ], > 'Superlibrarian and patron with suggestions.suggestions_manage' >@@ -3465,7 +3471,8 @@ subtest 'filter_by_have_permission' => sub { > is_deeply( > [ > Koha::Patrons->search( { branchcode => $library->branchcode } ) >- ->filter_by_have_permission('acquisition.order_manage')->get_column('borrowernumber') >+ ->filter_by_have_permission('acquisition.order_manage') >+ ->get_column('borrowernumber') > ], > [ $patron_1->borrowernumber, $patron_3->borrowernumber ], > 'Superlibrarian and patron with acquisition.order_manage' >@@ -3474,7 +3481,8 @@ subtest 'filter_by_have_permission' => sub { > is_deeply( > [ > Koha::Patrons->search( { branchcode => $library->branchcode } ) >- ->filter_by_have_permission('parameters.manage_cities')->get_column('borrowernumber') >+ ->filter_by_have_permission('parameters.manage_cities') >+ ->get_column('borrowernumber') > ], > [ $patron_1->borrowernumber ], > 'Only Superlibrarian is returned' >@@ -3482,7 +3490,8 @@ subtest 'filter_by_have_permission' => sub { > > is_deeply( > [ >- Koha::Patrons->search( { branchcode => $library->branchcode } )->filter_by_have_permission('suggestions') >+ Koha::Patrons->search( { branchcode => $library->branchcode } ) >+ ->filter_by_have_permission('suggestions') > ->get_column('borrowernumber') > ], > [ $patron_1->borrowernumber, $patron_2->borrowernumber ], >diff --git a/t/db_dependent/Koha/Plugins/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t >index ad368594bfd..9988bfff146 100755 >--- a/t/db_dependent/Koha/Plugins/Plugins.t >+++ b/t/db_dependent/Koha/Plugins/Plugins.t >@@ -563,20 +563,20 @@ subtest 'Test _version_compare' => sub { > t::lib::Mocks::mock_config( 'enable_plugins', 1 ); > > is( Koha::Plugins::Base::_version_compare( '1.1.1', '2.2.2' ), -1, "1.1.1 is less then 2.2.2" ); >- is( Koha::Plugins::Base::_version_compare( '2.2.2', '1.1.1' ), 1, "1.1.1 is greater then 2.2.2" ); >- is( Koha::Plugins::Base::_version_compare( '1.1.1', '1.1.1' ), 0, "1.1.1 is equal to 1.1.1" ); >- is( Koha::Plugins::Base::_version_compare( '1.01.001', '1.1.1' ), 0, "1.01.001 is equal to 1.1.1" ); >- is( Koha::Plugins::Base::_version_compare( '1', '1.0.0' ), 0, "1 is equal to 1.0.0" ); >- is( Koha::Plugins::Base::_version_compare( '1.0', '1.0.0' ), 0, "1.0 is equal to 1.0.0" ); >+ is( Koha::Plugins::Base::_version_compare( '2.2.2', '1.1.1' ), 1, "1.1.1 is greater then 2.2.2" ); >+ is( Koha::Plugins::Base::_version_compare( '1.1.1', '1.1.1' ), 0, "1.1.1 is equal to 1.1.1" ); >+ is( Koha::Plugins::Base::_version_compare( '1.01.001', '1.1.1' ), 0, "1.01.001 is equal to 1.1.1" ); >+ is( Koha::Plugins::Base::_version_compare( '1', '1.0.0' ), 0, "1 is equal to 1.0.0" ); >+ is( Koha::Plugins::Base::_version_compare( '1.0', '1.0.0' ), 0, "1.0 is equal to 1.0.0" ); > > # OO tests > my $plugin = Koha::Plugin::Test->new; > is( $plugin->_version_compare( '1.1.1', '2.2.2' ), -1, "1.1.1 is less then 2.2.2" ); >- is( $plugin->_version_compare( '2.2.2', '1.1.1' ), 1, "1.1.1 is greater then 2.2.2" ); >- is( $plugin->_version_compare( '1.1.1', '1.1.1' ), 0, "1.1.1 is equal to 1.1.1" ); >- is( $plugin->_version_compare( '1.01.001', '1.1.1' ), 0, "1.01.001 is equal to 1.1.1" ); >- is( $plugin->_version_compare( '1', '1.0.0' ), 0, "1 is equal to 1.0.0" ); >- is( $plugin->_version_compare( '1.0', '1.0.0' ), 0, "1.0 is equal to 1.0.0" ); >+ is( $plugin->_version_compare( '2.2.2', '1.1.1' ), 1, "1.1.1 is greater then 2.2.2" ); >+ is( $plugin->_version_compare( '1.1.1', '1.1.1' ), 0, "1.1.1 is equal to 1.1.1" ); >+ is( $plugin->_version_compare( '1.01.001', '1.1.1' ), 0, "1.01.001 is equal to 1.1.1" ); >+ is( $plugin->_version_compare( '1', '1.0.0' ), 0, "1 is equal to 1.0.0" ); >+ is( $plugin->_version_compare( '1.0', '1.0.0' ), 0, "1.0 is equal to 1.0.0" ); > }; > > subtest 'bundle_path() tests' => sub { >diff --git a/t/db_dependent/Koha/REST/Plugin/Auth/IdP.t b/t/db_dependent/Koha/REST/Plugin/Auth/IdP.t >index 1d32b72fa75..1c91541ee04 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Auth/IdP.t >+++ b/t/db_dependent/Koha/REST/Plugin/Auth/IdP.t >@@ -150,11 +150,13 @@ subtest 'auth.register helper' => sub { > )->status_is(200)->json_is( '/userid', $userid_1 ); > > $t->post_ok( '/register_user' => json => >- { data => {}, domain_id => $domain_2->identity_provider_domain_id, interface => 'opac' } )->status_is(401) >+ { data => {}, domain_id => $domain_2->identity_provider_domain_id, interface => 'opac' } ) >+ ->status_is(401) > ->json_is( '/message', 'unauthorized' ); > > $t->post_ok( '/register_user' => json => >- { data => {}, domain_id => $domain_1->identity_provider_domain_id, interface => 'staff' } )->status_is(401) >+ { data => {}, domain_id => $domain_1->identity_provider_domain_id, interface => 'staff' } ) >+ ->status_is(401) > ->json_is( '/message', 'unauthorized' ); > > $t->post_ok( >@@ -172,11 +174,13 @@ subtest 'auth.register helper' => sub { > )->status_is(200)->json_is( '/userid', $userid_2 ); > > $t->post_ok( '/register_user' => json => { data => {}, domain_id => $domain_1->identity_provider_domain_id } ) >- ->status_is(400)->json_is( '/message', 'missing parameter: interface' ); >+ ->status_is(400) >+ ->json_is( '/message', 'missing parameter: interface' ); > > $t->post_ok( '/register_user' => json => > { data => {}, domain_id => $domain_1->identity_provider_domain_id, interface => 'invalid' } ) >- ->status_is(400)->json_is( '/message', 'bad parameter: interface' ); >+ ->status_is(400) >+ ->json_is( '/message', 'bad parameter: interface' ); > > $schema->storage->txn_rollback; > }; >@@ -188,7 +192,8 @@ subtest 'auth.session helper' => sub { > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >- $t->post_ok( '/start_session' => json => { userid => $patron->userid } )->status_is(200) >+ $t->post_ok( '/start_session' => json => { userid => $patron->userid } ) >+ ->status_is(200) > ->json_has( '/status', 'ok' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t b/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >index d41c0332dbb..492cdf1ea91 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >+++ b/t/db_dependent/Koha/REST/Plugin/Auth/PublicRoutes.t >@@ -96,16 +96,19 @@ subtest 'auth.public helper' => sub { > > my $t = Test::Mojo->new; > >- $t->post_ok( '/public' => json => { patron_id => $another_patron->borrowernumber } )->status_is(401) >+ $t->post_ok( '/public' => json => { patron_id => $another_patron->borrowernumber } ) >+ ->status_is(401) > ->json_is( { message => 'authentication_required' } ); > > $t->post_ok( '/public' => json => > { user => $unprivileged_patron->borrowernumber, patron_id => $another_patron->borrowernumber } ) >- ->status_is(403)->json_is( { message => 'unauthorized' } ); >+ ->status_is(403) >+ ->json_is( { message => 'unauthorized' } ); > > $t->post_ok( '/public' => json => > { user => $unprivileged_patron->borrowernumber, patron_id => $unprivileged_patron->borrowernumber } ) >- ->status_is(200)->json_is('OK'); >+ ->status_is(200) >+ ->json_is('OK'); > > $schema->storage->txn_rollback; > }; >@@ -124,21 +127,25 @@ subtest 'auth.public_guarantor helper' => sub { > > my $t = Test::Mojo->new; > >- $t->post_ok( '/public_guarantor' => json => { patron_id => $another_patron->borrowernumber } )->status_is(401) >+ $t->post_ok( '/public_guarantor' => json => { patron_id => $another_patron->borrowernumber } ) >+ ->status_is(401) > ->json_is( { message => 'authentication_required' } ); > > $t->post_ok( '/public_guarantor' => json => >- { user => $guarantor->borrowernumber, patron_id => $another_patron->borrowernumber } )->status_is(403) >+ { user => $guarantor->borrowernumber, patron_id => $another_patron->borrowernumber } ) >+ ->status_is(403) > ->json_is( { message => 'unauthorized' } ); > > # user is not a guarantor of themself > $t->post_ok( > '/public_guarantor' => json => { user => $guarantor->borrowernumber, patron_id => $guarantor->borrowernumber } ) >- ->status_is(403)->json_is( { message => 'unauthorized' } ); >+ ->status_is(403) >+ ->json_is( { message => 'unauthorized' } ); > > $t->post_ok( > '/public_guarantor' => json => { user => $guarantor->borrowernumber, patron_id => $guarantee->borrowernumber } ) >- ->status_is(200)->json_is('OK'); >+ ->status_is(200) >+ ->json_is('OK'); > > $schema->storage->txn_rollback; > }; >diff --git a/t/db_dependent/Koha/REST/Plugin/Objects.t b/t/db_dependent/Koha/REST/Plugin/Objects.t >index 55494b90da5..d643575da73 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Objects.t >+++ b/t/db_dependent/Koha/REST/Plugin/Objects.t >@@ -186,8 +186,11 @@ subtest 'objects.search helper' => sub { > ); > > my $t = Test::Mojo->new; >- $t->get_ok('/cities?name=manuel&_per_page=1&_page=1')->status_is(200) >- ->header_like( 'Link' => qr/<http:\/\/.*[\?&]_page=2.*>; rel="next",/ )->json_has('/0')->json_hasnt('/1') >+ $t->get_ok('/cities?name=manuel&_per_page=1&_page=1') >+ ->status_is(200) >+ ->header_like( 'Link' => qr/<http:\/\/.*[\?&]_page=2.*>; rel="next",/ ) >+ ->json_has('/0') >+ ->json_hasnt('/1') > ->json_is( '/0/name' => 'Manuel' ); > > $builder->build_object( >@@ -198,22 +201,44 @@ subtest 'objects.search helper' => sub { > ); > > # _match=starts_with >- $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=starts_with')->status_is(200)->json_has('/0') >- ->json_has('/1')->json_has('/2')->json_hasnt('/3')->json_is( '/0/name' => 'Manuel' ) >- ->json_is( '/1/name' => 'Manuela' )->json_is( '/2/name' => 'Manuelab' ); >+ $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=starts_with') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_has('/2') >+ ->json_hasnt('/3') >+ ->json_is( '/0/name' => 'Manuel' ) >+ ->json_is( '/1/name' => 'Manuela' ) >+ ->json_is( '/2/name' => 'Manuelab' ); > > # _match=ends_with >- $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=ends_with')->status_is(200)->json_has('/0') >- ->json_has('/1')->json_hasnt('/2')->json_is( '/0/name' => 'Manuel' )->json_is( '/1/name' => 'Emanuel' ); >+ $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=ends_with') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_hasnt('/2') >+ ->json_is( '/0/name' => 'Manuel' ) >+ ->json_is( '/1/name' => 'Emanuel' ); > > # _match=exact >- $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=exact')->status_is(200)->json_has('/0') >- ->json_hasnt('/1')->json_is( '/0/name' => 'Manuel' ); >+ $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=exact') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_hasnt('/1') >+ ->json_is( '/0/name' => 'Manuel' ); > > # _match=contains >- $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=contains')->status_is(200)->json_has('/0') >- ->json_has('/1')->json_has('/2')->json_has('/3')->json_hasnt('/4')->json_is( '/0/name' => 'Manuel' ) >- ->json_is( '/1/name' => 'Manuela' )->json_is( '/2/name' => 'Manuelab' )->json_is( '/3/name' => 'Emanuel' ); >+ $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=contains') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_has('/2') >+ ->json_has('/3') >+ ->json_hasnt('/4') >+ ->json_is( '/0/name' => 'Manuel' ) >+ ->json_is( '/1/name' => 'Manuela' ) >+ ->json_is( '/2/name' => 'Manuelab' ) >+ ->json_is( '/3/name' => 'Emanuel' ); > > # Add 20 more cities > for ( 1 .. 20 ) { >@@ -262,26 +287,54 @@ subtest 'objects.search helper, sorting on mapped column' => sub { > my $t = Test::Mojo->new; > > # CSV-param >- $t->get_ok('/cities?_order_by=%2Bname,-country')->status_is(200)->json_has('/0')->json_has('/1') >- ->json_is( '/0/name' => 'A' )->json_is( '/1/name' => 'B' )->json_is( '/2/name' => 'C' ) >- ->json_is( '/2/country' => 'Belarus' )->json_is( '/3/name' => 'C' )->json_is( '/3/country' => 'Argentina' ) >+ $t->get_ok('/cities?_order_by=%2Bname,-country') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_is( '/0/name' => 'A' ) >+ ->json_is( '/1/name' => 'B' ) >+ ->json_is( '/2/name' => 'C' ) >+ ->json_is( '/2/country' => 'Belarus' ) >+ ->json_is( '/3/name' => 'C' ) >+ ->json_is( '/3/country' => 'Argentina' ) > ->json_hasnt('/4'); > > # Multi-param: traditional >- $t->get_ok('/cities?_order_by=%2Bname&_order_by=-country')->status_is(200)->json_has('/0')->json_has('/1') >- ->json_is( '/0/name' => 'A' )->json_is( '/1/name' => 'B' )->json_is( '/2/name' => 'C' ) >- ->json_is( '/2/country' => 'Belarus' )->json_is( '/3/name' => 'C' )->json_is( '/3/country' => 'Argentina' ) >+ $t->get_ok('/cities?_order_by=%2Bname&_order_by=-country') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_is( '/0/name' => 'A' ) >+ ->json_is( '/1/name' => 'B' ) >+ ->json_is( '/2/name' => 'C' ) >+ ->json_is( '/2/country' => 'Belarus' ) >+ ->json_is( '/3/name' => 'C' ) >+ ->json_is( '/3/country' => 'Argentina' ) > ->json_hasnt('/4'); > > # Multi-param: PHP Style, Passes validation as above, subsequently explodes >- $t->get_ok('/cities?_order_by[]=%2Bname&_order_by[]=-country')->status_is(200)->json_has('/0')->json_has('/1') >- ->json_is( '/0/name' => 'A' )->json_is( '/1/name' => 'B' )->json_is( '/2/name' => 'C' ) >- ->json_is( '/2/country' => 'Belarus' )->json_is( '/3/name' => 'C' )->json_is( '/3/country' => 'Argentina' ) >+ $t->get_ok('/cities?_order_by[]=%2Bname&_order_by[]=-country') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_is( '/0/name' => 'A' ) >+ ->json_is( '/1/name' => 'B' ) >+ ->json_is( '/2/name' => 'C' ) >+ ->json_is( '/2/country' => 'Belarus' ) >+ ->json_is( '/3/name' => 'C' ) >+ ->json_is( '/3/country' => 'Argentina' ) > ->json_hasnt('/4'); > > # Single-param >- $t->get_ok('/cities?_order_by=-name')->status_is(200)->json_has('/0')->json_has('/1')->json_is( '/0/name' => 'C' ) >- ->json_is( '/1/name' => 'C' )->json_is( '/2/name' => 'B' )->json_is( '/3/name' => 'A' )->json_hasnt('/4'); >+ $t->get_ok('/cities?_order_by=-name') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_is( '/0/name' => 'C' ) >+ ->json_is( '/1/name' => 'C' ) >+ ->json_is( '/2/name' => 'B' ) >+ ->json_is( '/3/name' => 'A' ) >+ ->json_hasnt('/4'); > > $schema->storage->txn_rollback; > }; >@@ -298,7 +351,10 @@ subtest 'objects.search helper, encoding' => sub { > $builder->build_object( { class => 'Koha::Cities', value => { city_name => 'B', city_country => 'â¤Argentinaâ¤' } } ); > > my $t = Test::Mojo->new; >- $t->get_ok('/cities?q={"country": "â¤Argentinaâ¤"}')->status_is(200)->json_has('/0')->json_hasnt('/1') >+ $t->get_ok('/cities?q={"country": "â¤Argentinaâ¤"}') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_hasnt('/1') > ->json_is( '/0/name' => 'B' ); > > $schema->storage->txn_rollback; >@@ -326,11 +382,13 @@ subtest 'objects.search helper, X-Total-Count and X-Base-Total-Count' => sub { > } > > my $t = Test::Mojo->new; >- $t->get_ok('/cities?name=L&_per_page=10&_page=1&_match=starts_with')->status_is(200) >+ $t->get_ok('/cities?name=L&_per_page=10&_page=1&_match=starts_with') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 20, 'X-Total-Count header present' ) > ->header_is( 'X-Base-Total-Count' => 20, 'X-Base-Total-Count header present' ); > >- $t->get_ok('/cities?name=Llan&_per_page=10&_page=1&_match=starts_with')->status_is(200) >+ $t->get_ok('/cities?name=Llan&_per_page=10&_page=1&_match=starts_with') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 17, 'X-Total-Count header present' ) > ->header_is( 'X-Base-Total-Count' => 20, 'X-Base-Total-Count header present' ); > >@@ -656,13 +714,18 @@ subtest 'objects.search helper, search_limited() tests' => sub { > t::lib::Mocks::mock_userenv( { patron => $patron } ); > > $t->get_ok( "/my_patrons?q=" . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) ) >- ->status_is(200)->json_is( '/0/patron_id' => $patron_1->id )->json_is( '/1/patron_id' => $patron_2->id ) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_1->id ) >+ ->json_is( '/1/patron_id' => $patron_2->id ) > ->json_is( '/2/patron_id' => $patron_3->id ); > > @libraries_where_can_see_patrons = ( $library_2->id ); > >- my $res = $t->get_ok( "/my_patrons?q=" . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) ) >- ->status_is(200)->json_is( '/0/patron_id' => $patron_3->id, 'Returns the only allowed patron' )->tx->res->json; >+ my $res = >+ $t->get_ok( "/my_patrons?q=" . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) ) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_3->id, 'Returns the only allowed patron' ) >+ ->tx->res->json; > > is( scalar @{$res}, 1, 'Only one patron returned' ); > >@@ -760,16 +823,24 @@ subtest 'objects.find helper with expanded authorised values' => sub { > } > ); > >- $t->get_ok( '/cities/' . $manuel->id => { 'x-koha-embed' => '+strings' } )->status_is(200) >- ->json_is( '/name' => 'Manuel' )->json_has('/_strings')->json_is( '/_strings/country/type' => 'av' ) >+ $t->get_ok( '/cities/' . $manuel->id => { 'x-koha-embed' => '+strings' } ) >+ ->status_is(200) >+ ->json_is( '/name' => 'Manuel' ) >+ ->json_has('/_strings') >+ ->json_is( '/_strings/country/type' => 'av' ) > ->json_is( '/_strings/country/category' => $cat->category_name ) > ->json_is( '/_strings/country/str' => $ar->lib ); > >- $t->get_ok( '/cities/' . $manuel->id => { 'x-koha-embed' => '' } )->status_is(200)->json_is( '/name' => 'Manuel' ) >+ $t->get_ok( '/cities/' . $manuel->id => { 'x-koha-embed' => '' } ) >+ ->status_is(200) >+ ->json_is( '/name' => 'Manuel' ) > ->json_hasnt('/_strings'); > >- $t->get_ok( '/cities/' . $manuela->id => { 'x-koha-embed' => '+strings' } )->status_is(200) >- ->json_is( '/name' => 'Manuela' )->json_has('/_strings')->json_is( '/_strings/country/type' => 'av' ) >+ $t->get_ok( '/cities/' . $manuela->id => { 'x-koha-embed' => '+strings' } ) >+ ->status_is(200) >+ ->json_is( '/name' => 'Manuela' ) >+ ->json_has('/_strings') >+ ->json_is( '/_strings/country/type' => 'av' ) > ->json_is( '/_strings/country/category' => $cat->category_name ) > ->json_is( '/_strings/country/str' => $us->lib ); > >@@ -868,17 +939,30 @@ subtest 'objects.search helper with expanded authorised values' => sub { > ); > > $t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' => { 'x-koha-embed' => '+strings' } ) >- ->status_is(200)->json_has('/0')->json_has('/1')->json_hasnt('/2')->json_is( '/0/name' => 'Manuel' ) >- ->json_has('/0/_strings')->json_is( '/0/_strings/country/str' => $ar->lib ) >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_hasnt('/2') >+ ->json_is( '/0/name' => 'Manuel' ) >+ ->json_has('/0/_strings') >+ ->json_is( '/0/_strings/country/str' => $ar->lib ) > ->json_is( '/0/_strings/country/type' => 'av' ) >- ->json_is( '/0/_strings/country/category' => $cat->category_name )->json_is( '/1/name' => 'Manuela' ) >- ->json_has('/1/_strings')->json_is( '/1/_strings/country/str' => $us->lib ) >+ ->json_is( '/0/_strings/country/category' => $cat->category_name ) >+ ->json_is( '/1/name' => 'Manuela' ) >+ ->json_has('/1/_strings') >+ ->json_is( '/1/_strings/country/str' => $us->lib ) > ->json_is( '/1/_strings/country/type' => 'av' ) > ->json_is( '/1/_strings/country/category' => $cat->category_name ); > >- $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=starts_with')->status_is(200)->json_has('/0') >- ->json_has('/1')->json_hasnt('/2')->json_is( '/0/name' => 'Manuel' )->json_hasnt('/0/_strings') >- ->json_is( '/1/name' => 'Manuela' )->json_hasnt('/1/_strings'); >+ $t->get_ok('/cities?name=manuel&_per_page=4&_page=1&_match=starts_with') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_hasnt('/2') >+ ->json_is( '/0/name' => 'Manuel' ) >+ ->json_hasnt('/0/_strings') >+ ->json_is( '/1/name' => 'Manuela' ) >+ ->json_hasnt('/1/_strings'); > > $schema->storage->txn_rollback; > }; >@@ -994,7 +1078,9 @@ subtest 'date handling' => sub { > borrowernumber => $patron->id > } > ); >- $t->get_ok( "//$userid:$password@/api/v1/jobs?q=" . $q )->status_is(200)->json_is( '/0/job_id' => $job_1->id ) >+ $t->get_ok( "//$userid:$password@/api/v1/jobs?q=" . $q ) >+ ->status_is(200) >+ ->json_is( '/0/job_id' => $job_1->id ) > ->json_is( '/1/job_id' => $job_3->id ); > $response_count = scalar @{ $t->tx->res->json }; > is( $response_count, 2 ); >diff --git a/t/db_dependent/Koha/REST/Plugin/Pagination.t b/t/db_dependent/Koha/REST/Plugin/Pagination.t >index 17d1aa8b98f..cab3d5712a4 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Pagination.t >+++ b/t/db_dependent/Koha/REST/Plugin/Pagination.t >@@ -101,11 +101,14 @@ subtest 'add_pagination_headers() tests' => sub { > > my $t = Test::Mojo->new; > >- $t->get_ok('/empty')->status_is(200)->header_is( 'X-Total-Count' => undef, 'X-Total-Count is undefined' ) >+ $t->get_ok('/empty') >+ ->status_is(200) >+ ->header_is( 'X-Total-Count' => undef, 'X-Total-Count is undefined' ) > ->header_is( 'X-Base-Total-Count' => undef, 'X-Base-Total-Count is undefined' ) > ->header_is( 'Link' => undef, 'Link is undefined' ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_page=2&_per_page=3')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_page=2&_per_page=3') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count correctly set' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*_per_page=3.*>; rel="prev",/ ) >@@ -121,7 +124,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_like( 'Link' => qr/<http:\/\/.*\?.*_page=4.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_page=1&_per_page=3')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_page=1&_per_page=3') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count correctly set' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*>; rel="prev",/ ) >@@ -135,7 +139,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_like( 'Link' => qr/<http:\/\/.*\?.*_page=4.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_page=4&_per_page=3')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_page=4&_per_page=3') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count correctly set' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*_per_page=3.*>; rel="prev",/ ) >@@ -150,7 +155,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > > t::lib::Mocks::mock_preference( 'RESTdefaultPageSize', 3 ); >- $t->get_ok('/pagination_headers?firstname=Jonathan&_page=2')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_page=2') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count correctly set' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="prev",/ ) >@@ -166,7 +172,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=4.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=3')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=3') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count header present, even without page param' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="prev",/, 'First page, no previous' ) >@@ -182,7 +189,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=4.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=-1')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=-1') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count header present, with per_page=-1' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="prev",/, 'First page, no previous' ) >@@ -191,14 +199,16 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_unlike( > 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="next",/, > 'No next page, all resources are fetched' >- )->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="first",/ ) >+ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=1.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=1.*>; rel="last"/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > >- $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=-1&_page=100')->status_is(200) >+ $t->get_ok('/pagination_headers?firstname=Jonathan&_per_page=-1&_page=100') >+ ->status_is(200) > ->header_is( 'X-Total-Count' => 10, 'X-Total-Count header present, with per_page=-1' ) > ->header_is( 'X-Base-Total-Count' => 12, 'X-Base-Total-Count correctly set' ) > ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="prev",/, 'First page, no previous' ) >@@ -207,7 +217,8 @@ subtest 'add_pagination_headers() tests' => sub { > ->header_unlike( > 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="next",/, > 'No next page, all resources are fetched' >- )->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="first",/ ) >+ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=1.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="first",/ ) > ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=-1.*>; rel="last"/ ) >@@ -221,6 +232,7 @@ subtest 'dbic_merge_pagination() tests' => sub { > > my $t = Test::Mojo->new; > >- $t->get_ok('/dbic_merge_pagination')->status_is(200) >+ $t->get_ok('/dbic_merge_pagination') >+ ->status_is(200) > ->json_is( { firstname => 'Kyle', surname => 'Hall', page => 1, rows => 3 } ); > }; >diff --git a/t/db_dependent/Koha/UI/Form/Builder/Item.t b/t/db_dependent/Koha/UI/Form/Builder/Item.t >index 2eab4bfcec1..6b6386a02d4 100755 >--- a/t/db_dependent/Koha/UI/Form/Builder/Item.t >+++ b/t/db_dependent/Koha/UI/Form/Builder/Item.t >@@ -83,7 +83,7 @@ subtest 'authorised values' => sub { > $subfield->{marc_value}->{values}, > [ > "", >- map { $_->authorised_value } >+ map { $_->authorised_value } > sort { $a->lib cmp $b->lib } $avs->as_list > ], > 'AVs are sorted by lib and en empty option is created first' >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index d9e4074a934..b63281e1782 100755 >--- a/t/db_dependent/Patrons.t >+++ b/t/db_dependent/Patrons.t >@@ -247,10 +247,12 @@ subtest "Update patron categories" => sub { > is( Koha::Patrons->search_patrons_to_update_category( { from => $c_categorycode, too_old => 1 } ) > ->next->borrowernumber, $child3->borrowernumber, 'Over age patron in child category is expected one' ); > is( Koha::Patrons->search( { branchcode => $branchcode2 } ) >- ->search_patrons_to_update_category( { from => $a_categorycode } )->count, 1, 'One patron in branch 2' ); >+ ->search_patrons_to_update_category( { from => $a_categorycode } ) >+ ->count, 1, 'One patron in branch 2' ); > is( > Koha::Patrons->search( { branchcode => $branchcode2 } ) >- ->search_patrons_to_update_category( { from => $a_categorycode } )->next->borrowernumber, >+ ->search_patrons_to_update_category( { from => $a_categorycode } ) >+ ->next->borrowernumber, > $adult2->borrowernumber, 'Adult patron in branch 2 is expected one' > ); > is( >@@ -344,7 +346,8 @@ subtest "Update patron categories" => sub { > > is( > Koha::Patrons->search_patrons_to_update_category( { from => $a_categorycode, fine_max => 5 } ) >- ->search( { "me.borrowernumber" => $adult1->borrowernumber } )->next->borrowernumber, >+ ->search( { "me.borrowernumber" => $adult1->borrowernumber } ) >+ ->next->borrowernumber, > $adult1->borrowernumber, 'Expected patron is in the list of patrons to update' > ); > my $userid_before = $adult1->userid; >diff --git a/t/db_dependent/Reserves/CancelExpiredReserves.t b/t/db_dependent/Reserves/CancelExpiredReserves.t >index 00664d18544..03b377c8faa 100755 >--- a/t/db_dependent/Reserves/CancelExpiredReserves.t >+++ b/t/db_dependent/Reserves/CancelExpiredReserves.t >@@ -130,7 +130,7 @@ subtest 'Test handling of waiting reserves by CancelExpiredReserves' => sub { > > my $resdate = dt_from_string->add( days => -20 ); > my $expdate = dt_from_string->add( days => -2 ); >- my $notexpdate = dt_from_string->add( days => 2 ); >+ my $notexpdate = dt_from_string->add( days => 2 ); > > my $hold1 = Koha::Hold->new( > { >diff --git a/t/db_dependent/SocialData.t b/t/db_dependent/SocialData.t >index dd9b9e064ae..7ce3d21ab27 100755 >--- a/t/db_dependent/SocialData.t >+++ b/t/db_dependent/SocialData.t >@@ -59,7 +59,8 @@ subtest 'get_report' => sub { > is( $report->{'without'}->[0]->{'isbn'}, '9780596526740', 'testing get_report' ); > > # test if we can get with key instead >- $schema->resultset('SocialData')->search( { isbn => '0-596-52674-1' } ) >+ $schema->resultset('SocialData') >+ ->search( { isbn => '0-596-52674-1' } ) > ->next->update( { isbn => '9780596526740' } ); > $report = C4::SocialData::get_report(); > is( $report->{with}->[0]->{isbn}, '9780596526740', 'this isbn has social data' ); >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index e6e554335cc..bf72e888fa6 100755 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -162,7 +162,8 @@ subtest 'Test FKs in overduerules_transport_type' => sub { > 'build stores the categorycode correctly' > ); > is( >- $schema->resultset('MessageTransportType')->find( $overduerules_transport_type->{message_transport_type} ) >+ $schema->resultset('MessageTransportType') >+ ->find( $overduerules_transport_type->{message_transport_type} ) > ->message_transport_type, > $overduerules_transport_type->{message_transport_type}, > 'build stores the foreign key message_transport_type correctly' >diff --git a/t/db_dependent/api/v1/acquisitions_baskets.t b/t/db_dependent/api/v1/acquisitions_baskets.t >index dfcca47b691..2edf2b2578d 100755 >--- a/t/db_dependent/api/v1/acquisitions_baskets.t >+++ b/t/db_dependent/api/v1/acquisitions_baskets.t >@@ -133,7 +133,9 @@ subtest 'add() tests' => sub { > > $t->post_ok( $url, json => {} )->status_is(400); > >- $t->post_ok( $url, json => { vendor_id => $vendor->id } )->status_is(201)->json_has('/basket_id') >+ $t->post_ok( $url, json => { vendor_id => $vendor->id } ) >+ ->status_is(201) >+ ->json_has('/basket_id') > ->json_is( '/vendor_id', $vendor->id ); > > my $basket = { >@@ -141,8 +143,11 @@ subtest 'add() tests' => sub { > name => 'Basket #1', > vendor_note => 'Vendor note', > }; >- $t->post_ok( $url, json => $basket )->status_is(201)->json_has('/basket_id') >- ->json_is( '/vendor_id', $basket->{vendor_id} )->json_is( '/name', $basket->{name} ) >+ $t->post_ok( $url, json => $basket ) >+ ->status_is(201) >+ ->json_has('/basket_id') >+ ->json_is( '/vendor_id', $basket->{vendor_id} ) >+ ->json_is( '/name', $basket->{name} ) > ->json_is( '/vendor_note', $basket->{vendor_note} ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/acquisitions_funds.t b/t/db_dependent/api/v1/acquisitions_funds.t >index 31a570b72f7..2764b655406 100755 >--- a/t/db_dependent/api/v1/acquisitions_funds.t >+++ b/t/db_dependent/api/v1/acquisitions_funds.t >@@ -81,7 +81,8 @@ $t->get_ok( "//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds?name=" > > $t->get_ok("//$userid:$password@/api/v1/acquisitions/funds")->status_is(200); > >-$t->get_ok( "//$userid:$password@/api/v1/acquisitions/funds?name=" . $fund_name )->status_is(200) >+$t->get_ok( "//$userid:$password@/api/v1/acquisitions/funds?name=" . $fund_name ) >+ ->status_is(200) > ->json_like( '/0/name' => qr/$fund_name/ ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/acquisitions_orders.t b/t/db_dependent/api/v1/acquisitions_orders.t >index 43ffe56766a..3393131df85 100755 >--- a/t/db_dependent/api/v1/acquisitions_orders.t >+++ b/t/db_dependent/api/v1/acquisitions_orders.t >@@ -81,7 +81,8 @@ subtest 'list() tests' => sub { > > # Make sure we are returned with the correct amount of orders > $t->get_ok("//$userid:$password@/api/v1/acquisitions/orders?status=new&_per_page=-1") >- ->status_is( 200, 'REST3.2.2' )->json_has( '/' . ( $count_of_orders - 1 ) . '/order_id' ) >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_has( '/' . ( $count_of_orders - 1 ) . '/order_id' ) > ->json_hasnt( '/' . ($count_of_orders) . '/order_id' ); > > subtest 'query parameters' => sub { >@@ -146,7 +147,8 @@ subtest 'list() tests' => sub { > is( scalar @{ $result->tx->res->json }, 1, 'Only one order is active' ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/orders?order_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/orders?order_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/order_blah', message => 'Malformed query string' } ] ); > > subtest 'sorting tests' => sub { >@@ -184,7 +186,8 @@ subtest 'list() tests' => sub { > my $result = > $t->get_ok( > "//$userid:$password@/api/v1/acquisitions/orders?_order_by=+me.order_id&basket_id=" . $basket->id ) >- ->status_is( 200, "query successful" )->tx->res->json; >+ ->status_is( 200, "query successful" ) >+ ->tx->res->json; > > is( scalar @$result, 2, 'Two elements returned' ); > >@@ -195,7 +198,8 @@ subtest 'list() tests' => sub { > $result = > $t->get_ok( > "//$userid:$password@/api/v1/acquisitions/orders?_order_by=-me.order_id&basket_id=" . $basket->id ) >- ->status_is( 200, "query successful" )->tx->res->json; >+ ->status_is( 200, "query successful" ) >+ ->tx->res->json; > > is( scalar @$result, 2, 'Two elements returned' ); > >@@ -255,12 +259,14 @@ subtest 'get() tests' => sub { > my $userid = $patron->userid; > > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) >- ->status_is( 200, 'REST3.2.2' )->json_is( '' => $order->to_api, 'REST3.3.2' ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '' => $order->to_api, 'REST3.3.2' ); > > my $non_existent_order_id = $order->ordernumber; > $order->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders/" . $non_existent_order_id )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders/" . $non_existent_order_id ) >+ ->status_is(404) > ->json_is( '/error' => 'Order not found' ); > > # FIXME This does not work on all the OS we support >@@ -336,7 +342,8 @@ subtest 'add() tests' => sub { > $order_with_invalid_field->{'orderinvalid'} = 'Order invalid'; > > $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: orderinvalid.", >@@ -347,7 +354,8 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order ) >- ->status_is( 201, 'REST3.2.1' )->json_is( '/internal_note' => $order->{internal_note}, 'REST3.3.1' ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_is( '/internal_note' => $order->{internal_note}, 'REST3.3.1' ) > ->header_like( Location => qr/\/api\/v1\/acquisitions\/orders\/\d*/, 'REST3.4.1' ); > > # save the order_id >@@ -356,14 +364,16 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with null id > $order->{order_id} = undef; > >- $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $order->{order_id} = $order_id; > > warning_like { >- $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order )->status_is(409) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order ) >+ ->status_is(409) > ->json_has( '/error' => "Fails when trying to add an existing order_id" ) > ->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); > } >@@ -437,14 +447,16 @@ subtest 'update() tests' => sub { > $deleted_library->delete; > > $t->put_ok( "//$auth_userid:$password@/api/v1/libraries/$library_id" => json => $library_with_updated_field ) >- ->status_is( 200, 'REST3.2.1' )->json_is( '' => $library_with_updated_field, 'REST3.3.3' ); >+ ->status_is( 200, 'REST3.2.1' ) >+ ->json_is( '' => $library_with_updated_field, 'REST3.3.3' ); > > # Authorized attempt to write invalid data > my $library_with_invalid_field = {%$library_with_updated_field}; > $library_with_invalid_field->{'branchinvalid'} = 'Library invalid'; > > $t->put_ok( "//$auth_userid:$password@/api/v1/libraries/$library_id" => json => $library_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: branchinvalid.", >@@ -494,7 +506,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(409); > $order->orderstatus('cancelled')->store; > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(404); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/acquisitions_vendor_issues.t b/t/db_dependent/api/v1/acquisitions_vendor_issues.t >index 77d3fe52d58..708b32e3892 100755 >--- a/t/db_dependent/api/v1/acquisitions_vendor_issues.t >+++ b/t/db_dependent/api/v1/acquisitions_vendor_issues.t >@@ -64,13 +64,15 @@ subtest 'list() tests' => sub { > )->store; > > # One issue created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors/$vendor_id/issues")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors/$vendor_id/issues") >+ ->status_is(200) > ->json_is( [ $issue->to_api ] ); > > # Embed the AV description > $t->get_ok( > "//$userid:$password@/api/v1/acquisitions/vendors/$vendor_id/issues" => { 'x-koha-embed' => '+strings' } ) >- ->status_is(200)->json_is( [ $issue->to_api( { strings => 1 } ) ] ); >+ ->status_is(200) >+ ->json_is( [ $issue->to_api( { strings => 1 } ) ] ); > > $vendor->delete; > >diff --git a/t/db_dependent/api/v1/acquisitions_vendors.t b/t/db_dependent/api/v1/acquisitions_vendors.t >index 411e5990887..c0ccf60bdf6 100755 >--- a/t/db_dependent/api/v1/acquisitions_vendors.t >+++ b/t/db_dependent/api/v1/acquisitions_vendors.t >@@ -63,31 +63,39 @@ subtest 'list() and delete() tests | authorized user' => sub { > $builder->build_object( { class => 'Koha::Acquisition::Booksellers', value => { name => $vendor_name } } ); > > # One vendor created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors") >+ ->status_is(200) > ->json_like( '/0/name' => qr/$vendor_name/ ); > > my $other_vendor_name = 'Amerindia'; > my $other_vendor = $builder->build_object( > { class => 'Koha::Acquisition::Booksellers', value => { name => $other_vendor_name } } ); > >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors")->status_is(200)->json_like( '/0/name' => qr/Ruben/ ) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors") >+ ->status_is(200) >+ ->json_like( '/0/name' => qr/Ruben/ ) > ->json_like( '/1/name' => qr/Amerindia/ ); > >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors?name=$vendor_name")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors?name=$vendor_name") >+ ->status_is(200) > ->json_like( '/0/name' => qr/Ruben/ ); > >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors?name=$other_vendor_name")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/vendors?name=$other_vendor_name") >+ ->status_is(200) > ->json_like( '/0/name' => qr/Amerindia/ ); > > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors?accountnumber=" . $vendor->accountnumber ) >- ->status_is(200)->json_like( '/0/name' => qr/Ruben/ ); >+ ->status_is(200) >+ ->json_like( '/0/name' => qr/Ruben/ ); > > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors?accountnumber=" . $other_vendor->accountnumber ) >- ->status_is(200)->json_like( '/0/name' => qr/Amerindia/ ); >+ ->status_is(200) >+ ->json_like( '/0/name' => qr/Amerindia/ ); > > my @aliases = ( { alias => 'alias 1' }, { alias => 'alias 2' } ); > $vendor->aliases( \@aliases ); >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" => { 'x-koha-embed' => 'aliases' } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" => { 'x-koha-embed' => 'aliases' } ) >+ ->status_is(200) > ->json_has( '/0/aliases', 'aliases are embedded' ) > ->json_is( '/0/aliases/0/alias' => 'alias 1', 'alias 1 is embedded' ) > ->json_is( '/0/aliases/1/alias' => 'alias 2', 'alias 2 is embedded' ); >@@ -104,7 +112,8 @@ subtest 'list() and delete() tests | authorized user' => sub { > { class => 'Koha::Acquisition::Invoices', value => { booksellerid => $vendor->id } } ); > } > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" => >- { 'x-koha-embed' => 'subscriptions+count,baskets+count,invoices+count' } )->status_is(200) >+ { 'x-koha-embed' => 'subscriptions+count,baskets+count,invoices+count' } ) >+ ->status_is(200) > ->json_is( '/0/subscriptions_count', 2, 'subscriptions_count is 2' ) > ->json_is( '/0/baskets_count', 2, 'baskets_count is 2' ) > ->json_is( '/0/invoices_count', 2, 'invoices_count is 2' ); >@@ -113,7 +122,8 @@ subtest 'list() and delete() tests | authorized user' => sub { > # A vendor deletion should be rejected if it has baskets or subscriptions (or invoices?) linked to it > $_->delete for @cleanup; > >- $t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $other_vendor->id )->status_is(200); >@@ -143,22 +153,26 @@ subtest 'get() test' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id ) >+ ->status_is(200) > ->json_is( $vendor->to_api ); > > $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => { 'x-koha-embed' => 'subscriptions+count,baskets+count,invoices+count' } )->status_is(200) >+ . $vendor->id => { 'x-koha-embed' => 'subscriptions+count,baskets+count,invoices+count' } ) >+ ->status_is(200) > ->json_has( '/subscriptions_count', 'subscriptions_count is embedded' ) > ->json_has( '/baskets_count', 'baskets_count is embedded' ) > ->json_has( '/invoices_count', 'invoices_count is embedded' ); > >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $non_existent_id )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $non_existent_id ) >+ ->status_is(404) > ->json_is( '/error' => 'Vendor not found' ); > > # remove permissions > $patron->set( { flags => 0 } )->store; > >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )->status_is(403) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id ) >+ ->status_is(403) > ->json_is( '/error', 'Authorization failure. Missing required permission(s).' ); > > $schema->storage->txn_rollback; >@@ -201,7 +215,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: address5.", >@@ -214,14 +229,16 @@ subtest 'add() tests' => sub { > $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) > ->status_is( 201, 'REST3 .2.1' ) > ->header_like( Location => qr|^\/api\/v1\/acquisitions\/vendors/\d*|, 'REST3.4.1' ) >- ->json_is( '/name' => $vendor->{name} )->json_is( '/address1' => $vendor->{address1} ); >+ ->json_is( '/name' => $vendor->{name} ) >+ ->json_is( '/address1' => $vendor->{address1} ); > > # read the response vendor id for later use > my $vendor_id = $t->tx->res->json('/id'); > > # Authorized attempt to create with null id > $vendor->{id} = undef; >- $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id >@@ -237,37 +254,53 @@ subtest 'add() tests' => sub { > > subtest 'relationships contracts, interfaces, aliases' => sub { > plan tests => 32; >- my $vendor = { name => 'another vendor', contacts => [], interfaces => [], aliases => [] }; >- my $vendor_id = $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) >- ->status_is( 201, 'REST3 .2.1' )->json_is( '/name' => $vendor->{name} ) >+ my $vendor = { name => 'another vendor', contacts => [], interfaces => [], aliases => [] }; >+ my $vendor_id = >+ $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) >+ ->status_is( 201, 'REST3 .2.1' ) >+ ->json_is( '/name' => $vendor->{name} ) > > # FIXME Maybe we expect instead > # ->json_is( '/contacts' => [] )->json_is('/interfaces' => [], '/aliases' => [] ); > ->json_hasnt('/contacts')->json_hasnt('/interfaces')->json_hasnt('/aliases')->tx->res->json->{id}; >- $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor_id )->status_is(200) >- ->json_hasnt('/contacts')->json_hasnt('/interfaces')->json_hasnt('/aliases'); >+ $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor_id ) >+ ->status_is(200) >+ ->json_hasnt('/contacts') >+ ->json_hasnt('/interfaces') >+ ->json_hasnt('/aliases'); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor_id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_is( '/contacts', [] )->json_is( '/interfaces', [] )->json_is( '/aliases', [] ); >+ . $vendor_id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_is( '/contacts', [] ) >+ ->json_is( '/interfaces', [] ) >+ ->json_is( '/aliases', [] ); > > $vendor = { > name => 'yet another vendor', contacts => [ { name => 'contact name' } ], > interfaces => [ { name => 'interface name' } ], aliases => [ { alias => 'foo' } ] > }; >- $vendor_id = $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) >- ->status_is( 201, 'REST3 .2.1' )->json_is( '/name' => $vendor->{name} ) >+ $vendor_id = >+ $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors" => json => $vendor ) >+ ->status_is( 201, 'REST3 .2.1' ) >+ ->json_is( '/name' => $vendor->{name} ) > > # FIXME Maybe we expect instead > # ->json_is( '/contacts' => [] )->json_is('/interfaces' => [], '/aliases' => [] ); > ->json_hasnt('/contacts')->json_hasnt('/interfaces')->json_hasnt('/aliases')->tx->res->json->{id}; > >- $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor_id )->status_is(200) >- ->json_hasnt('/contacts')->json_hasnt('/interfaces')->json_hasnt('/aliases'); >+ $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor_id ) >+ ->status_is(200) >+ ->json_hasnt('/contacts') >+ ->json_hasnt('/interfaces') >+ ->json_hasnt('/aliases'); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor_id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_has('/contacts/0/name')->json_has('/interfaces/0/name')->json_has('/aliases/0/alias'); >+ . $vendor_id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_has('/contacts/0/name') >+ ->json_has('/interfaces/0/name') >+ ->json_has('/aliases/0/alias'); > }; > > $schema->storage->txn_rollback; >@@ -308,7 +341,8 @@ subtest 'update() tests' => sub { > my $vendor_without_mandatory_field = { address1 => 'New address' }; > > $t->put_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => json => $vendor_without_mandatory_field )->status_is(400) >+ . $vendor->id => json => $vendor_without_mandatory_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT >@@ -316,7 +350,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id => json => $vendor_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'London books' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'London books' ); > > # Authorized attempt to write invalid data > my $vendor_with_invalid_field = { >@@ -328,7 +363,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id => json => $vendor_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -357,8 +393,11 @@ subtest 'update() tests' => sub { > $vendor->aliases( [] ); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_is( '/contacts', [] )->json_is( '/interfaces', [] )->json_is( '/aliases', [] ); >+ . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_is( '/contacts', [] ) >+ ->json_is( '/interfaces', [] ) >+ ->json_is( '/aliases', [] ); > > my $api_vendor = $vendor->to_api; > delete $api_vendor->{id}; >@@ -368,12 +407,18 @@ subtest 'update() tests' => sub { > $api_vendor->{aliases} = [ { alias => 'foo' } ]; > > $t->put_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id => json => $api_vendor ) >- ->status_is( 200, 'REST3 .2.1' )->json_is( '/name' => $vendor->name )->json_hasnt('/contacts') >- ->json_hasnt('/interfaces')->json_hasnt('/aliases'); >+ ->status_is( 200, 'REST3 .2.1' ) >+ ->json_is( '/name' => $vendor->name ) >+ ->json_hasnt('/contacts') >+ ->json_hasnt('/interfaces') >+ ->json_hasnt('/aliases'); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_has('/contacts/0/name')->json_has('/interfaces/0/name')->json_has('/aliases/0/alias'); >+ . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_has('/contacts/0/name') >+ ->json_has('/interfaces/0/name') >+ ->json_has('/aliases/0/alias'); > > delete $api_vendor->{contacts}; > delete $api_vendor->{interfaces}; >@@ -383,8 +428,11 @@ subtest 'update() tests' => sub { > ->status_is( 200, 'REST3 .2.1' ); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_has('/contacts/0/name')->json_has('/interfaces/0/name')->json_has('/aliases/0/alias'); >+ . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_has('/contacts/0/name') >+ ->json_has('/interfaces/0/name') >+ ->json_has('/aliases/0/alias'); > > $api_vendor->{contacts} = []; > $api_vendor->{interfaces} = []; >@@ -394,8 +442,11 @@ subtest 'update() tests' => sub { > ->status_is( 200, 'REST3 .2.1' ); > > $t->get_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" >- . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } )->status_is(200) >- ->json_is( '/contacts', [] )->json_is( '/interfaces', [] )->json_is( '/aliases', [] ); >+ . $vendor->id => { 'x-koha-embed' => 'contacts,interfaces,aliases' } ) >+ ->status_is(200) >+ ->json_is( '/contacts', [] ) >+ ->json_is( '/interfaces', [] ) >+ ->json_is( '/aliases', [] ); > }; > > $schema->storage->txn_rollback; >@@ -452,7 +503,8 @@ subtest 'delete() tests' => sub { > $invoice->delete; > > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )->status_is(404); > >diff --git a/t/db_dependent/api/v1/additional_contents.t b/t/db_dependent/api/v1/additional_contents.t >index c11e1636c22..91c3632a78e 100755 >--- a/t/db_dependent/api/v1/additional_contents.t >+++ b/t/db_dependent/api/v1/additional_contents.t >@@ -43,7 +43,7 @@ subtest 'anonymous access' => sub { > > my $today = dt_from_string; > my $yesterday = dt_from_string->add( days => -1 ); >- my $tomorrow = dt_from_string->add( days => 1 ); >+ my $tomorrow = dt_from_string->add( days => 1 ); > my $res; > > $builder->build_object( >@@ -104,7 +104,8 @@ subtest 'anonymous access' => sub { > > is( scalar @{$res}, 1, 'There is now one active and public additional content' ); > >- $t->get_ok( "/api/v1/public/additional_contents" => { 'x-koha-embed' => 'translated_contents' } )->status_is(200) >+ $t->get_ok( "/api/v1/public/additional_contents" => { 'x-koha-embed' => 'translated_contents' } ) >+ ->status_is(200) > ->json_is( > '/0' => { > %{ $public_additional_contents->to_api( { public => 1 } ) }, >@@ -142,7 +143,7 @@ subtest 'anonymous access' => sub { > %{ $public_additional_contents->to_api( { public => 1 } ) }, > translated_contents => $public_additional_contents->translated_contents->to_api( { public => 1 } ) > } >- )->json_hasnt('/1'); >+ )->json_hasnt('/1'); > > $t->get_ok( "/api/v1/public/additional_contents?q={\"translated_contents.lang\": \"fr-FR\"}" => > { 'x-koha-embed' => 'translated_contents' } )->status_is(200)->json_is( >@@ -150,7 +151,7 @@ subtest 'anonymous access' => sub { > %{ $second_public_additional_contents->to_api( { public => 1 } ) }, > translated_contents => $second_public_additional_contents->translated_contents->to_api( { public => 1 } ) > } >- )->json_hasnt('/1'); >+ )->json_hasnt('/1'); > > $schema->storage->txn_rollback; > >diff --git a/t/db_dependent/api/v1/advanced_editor_macros.t b/t/db_dependent/api/v1/advanced_editor_macros.t >index 98b08c84c30..4542bf6d35d 100755 >--- a/t/db_dependent/api/v1/advanced_editor_macros.t >+++ b/t/db_dependent/api/v1/advanced_editor_macros.t >@@ -105,26 +105,34 @@ subtest 'list() tests' => sub { > ->count - 1; > ## Authorized user tests > # Make sure we are returned with the correct amount of macros >- $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros")->status_is( 200, 'REST3.2.2' ) >- ->json_has( '/' . $macros_index . '/macro_id' )->json_hasnt( '/' . ( $macros_index + 1 ) . '/macro_id' ); >+ $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros") >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_has( '/' . $macros_index . '/macro_id' ) >+ ->json_hasnt( '/' . ( $macros_index + 1 ) . '/macro_id' ); > > subtest 'query parameters' => sub { > > plan tests => 15; >- $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros?name=" . $macro_2->name )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros?name=" . $macro_2->name ) >+ ->status_is(200) > ->json_is( [ $macro_2->to_api ] ); >- $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros?name=" . $macro_3->name )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros?name=" . $macro_3->name ) >+ ->status_is(200) > ->json_is( [] ); >- $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?macro_text=delete%20100")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?macro_text=delete%20100") >+ ->status_is(200) > ->json_is( [ $macro_1->to_api, $macro_2->to_api, $macro_4->to_api ] ); > $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros?patron_id=" . $patron_1->borrowernumber ) >- ->status_is(200)->json_is( [ $macro_1->to_api, $macro_2->to_api ] ); >- $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?shared=1")->status_is(200) >+ ->status_is(200) >+ ->json_is( [ $macro_1->to_api, $macro_2->to_api ] ); >+ $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?shared=1") >+ ->status_is(200) > ->json_is( [ $macro_2->to_api, $macro_4->to_api ] ); > }; > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?macro_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/advanced_editor/macros?macro_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/macro_blah', message => 'Malformed query string' } ] ); > > }; >@@ -174,19 +182,22 @@ subtest 'get() tests' => sub { > ->json_is( '/error' => 'This macro is shared, you must access it via advanced_editor/macros/shared' ); > > $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros/shared/" . $macro_1->id ) >- ->status_is( 200, 'Can get a shared macro via shared endpoint' )->json_is( $macro_1->to_api ); >+ ->status_is( 200, 'Can get a shared macro via shared endpoint' ) >+ ->json_is( $macro_1->to_api ); > > $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros/" . $macro_2->id ) > ->status_is( 403, 'Cannot access another users macro' ) > ->json_is( '/error' => 'You do not have permission to access this macro' ); > > $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros/" . $macro_3->id ) >- ->status_is( 200, 'Can get your own private macro' )->json_is( $macro_3->to_api ); >+ ->status_is( 200, 'Can get your own private macro' ) >+ ->json_is( $macro_3->to_api ); > > my $non_existent_code = $macro_1->id; > $macro_1->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros/" . $non_existent_code )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/advanced_editor/macros/" . $non_existent_code ) >+ ->status_is(404) > ->json_is( '/error' => 'Macro not found' ); > > }; >@@ -243,7 +254,8 @@ subtest 'add() tests' => sub { > $macro_with_invalid_field->{'big_mac_ro'} = 'Mac attack'; > > $t->post_ok( "//$auth_userid:$password@/api/v1/advanced_editor/macros" => json => $macro_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: big_mac_ro.", >@@ -254,7 +266,8 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > $t->post_ok( "//$auth_userid:$password@/api/v1/advanced_editor/macros" => json => $macro_values ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '/macro_id', 'We generated a new id' ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '/macro_id', 'We generated a new id' ) > ->json_is( '/name' => $macro_values->{name}, 'The name matches what we supplied' ) > ->json_is( '/macro_text' => $macro_values->{macro_text}, 'The text matches what we supplied' ) > ->json_is( '/patron_id' => $macro_values->{patron_id}, 'The borrower matches the borrower who submitted' ) >@@ -267,7 +280,8 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with existing id > $macro_values->{macro_id} = $macro_id; > >- $t->post_ok( "//$auth_userid:$password@/api/v1/advanced_editor/macros" => json => $macro_values )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/advanced_editor/macros" => json => $macro_values ) >+ ->status_is(400) > ->json_is( > '/errors' => [ > { >@@ -368,7 +382,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$auth_userid:$password@/api/v1/advanced_editor/macros/$macro_id" => json => $macro_with_missing_field ) >- ->status_is(400)->json_has( "/errors" => [ { message => "Missing property.", path => "/body/macro_text" } ] ); >+ ->status_is(400) >+ ->json_has( "/errors" => [ { message => "Missing property.", path => "/body/macro_text" } ] ); > > my $macro_update = { > name => "Macro-update", >@@ -422,7 +437,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$auth_userid:$password@/api/v1/advanced_editor/macros/$macro_id" => json => $macro_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: big_mac_ro.", >diff --git a/t/db_dependent/api/v1/article_requests.t b/t/db_dependent/api/v1/article_requests.t >index 0a798721bfe..db76bf0d2ff 100755 >--- a/t/db_dependent/api/v1/article_requests.t >+++ b/t/db_dependent/api/v1/article_requests.t >@@ -52,7 +52,8 @@ subtest 'cancel() tests' => sub { > my $deleted_article_request_id = $deleted_article_request->id; > $deleted_article_request->delete; > >- $t->delete_ok("//$userid:$password@/api/v1/article_requests/$deleted_article_request_id")->status_is(404) >+ $t->delete_ok("//$userid:$password@/api/v1/article_requests/$deleted_article_request_id") >+ ->status_is(404) > ->json_is( '/error_code' => 'not_found' ); > > my $article_request = $builder->build_object( >@@ -67,7 +68,8 @@ subtest 'cancel() tests' => sub { > > $t->delete_ok( "//$userid:$password@/api/v1/article_requests/" > . $article_request->id >- . "?cancellation_reason=$reason¬es=$notes" )->status_is( 204, 'REST3.2.4' ) >+ . "?cancellation_reason=$reason¬es=$notes" ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( q{}, 'REST3.2.4' ); > > # refresh object >@@ -109,7 +111,8 @@ subtest 'patron_cancel() tests' => sub { > > # delete non existent article request > $t->delete_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/$deleted_article_request_id") >- ->status_is(404)->json_is( '/error_code' => 'not_found' ); >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ); > > my $another_patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $another_patron_id = $another_patron->id; >@@ -119,12 +122,14 @@ subtest 'patron_cancel() tests' => sub { > > # delete another patron's request when unauthorized > $t->delete_ok( "/api/v1/public/patrons/$another_patron_id/article_requests/" . $article_request_2->id ) >- ->status_is(401)->json_is( '/error' => "Authentication failure." ); >+ ->status_is(401) >+ ->json_is( '/error' => "Authentication failure." ); > > # delete another patron's request > $t->delete_ok( > "//$userid:$password@/api/v1/public/patrons/$another_patron_id/article_requests/" . $article_request_2->id ) >- ->status_is(403)->json_is( '/error' => "Unprivileged user cannot access another user's resources" ); >+ ->status_is(403) >+ ->json_is( '/error' => "Unprivileged user cannot access another user's resources" ); > > my $another_article_request = $builder->build_object( > { >@@ -135,7 +140,8 @@ subtest 'patron_cancel() tests' => sub { > > $t->delete_ok( > "//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/" . $another_article_request->id ) >- ->status_is(404)->json_is( '/error_code' => 'not_found' ); >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ); > > my $article_request = $builder->build_object( > { >@@ -149,7 +155,8 @@ subtest 'patron_cancel() tests' => sub { > > $t->delete_ok( "//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/" > . $article_request->id >- . "?cancellation_reason=$reason¬es=$notes" )->status_is( 204, 'REST3.2.4' ) >+ . "?cancellation_reason=$reason¬es=$notes" ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( q{}, 'REST3.2.4' ); > > # refresh object >diff --git a/t/db_dependent/api/v1/auth.t b/t/db_dependent/api/v1/auth.t >index cece374616b..4a4fab923b0 100755 >--- a/t/db_dependent/api/v1/auth.t >+++ b/t/db_dependent/api/v1/auth.t >@@ -51,7 +51,8 @@ subtest 'under() tests' => sub { > t::lib::Mocks::mock_preference( 'RESTPublicAPI', 0 ); > $tx = $t->ua->build_tx( POST => "/api/v1/public/patrons/$borrowernumber/password" ); > $tx->req->env( { REMOTE_ADDR => $remote_address } ); >- $t->request_ok($tx)->status_is(403) >+ $t->request_ok($tx) >+ ->status_is(403) > ->json_is( '/error', 'Configuration prevents the usage of this endpoint by unprivileged users' ); > > # enable the /public namespace >diff --git a/t/db_dependent/api/v1/auth_authenticate_api_request.t b/t/db_dependent/api/v1/auth_authenticate_api_request.t >index 018a545e388..d918f193782 100755 >--- a/t/db_dependent/api/v1/auth_authenticate_api_request.t >+++ b/t/db_dependent/api/v1/auth_authenticate_api_request.t >@@ -68,8 +68,11 @@ subtest 'token-based tests' => sub { > client_id => $api_key->client_id, > client_secret => $api_key->plain_text_secret > }; >- $t->post_ok( '/api/v1/oauth/token', form => $formData )->status_is(200)->json_is( '/expires_in' => 3600 ) >- ->json_is( '/token_type' => 'Bearer' )->json_has('/access_token'); >+ $t->post_ok( '/api/v1/oauth/token', form => $formData ) >+ ->status_is(200) >+ ->json_is( '/expires_in' => 3600 ) >+ ->json_is( '/token_type' => 'Bearer' ) >+ ->json_has('/access_token'); > > my $access_token = $t->tx->res->json->{access_token}; > >@@ -167,7 +170,8 @@ subtest 'cookie-based tests' => sub { > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => $remote_address } ); > >- $t->request_ok($tx)->status_is( 401, 'Anonymous session on permission protected resource returns 401' ) >+ $t->request_ok($tx) >+ ->status_is( 401, 'Anonymous session on permission protected resource returns 401' ) > ->json_is( { error => 'Authentication failure.' } ); > }; > >@@ -259,7 +263,8 @@ subtest 'x-koha-library tests' => sub { > is( $userenv->{branch}, $unprivileged->branchcode, 'branch set correctly' ); > > $t->get_ok( "//$unprivileged_userid:$password@/api/v1/cities" => { 'x-koha-library' => $library->id } ) >- ->status_is(403)->json_is( '/error' => 'Unauthorized attempt to set library to ' . $library->id ); >+ ->status_is(403) >+ ->json_is( '/error' => 'Unauthorized attempt to set library to ' . $library->id ); > > $t->get_ok( "//$superlibrarian_userid:$password@/api/v1/cities" => { 'x-koha-library' => $library->id } ) > ->status_is(200); >diff --git a/t/db_dependent/api/v1/auth_basic.t b/t/db_dependent/api/v1/auth_basic.t >index 447fcc4567f..de0c81b7c4d 100755 >--- a/t/db_dependent/api/v1/auth_basic.t >+++ b/t/db_dependent/api/v1/auth_basic.t >@@ -78,7 +78,8 @@ subtest 'success tests' => sub { > $patron->flags(undef)->store; > > $t->get_ok("//$userid:$password@/api/v1/patrons") >- ->status_is( 403, 'Successful authentication and not enough permissions' )->json_is( >+ ->status_is( 403, 'Successful authentication and not enough permissions' ) >+ ->json_is( > '/error' => 'Authorization failure. Missing required permission(s).', > 'Error message returned' > ); >@@ -103,7 +104,8 @@ subtest 'success tests' => sub { > $patron->flags(undef)->store; > > $t->get_ok("//$cardnumber:$password@/api/v1/patrons") >- ->status_is( 403, 'Successful authentication and not enough permissions' )->json_is( >+ ->status_is( 403, 'Successful authentication and not enough permissions' ) >+ ->json_is( > '/error' => 'Authorization failure. Missing required permission(s).', > 'Error message returned' > ); >@@ -133,17 +135,20 @@ subtest 'failure tests' => sub { > # expire patron's password > $patron->password_expiration_date( dt_from_string->subtract( days => 1 ) )->store; > >- $t->get_ok("//$userid:$password@/api/v1/patrons")->status_is(403) >+ $t->get_ok("//$userid:$password@/api/v1/patrons") >+ ->status_is(403) > ->json_is( '/error' => 'Password has expired', 'Password expired' ); > > $t->get_ok("//@/api/v1/patrons")->status_is( 401, 'No credentials passed' ); > >- $t->get_ok("//$userid:$bad_password@/api/v1/patrons")->status_is( 403, 'Failed authentication, invalid password' ) >+ $t->get_ok("//$userid:$bad_password@/api/v1/patrons") >+ ->status_is( 403, 'Failed authentication, invalid password' ) > ->json_is( '/error' => 'Invalid password', 'Error message returned' ); > > t::lib::Mocks::mock_preference( 'RESTBasicAuth', 0 ); > >- $t->get_ok("//$userid:$password@/api/v1/patrons")->status_is( 401, 'Basic authentication is disabled' ) >+ $t->get_ok("//$userid:$password@/api/v1/patrons") >+ ->status_is( 401, 'Basic authentication is disabled' ) > ->json_is( '/error' => 'Basic authentication disabled', 'Expected error message rendered' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/authorised_values.t b/t/db_dependent/api/v1/authorised_values.t >index adc17215edc..db8308a38e8 100755 >--- a/t/db_dependent/api/v1/authorised_values.t >+++ b/t/db_dependent/api/v1/authorised_values.t >@@ -63,19 +63,22 @@ subtest 'list_av_from_category() tests' => sub { > > ## Authorized user tests > # No category, 404 expected >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/authorised_values")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/authorised_values") >+ ->status_is(404) > ->json_is( '/error' => 'Category not found' ); > > my $av_cat = $builder->build_object( { class => 'Koha::AuthorisedValueCategories' } )->category_name; > > # No AVs, so empty array should be returned >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") >+ ->status_is(200) > ->json_is( [] ); > > my $av = $builder->build_object( { class => 'Koha::AuthorisedValues', value => { category => $av_cat } } ); > > # One av created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") >+ ->status_is(200) > ->json_is( [ $av->to_api ] ); > > # Unauthorized access >@@ -88,13 +91,15 @@ subtest 'list_av_from_category() tests' => sub { > my $av_cat_3 = > $builder->build_object( { class => 'Koha::AuthorisedValueCategories', value => { category_name => 'cat_b' } } ); > my $query = { "me.category_name" => [ $av_cat_2->category_name, $av_cat_3->category_name ] }; >- $t->get_ok( "//$userid:$password@/api/v1/authorised_value_categories?q=" . encode_json($query) )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/authorised_value_categories?q=" . encode_json($query) ) >+ ->status_is(200) > ->json_is( [ $av_cat_2->to_api, $av_cat_3->to_api ] ); > > # Test the above but with x-koha-embed: authorised_values > my $embedded_query = { "me.category_name" => [ $av_cat_2->category_name, $av_cat_3->category_name ] }; > $t->get_ok( "//$userid:$password@/api/v1/authorised_value_categories?q=" >- . encode_json($embedded_query) => { 'x-koha-embed' => 'authorised_values' } )->status_is(200) >+ . encode_json($embedded_query) => { 'x-koha-embed' => 'authorised_values' } ) >+ ->status_is(200) > ->json_has( '/0/authorised_values', 'authorised_values object correctly embedded' ) > ->json_has( '/1/authorised_values', 'authorised_values object correctly embedded' ) > ->json_hasnt( '/2/', 'authorised_values object correctly embedded' ); >diff --git a/t/db_dependent/api/v1/authorities.t b/t/db_dependent/api/v1/authorities.t >index 72f6874c6c7..11e9aab5a84 100755 >--- a/t/db_dependent/api/v1/authorities.t >+++ b/t/db_dependent/api/v1/authorities.t >@@ -84,7 +84,8 @@ subtest 'get() tests' => sub { > ->status_is(400); > > $t->get_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id => { Accept => 'application/json' } ) >- ->status_is(200)->json_is( '/authority_id', $authority->id ) >+ ->status_is(200) >+ ->json_is( '/authority_id', $authority->id ) > ->json_is( '/framework_id', $authority->authtypecode ); > > $t->get_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id => { Accept => 'application/marcxml+xml' } ) >@@ -98,7 +99,8 @@ subtest 'get() tests' => sub { > ->status_is(200); > > $t->get_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id => { Accept => 'text/plain' } ) >- ->status_is(200)->content_is( >+ ->status_is(200) >+ ->content_is( > q|LDR 00079 2200049 4500 > 001 1001 > 110 _9102 >@@ -107,7 +109,8 @@ subtest 'get() tests' => sub { > > $authority->delete; > $t->get_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id => { Accept => 'application/marc' } ) >- ->status_is(404)->json_is( '/error', 'Authority record not found' ); >+ ->status_is(404) >+ ->json_is( '/error', 'Authority record not found' ); > > $schema->storage->txn_rollback; > }; >@@ -149,7 +152,8 @@ subtest 'delete() tests' => sub { > > $patron->flags( 2**14 )->store; # 14 => editauthorities userflag > >- $t->delete_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok( "//$userid:$password@/api/v1/authorities/" . $authority->id )->status_is(404); >@@ -214,7 +218,8 @@ subtest 'post() tests' => sub { > { 'Content-Type' => 'application/marc-in-json', 'x-authority-type' => 'CORPO_NAME' } => $mij ) > ->status_is(409) > ->header_exists_not( 'Location', 'Location header is only set when the new resource is created' ) >- ->json_like( '/error' => qr/Duplicate record (\d*)/ )->json_is( '/error_code' => q{duplicate} ); >+ ->json_like( '/error' => qr/Duplicate record (\d*)/ ) >+ ->json_is( '/error_code' => q{duplicate} ); > > $t->post_ok( > "//$userid:$password@/api/v1/authorities" => { >@@ -308,7 +313,8 @@ subtest 'put() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/authorities/$authid" => > { 'Content-Type' => 'application/marcxml+xml', 'x-authority-type' => $authtypecode } => $marcxml ) >- ->status_is(200)->json_has('/id'); >+ ->status_is(200) >+ ->json_has('/id'); > > $authority = Koha::Authorities->find($authid); > $record = $authority->record; >@@ -318,7 +324,8 @@ subtest 'put() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/authorities/$authid" => > { 'Content-Type' => 'application/marc-in-json', 'x-authority-type' => $authtypecode } => $mij ) >- ->status_is(200)->json_has('/id'); >+ ->status_is(200) >+ ->json_has('/id'); > > $authority = Koha::Authorities->find($authid); > $record = $authority->record; >@@ -327,7 +334,8 @@ subtest 'put() tests' => sub { > is( $subfield_a, 'MIJ' ); > > $t->put_ok( "//$userid:$password@/api/v1/authorities/$authid" => >- { 'Content-Type' => 'application/marc', 'x-authority-type' => $authtypecode } => $marc )->status_is(200) >+ { 'Content-Type' => 'application/marc', 'x-authority-type' => $authtypecode } => $marc ) >+ ->status_is(200) > ->json_has('/id'); > > $authority = Koha::Authorities->find($authid); >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index 0e84d86e031..8ea4c18b393 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -81,7 +81,8 @@ subtest 'get() tests' => sub { > ->status_is(400); > > $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/json' } ) >- ->status_is(200)->json_is( '/title', 'The unbearable lightness of being' ) >+ ->status_is(200) >+ ->json_is( '/title', 'The unbearable lightness of being' ) > ->json_is( '/author', 'Milan Kundera' ); > > $t->get_ok( >@@ -96,18 +97,21 @@ subtest 'get() tests' => sub { > ->status_is(200); > > $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >- ->status_is(200)->content_is( $biblio->metadata->record->as_formatted ); >+ ->status_is(200) >+ ->content_is( $biblio->metadata->record->as_formatted ); > > # Simulate a data error situation (BZ35246) > $biblio->biblioitem->delete(); > > $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/json' } ) >- ->status_is(500)->json_is( '/error_code', 'internal_server_error' ) >- ->json_is( '/error', 'Something went wrong, check Koha logs for details.' ); >+ ->status_is(500) >+ ->json_is( '/error_code', 'internal_server_error' ) >+ ->json_is( '/error', 'Something went wrong, check Koha logs for details.' ); > > $biblio->delete; > $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/marc' } ) >- ->status_is(404)->json_is( '/error', 'Bibliographic record not found' ); >+ ->status_is(404) >+ ->json_is( '/error', 'Bibliographic record not found' ); > > subtest 'marc-in-json encoding tests' => sub { > >@@ -124,7 +128,8 @@ subtest 'get() tests' => sub { > > my $result = $t->get_ok( > "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/marc-in-json' } ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > > my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > >@@ -153,7 +158,8 @@ subtest 'get() tests' => sub { > > my $result = $t->get_ok( > "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/marcxml+xml' } ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > > my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > >@@ -186,14 +192,16 @@ subtest 'get_items() tests' => sub { > > $patron->flags(4)->store; > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items" ) >+ ->status_is(200) > ->json_is( '' => [], 'No items on the biblio' ); > > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > > $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items?_order_by=item_id" ) >- ->status_is(200)->json_is( '' => [ $item_1->to_api, $item_2->to_api ], 'The items are returned' ); >+ ->status_is(200) >+ ->json_is( '' => [ $item_1->to_api, $item_2->to_api ], 'The items are returned' ); > > $t->get_ok( > "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items" => { "x-koha-embed" => "+strings" } ) >@@ -234,7 +242,8 @@ subtest 'get_items() tests' => sub { > > $t->get_ok( "//$userid:$password@/api/v1/biblios/" > . $item->biblionumber >- . "/items" => { "x-koha-embed" => "first_hold+strings" } )->status_is(200) >+ . "/items" => { "x-koha-embed" => "first_hold+strings" } ) >+ ->status_is(200) > ->json_is( > '/0/first_hold/_strings/pickup_library_id' => { type => 'library', str => $pickup_library->branchname } ); > }; >@@ -282,7 +291,8 @@ subtest 'delete() tests' => sub { > $item->delete(); > > # Bibs with no items can be deleted >- $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")->status_is(404); >@@ -329,7 +339,8 @@ subtest 'get_public() tests' => sub { > . $biblio->biblionumber => { Accept => 'application/weird+format' } )->status_is(400); > > $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >- ->status_is(200)->content_like(qr{100\s+_aMilan Kundera}) >+ ->status_is(200) >+ ->content_like(qr{100\s+_aMilan Kundera}) > ->content_like(qr{245\s+_aThe unbearable lightness of being}); > > $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" >@@ -343,7 +354,8 @@ subtest 'get_public() tests' => sub { > ->status_is(200); > > $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >- ->status_is(200)->content_is( $biblio->metadata->record->as_formatted ); >+ ->status_is(200) >+ ->content_is( $biblio->metadata->record->as_formatted ); > > subtest 'anonymous access' => sub { > plan tests => 9; >@@ -357,7 +369,8 @@ subtest 'get_public() tests' => sub { > $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'application/marc' } ) > ->status_is(200); > >- $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } )->status_is(200) >+ $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >+ ->status_is(200) > ->content_is( $biblio->metadata->record->as_formatted ); > }; > >@@ -376,7 +389,8 @@ subtest 'get_public() tests' => sub { > > my $result = > $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'application/marc-in-json' } ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > > my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > >@@ -392,7 +406,8 @@ subtest 'get_public() tests' => sub { > Koha::Caches->get_instance()->flush_all; > > $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >- ->status_is(200)->content_unlike(qr{100\s+_aMilan Kundera}) >+ ->status_is(200) >+ ->content_unlike(qr{100\s+_aMilan Kundera}) > ->content_like(qr{245\s+_aThe unbearable lightness of being}); > > subtest 'hidden_in_opac tests' => sub { >@@ -456,7 +471,8 @@ subtest 'get_public() tests' => sub { > $biblio->delete; > $t->get_ok( > "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'application/marc' } ) >- ->status_is(404)->json_is( '/error', 'Bibliographic record not found' ); >+ ->status_is(404) >+ ->json_is( '/error', 'Bibliographic record not found' ); > > $schema->storage->txn_rollback; > }; >@@ -581,7 +597,8 @@ subtest 'pickup_locations() tests' => sub { > . "patron_id=" > . $patron->id > . "&_order_by=marc_org_code" >- . "&_per_page=1" )->json_is( [$library_1_api] ) >+ . "&_per_page=1" ) >+ ->json_is( [$library_1_api] ) > ->header_is( 'X-Total-Count', '4', '4 is the count for libraries with pickup_location=1' ) > ->header_is( 'X-Base-Total-Count', '4', '4 is the count for libraries with pickup_location=1' ) > ->header_unlike( 'Link', qr|rel="prev"| ) >@@ -612,8 +629,11 @@ subtest 'pickup_locations() tests' => sub { > . "patron_id=" > . $patron->id > . "&_order_by=marc_org_code" >- . "&_per_page=1" )->json_is( [$library_1_api] )->header_is( 'X-Total-Count', '2' ) >- ->header_is( 'X-Base-Total-Count', '2' )->header_unlike( 'Link', qr|rel="prev"| ) >+ . "&_per_page=1" ) >+ ->json_is( [$library_1_api] ) >+ ->header_is( 'X-Total-Count', '2' ) >+ ->header_is( 'X-Base-Total-Count', '2' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=2.*|_page=2.*\&_per_page=1.*)>\; rel="next"# ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=1.*|_page=1.*\&_per_page=1).*>\; rel="first"# ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=2.*|_page=2.*\&_per_page=1).*>\; rel="last"# ); >@@ -633,7 +653,8 @@ subtest 'pickup_locations() tests' => sub { > > $t->get_ok( > "//$userid:$password@/api/v1/biblios/" . $biblio->id . "/pickup_locations?" . "patron_id=" . $patron->id ) >- ->status_is(404)->json_is( '/error' => 'Bibliographic record not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Bibliographic record not found' ); > > $schema->storage->txn_rollback; > }; >@@ -672,13 +693,15 @@ subtest 'get_items_public() tests' => sub { > > my $biblio = $builder->build_sample_biblio(); > >- $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->id . "/items" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->id . "/items" ) >+ ->status_is(200) > ->json_is( '' => [], 'No items on the biblio' ); > > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->id } ); > my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->id, withdrawn => 1 } ); > >- $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" ) >+ ->status_is(200) > ->json_is( > '' => [ > $item_1->to_api( { public => 1 } ), >@@ -689,7 +712,8 @@ subtest 'get_items_public() tests' => sub { > > $rules = { withdrawn => ['1'] }; > >- $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" ) >+ ->status_is(200) > ->json_is( > '' => [ $item_1->to_api( { public => 1 } ) ], > 'The items are returned, hidden one is not returned' >@@ -702,7 +726,8 @@ subtest 'get_items_public() tests' => sub { > > $override_hidden_items = 1; > >- $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/items" ) >+ ->status_is(200) > ->json_is( > '' => [ > $item_1->to_api( { public => 1 } ), >@@ -755,7 +780,8 @@ subtest 'get_bookings() tests' => sub { > > $t->get_ok( "//$unauth_userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/bookings" )->status_is(403); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/bookings" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/bookings" ) >+ ->status_is(200) > ->json_is( '' => [], 'No bookings on the biblio' ); > > # One booking >@@ -773,7 +799,9 @@ subtest 'get_bookings() tests' => sub { > } > ); > >- my $ret = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/bookings" )->status_is(200) >+ my $ret = >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/bookings" ) >+ ->status_is(200) > ->tx->res->json; > > is_deeply( $ret, [ $booking_0->to_api ] ); >@@ -846,7 +874,8 @@ subtest 'get_checkouts() tests' => sub { > AddIssue( $patron, $item_2->barcode ); > > my $ret = >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" ) >+ ->status_is(200) > ->tx->res->json; > > my $checkout_1 = Koha::Checkouts->find( { itemnumber => $item_1->id } ); >@@ -856,13 +885,17 @@ subtest 'get_checkouts() tests' => sub { > > AddReturn( $item_1->barcode ); > >- $ret = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" )->status_is(200) >+ $ret = >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" ) >+ ->status_is(200) > ->tx->res->json; > > is_deeply( $ret, [ $checkout_2->to_api ] ); > >- $ret = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts?checked_in=1" ) >- ->status_is(200)->tx->res->json; >+ $ret = >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts?checked_in=1" ) >+ ->status_is(200) >+ ->tx->res->json; > > my $old_checkout_1 = Koha::Old::Checkouts->find( $checkout_1->id ); > >@@ -894,12 +927,18 @@ subtest 'set_rating() tests' => sub { > > $t->post_ok( > "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber . "/ratings" => json => { rating => 3 } ) >- ->status_is(200)->json_is( '/rating', '3' )->json_is( '/average', '3' )->json_is( '/count', '1' ); >+ ->status_is(200) >+ ->json_is( '/rating', '3' ) >+ ->json_is( '/average', '3' ) >+ ->json_is( '/count', '1' ); > > $t->post_ok( "//$userid:$password@/api/v1/public/biblios/" > . $biblio->biblionumber >- . "/ratings" => json => { rating => undef } )->status_is(200)->json_is( '/rating', undef ) >- ->json_is( '/average', '0' )->json_is( '/count', '0' ); >+ . "/ratings" => json => { rating => undef } ) >+ ->status_is(200) >+ ->json_is( '/rating', undef ) >+ ->json_is( '/average', '0' ) >+ ->json_is( '/count', '0' ); > > $schema->storage->txn_rollback; > >@@ -1325,7 +1364,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/biblios" => > { 'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode } => $marcxml ) >- ->status_is(200)->json_has('/id') >+ ->status_is(200) >+ ->json_has('/id') > ->header_is( 'Location' => "/api/v1/biblios/" . $t->tx->res->json->{id}, "REST3.4.1" ); > > $t->post_ok( >@@ -1336,7 +1376,8 @@ subtest 'add() tests' => sub { > )->status_is(200)->json_has('/id'); > > $t->post_ok( "//$userid:$password@/api/v1/biblios" => >- { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc )->status_is(200) >+ { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc ) >+ ->status_is(200) > ->json_has('/id'); > > subtest 'x-record-source-id header tests' => sub { >@@ -1380,7 +1421,8 @@ subtest 'add() tests' => sub { > $mock_biblio->mock( 'AddBiblio', sub { return ( undef, undef ); } ); > > $t->post_ok( "//$userid:$password@/api/v1/biblios" => >- { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc )->status_is(400) >+ { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc ) >+ ->status_is(400) > ->json_is( > { > error => 'Error creating record', >@@ -1808,7 +1850,8 @@ subtest 'put() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/biblios/$biblionumber" => > { 'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode } => $marcxml ) >- ->status_is(200)->json_has('/id'); >+ ->status_is(200) >+ ->json_has('/id'); > > $biblio = Koha::Biblios->find($biblionumber); > >@@ -1816,14 +1859,16 @@ subtest 'put() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/biblios/$biblionumber" => > { 'Content-Type' => 'application/marc-in-json', 'x-framework-id' => $frameworkcode } => $mij ) >- ->status_is(200)->json_has('/id'); >+ ->status_is(200) >+ ->json_has('/id'); > > $biblio = Koha::Biblios->find($biblionumber); > > is( $biblio->title, 'Introduction to Attic Greek (Using mij) /' ); > > $t->put_ok( "//$userid:$password@/api/v1/biblios/$biblionumber" => >- { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc )->status_is(200) >+ { 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc ) >+ ->status_is(200) > ->json_has('/id'); > > $biblio = Koha::Biblios->find($biblionumber); >@@ -1880,8 +1925,10 @@ subtest 'list() tests' => sub { > > $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/json' } )->status_is(200); > >- my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/marcxml+xml' } ) >- ->status_is(200)->tx->res->body; >+ my $result = >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/marcxml+xml' } ) >+ ->status_is(200) >+ ->tx->res->body; > > my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); >@@ -1909,7 +1956,8 @@ subtest 'list() tests' => sub { > > $query = encode_json( { biblio_id => $biblio->id } ); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/json' } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/json' } ) >+ ->status_is(200) > ->json_is( '/0/timestamp' => > output_pref( { dt => $fixed_date, dateformat => 'rfc3339' }, 'biblio table timestamp takes precedence' ) ); > >@@ -2273,7 +2321,8 @@ subtest 'merge() tests' => sub { > my $result = > $t->post_ok( "//$userid:$password@/api/v1/biblios/$biblio_id1/merge" => > { 'Content-Type' => 'application/json', 'Accept' => 'application/marc-in-json' } => $json_input1 ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > like( $result, qr/$title_1/, "Merged record has the correct title" ); > unlike( $result, qr/$title_2/, "Merged record doesn't have the wrong title" ); > >@@ -2285,7 +2334,8 @@ subtest 'merge() tests' => sub { > $result = > $t->post_ok( "//$userid:$password@/api/v1/biblios/$biblio_id1/merge" => > { 'Content-Type' => 'application/json', 'Accept' => 'application/marc-in-json' } => $json_input2 ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > like( $result, qr/Using mij/, "Update with Marc-in-json record" ); > unlike( $result, qr/$title_1/, "Change all record with dat in the 'datarecord' field" ); > >diff --git a/t/db_dependent/api/v1/bookings.t b/t/db_dependent/api/v1/bookings.t >index 38cc5d00a4a..ba7785c5615 100755 >--- a/t/db_dependent/api/v1/bookings.t >+++ b/t/db_dependent/api/v1/bookings.t >@@ -135,11 +135,13 @@ subtest 'list() tests' => sub { > > $api_filter = encode_json( > { 'me.start_date' => { '<=' => output_pref( { dateformat => "rfc3339", dt => dt_from_string } ) } } ); >- $t->get_ok("//$userid:$password@/api/v1/bookings?q=$api_filter")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/bookings?q=$api_filter") >+ ->status_is(200) > ->json_is( '' => [ $booking_0->to_api ], 'filtering to before today also works' ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/bookings?booking_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/bookings?booking_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/booking_blah', message => 'Malformed query string' } ] ); > > $schema->storage->txn_rollback; >@@ -176,14 +178,16 @@ subtest 'get() tests' => sub { > $t->get_ok( "//$unauth_userid:$password@/api/v1/bookings/" . $booking->booking_id )->status_is(403); > > # Authorized user tests >- $t->get_ok( "//$userid:$password@/api/v1/bookings/" . $booking->booking_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/bookings/" . $booking->booking_id ) >+ ->status_is(200) > ->json_is( $booking->to_api ); > > my $booking_to_delete = $builder->build_object( { class => 'Koha::Bookings' } ); > my $non_existent_id = $booking_to_delete->id; > $booking_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/bookings/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/bookings/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Booking not found' ); > > $schema->storage->txn_rollback; >@@ -244,7 +248,8 @@ subtest 'add() tests' => sub { > # Authorized attempt to write invalid data > my $booking_with_invalid_field = { %{$booking}, blah => 'some stuff' }; > >- $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -256,8 +261,10 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $booking_id = >- $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is( 201, 'REST3.2.1' ) >- ->header_like( Location => qr|^\/api\/v1\/bookings/\d*|, 'REST3.4.1' )->json_is( '/biblio_id' => $biblio->id ) >+ $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( Location => qr|^\/api\/v1\/bookings/\d*|, 'REST3.4.1' ) >+ ->json_is( '/biblio_id' => $biblio->id ) > ->tx->res->json->{booking_id}; > > # Authorized attempt to create with null id >@@ -267,7 +274,8 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with existing id > $booking->{booking_id} = $booking_id; > warnings_like { >- $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(409) >+ $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking ) >+ ->status_is(409) > ->json_is( "/error" => "Duplicate booking_id" ); > } > qr/DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key '(.*\.?)PRIMARY'/; >@@ -335,7 +343,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/biblio_id" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/biblio_id" } ] ); > > # Full object update on PUT > my $booking_with_updated_field = { >@@ -348,7 +357,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_updated_field ) >- ->status_is(200)->json_is( '/biblio_id' => $biblio->id ); >+ ->status_is(200) >+ ->json_is( '/biblio_id' => $biblio->id ); > > # Authorized attempt to write invalid data > my $booking_with_invalid_field = { >@@ -362,7 +372,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -431,7 +442,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/bookings/$booking_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/bookings/$booking_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/bookings/$booking_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/bookings/$booking_id")->status_is(404); >@@ -491,7 +503,8 @@ subtest 'patch() tests' => sub { > }; > > $t->patch_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >diff --git a/t/db_dependent/api/v1/cash_registers.t b/t/db_dependent/api/v1/cash_registers.t >index bb3a624e31c..e1376e08e24 100755 >--- a/t/db_dependent/api/v1/cash_registers.t >+++ b/t/db_dependent/api/v1/cash_registers.t >@@ -68,7 +68,8 @@ subtest 'list() tests' => sub { > my $new_register = $builder->build_object( { class => 'Koha::Cash::Registers' } ); > > # One more register created, both should be returned >- $t->get_ok("//$userid:$password@/api/v1/cash_registers")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cash_registers") >+ ->status_is(200) > ->json_is( [ $register->to_api, $new_register->to_api, ] ); > > # Unauthorized access >diff --git a/t/db_dependent/api/v1/cashups.t b/t/db_dependent/api/v1/cashups.t >index 6110ff81a5c..897f5bd9ddb 100755 >--- a/t/db_dependent/api/v1/cashups.t >+++ b/t/db_dependent/api/v1/cashups.t >@@ -68,7 +68,8 @@ subtest 'list() tests' => sub { > my $non_existent_cr_id = $cash_register_to_delete->id; > $cash_register_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/cash_registers/$non_existent_cr_id/cashups")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/cash_registers/$non_existent_cr_id/cashups") >+ ->status_is(404) > ->json_is( '/error' => 'Register not found' ); > > my $register = $builder->build_object( { class => 'Koha::Cash::Registers' } ); >@@ -89,7 +90,8 @@ subtest 'list() tests' => sub { > ); > > # One cashup created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups") >+ ->status_is(200) > ->json_is( [ $cashup->to_api ] ); > > my $another_cashup = $builder->build_object( >@@ -104,11 +106,13 @@ subtest 'list() tests' => sub { > ); > > # One more cashup created, both should be returned >- $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups") >+ ->status_is(200) > ->json_is( [ $another_cashup->to_api, $cashup->to_api, ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups?cashup_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/cash_registers/$register_id/cashups?cashup_blah=blah") >+ ->status_is(400) > ->json_is( > [ > { >@@ -159,7 +163,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $cashup_to_delete->id; > $cashup_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/cashups/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/cashups/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Cashup not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index 7a00bd50ed6..bc3cb91da9f 100755 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -91,7 +91,8 @@ $bookings_librarian->set_password( { password => $password, skip_validation => 1 > my $bookings_userid = $bookings_librarian->userid; > > $t->get_ok("//$bookings_userid:$password@/api/v1/checkouts?patron_id=$patron_id") >- ->status_is( 200, 'manage_bookings allows checkouts access' )->json_is( [] ); >+ ->status_is( 200, 'manage_bookings allows checkouts access' ) >+ ->json_is( [] ); > > Koha::CirculationRules->set_rules( > { >@@ -121,26 +122,39 @@ my $date_due3 = Koha::DateUtils::dt_from_string( $issue3->date_due ); > my $issue4 = C4::Circulation::AddIssue( $patron, $item4->barcode ); > C4::Circulation::AddReturn( $item4->barcode, $branchcode ); > >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id")->status_is(200) >- ->json_is( '/0/patron_id' => $patron_id )->json_is( '/0/item_id' => $item1->itemnumber ) >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id") >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item1->itemnumber ) > ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ) >- ->json_is( '/1/patron_id' => $patron_id )->json_is( '/1/item_id' => $item2->itemnumber ) >- ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) )->json_hasnt('/2'); >+ ->json_is( '/1/patron_id' => $patron_id ) >+ ->json_is( '/1/item_id' => $item2->itemnumber ) >+ ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) ) >+ ->json_hasnt('/2'); > > # Test checked_in parameter, zero means, the response is same as without it >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=0")->status_is(200) >- ->json_is( '/0/patron_id' => $patron_id )->json_is( '/0/item_id' => $item1->itemnumber ) >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=0") >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item1->itemnumber ) > ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ) >- ->json_is( '/1/patron_id' => $patron_id )->json_is( '/1/item_id' => $item2->itemnumber ) >- ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) )->json_hasnt('/2'); >+ ->json_is( '/1/patron_id' => $patron_id ) >+ ->json_is( '/1/item_id' => $item2->itemnumber ) >+ ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) ) >+ ->json_hasnt('/2'); > > # Test checked_in parameter, one measn, the checked in checkout is in the response too >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=1")->status_is(200) >- ->json_is( '/0/patron_id' => $patron_id )->json_is( '/0/item_id' => $item4->itemnumber )->json_hasnt('/1'); >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=1") >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item4->itemnumber ) >+ ->json_hasnt('/1'); > > $item4->delete; >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=1")->status_is(200) >- ->json_is( '/0/patron_id' => $patron_id )->json_is( '/0/item_id' => undef ); >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=1") >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => undef ); > > $t->get_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id )->status_is(403)->json_is( > { >@@ -149,49 +163,72 @@ $t->get_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->is > } > ); > >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id")->status_is(200) >- ->json_is( '/0/patron_id' => $patron_id )->json_is( '/0/item_id' => $item1->itemnumber ) >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id") >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item1->itemnumber ) > ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ) >- ->json_is( '/1/patron_id' => $patron_id )->json_is( '/1/item_id' => $item2->itemnumber ) >- ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) )->json_hasnt('/2'); >- >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=1")->status_is(200) >- ->header_is( 'X-Total-Count', '2' )->header_like( 'Link', qr|rel="next"| )->header_like( 'Link', qr|rel="first"| ) >- ->header_like( 'Link', qr|rel="last"| )->json_is( '/0/patron_id' => $patron_id ) >- ->json_is( '/0/item_id' => $item1->itemnumber ) >- ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) )->json_hasnt('/1'); >- >-$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=2")->status_is(200) >- ->header_is( 'X-Total-Count', '2' )->header_like( 'Link', qr|rel="prev"| )->header_like( 'Link', qr|rel="first"| ) >- ->header_like( 'Link', qr|rel="last"| )->json_is( '/0/patron_id' => $patron_id ) >- ->json_is( '/0/item_id' => $item2->itemnumber ) >- ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) )->json_hasnt('/1'); >- >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id )->status_is(200) >- ->json_is( '/patron_id' => $patron_id )->json_is( '/item_id' => $item1->itemnumber ) >- ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) )->json_hasnt('/1'); >- >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id )->status_is(200) >+ ->json_is( '/1/patron_id' => $patron_id ) >+ ->json_is( '/1/item_id' => $item2->itemnumber ) >+ ->json_is( '/1/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) ) >+ ->json_hasnt('/2'); >+ >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=1") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '2' ) >+ ->header_like( 'Link', qr|rel="next"| ) >+ ->header_like( 'Link', qr|rel="first"| ) >+ ->header_like( 'Link', qr|rel="last"| ) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item1->itemnumber ) >+ ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ) >+ ->json_hasnt('/1'); >+ >+$t->get_ok("//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=2") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '2' ) >+ ->header_like( 'Link', qr|rel="prev"| ) >+ ->header_like( 'Link', qr|rel="first"| ) >+ ->header_like( 'Link', qr|rel="last"| ) >+ ->json_is( '/0/patron_id' => $patron_id ) >+ ->json_is( '/0/item_id' => $item2->itemnumber ) >+ ->json_is( '/0/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) ) >+ ->json_hasnt('/1'); >+ >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id ) >+ ->status_is(200) >+ ->json_is( '/patron_id' => $patron_id ) >+ ->json_is( '/item_id' => $item1->itemnumber ) >+ ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ) >+ ->json_hasnt('/1'); >+ >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id ) >+ ->status_is(200) > ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due1 } ) ); > >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id )->status_is(200) >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id ) >+ ->status_is(200) > ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $date_due2 } ) ); > > my $expected_datedue = > $date_due->set_time_zone('local')->add( days => 7 )->set( hour => 23, minute => 59, second => 0 ); > >-$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )->status_is(201) >+$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) >+ ->status_is(201) > ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue } ) ) > ->header_is( Location => "/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ); > > my $renewal = $issue1->renewals->last; > is( $renewal->renewal_type, 'Manual', 'Manual renewal recorded' ); > >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewals" )->status_is(200) >- ->json_is( '/0/checkout_id' => $issue1->issue_id )->json_is( '/0/interface' => 'api' ) >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewals" ) >+ ->status_is(200) >+ ->json_is( '/0/checkout_id' => $issue1->issue_id ) >+ ->json_is( '/0/interface' => 'api' ) > ->json_is( '/0/renewer_id' => $librarian->borrowernumber ); > >-$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" )->status_is(403) >+$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" ) >+ ->status_is(403) > ->json_is( > { > error => "Authorization failure. Missing required permission(s).", >@@ -199,7 +236,8 @@ $t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->i > } > ); > >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/allows_renewal" )->status_is(200) >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/allows_renewal" ) >+ ->status_is(200) > ->json_is( > { > allows_renewal => Mojo::JSON->true, >@@ -210,14 +248,17 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/all > } > ); > >-$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" )->status_is(201) >+$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" ) >+ ->status_is(201) > ->json_is( '/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue } ) ) > ->header_is( Location => "/api/v1/checkouts/" . $issue2->issue_id . "/renewal" ); > >-$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )->status_is(403) >+$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) >+ ->status_is(403) > ->json_is( { error => 'Renewal not authorized (too_many)' } ); > >-$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/allows_renewal" )->status_is(200) >+$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/allows_renewal" ) >+ ->status_is(200) > ->json_is( > { > allows_renewal => Mojo::JSON->false, >@@ -275,7 +316,8 @@ subtest 'get_availability' => sub { > > $t->get_ok( > "//$unauth_userid:$unauth_password@/api/v1/checkouts/availability?item_id=$item1_id&patron_id=$patron_id") >- ->status_is(403)->json_is( >+ ->status_is(403) >+ ->json_is( > { > error => "Authorization failure. Missing required permission(s).", > required_permissions => { circulate => "circulate_remaining_permissions" } >@@ -284,21 +326,29 @@ subtest 'get_availability' => sub { > > # Available > $t->get_ok("//$userid:$password@/api/v1/checkouts/availability?item_id=$item1_id&patron_id=$patron_id") >- ->status_is(200)->json_is( '/blockers' => {} )->json_is( '/confirms' => {} )->json_is( '/warnings' => {} ) >+ ->status_is(200) >+ ->json_is( '/blockers' => {} ) >+ ->json_is( '/confirms' => {} ) >+ ->json_is( '/warnings' => {} ) > ->json_has('/confirmation_token'); > > # Blocked > %issuingimpossible = ( GNA => 1 ); > $t->get_ok("//$userid:$password@/api/v1/checkouts/availability?item_id=$item1_id&patron_id=$patron_id") >- ->status_is(200)->json_is( '/blockers' => { GNA => 1 } )->json_is( '/confirms' => {} ) >- ->json_is( '/warnings' => {} )->json_has('/confirmation_token'); >+ ->status_is(200) >+ ->json_is( '/blockers' => { GNA => 1 } ) >+ ->json_is( '/confirms' => {} ) >+ ->json_is( '/warnings' => {} ) >+ ->json_has('/confirmation_token'); > %issuingimpossible = (); > > # Warnings/Info > %alerts = ( alert1 => "this is an alert" ); > %messages = ( message1 => "this is a message" ); > $t->get_ok("//$userid:$password@/api/v1/checkouts/availability?item_id=$item1_id&patron_id=$patron_id") >- ->status_is(200)->json_is( '/blockers' => {} )->json_is( '/confirms' => {} ) >+ ->status_is(200) >+ ->json_is( '/blockers' => {} ) >+ ->json_is( '/confirms' => {} ) > ->json_is( '/warnings' => { alert1 => "this is an alert", message1 => "this is a message" } ) > ->json_has('/confirmation_token'); > %alerts = (); >@@ -308,8 +358,10 @@ subtest 'get_availability' => sub { > %needsconfirmation = ( confirm1 => 1, confirm2 => 'please' ); > my $token = Koha::Token->new->generate_jwt( { id => $librarian->id . ":" . $item1_id . ":confirm1:confirm2" } ); > $t->get_ok("//$userid:$password@/api/v1/checkouts/availability?item_id=$item1_id&patron_id=$patron_id") >- ->status_is(200)->json_is( '/blockers' => {} ) >- ->json_is( '/confirms' => { confirm1 => 1, confirm2 => 'please' } )->json_is( '/warnings' => {} ) >+ ->status_is(200) >+ ->json_is( '/blockers' => {} ) >+ ->json_is( '/confirms' => { confirm1 => 1, confirm2 => 'please' } ) >+ ->json_is( '/warnings' => {} ) > ->json_has('/confirmation_token'); > my $confirmation_token = $t->tx->res->json('/confirmation_token'); > ok( >@@ -336,15 +388,23 @@ subtest 'get_availability' => sub { > # All ok > $t->get_ok( > "//$unauth_userid:$unauth_password@/api/v1/public/checkouts/availability?item_id=$item1_id&patron_id=$patron_id" >- )->status_is(200)->json_is( '/blockers' => {} )->json_is( '/confirms' => {} )->json_is( '/warnings' => {} ) >+ ) >+ ->status_is(200) >+ ->json_is( '/blockers' => {} ) >+ ->json_is( '/confirms' => {} ) >+ ->json_is( '/warnings' => {} ) > ->json_has('/confirmation_token'); > > # Needs confirmation upgrade to blocker > %needsconfirmation = ( TOO_MANY => 1, ISSUED_TO_ANOTHER => 1 ); > $t->get_ok( > "//$unauth_userid:$unauth_password@/api/v1/public/checkouts/availability?item_id=$item1_id&patron_id=$patron_id" >- )->status_is(200)->json_is( '/blockers' => { TOO_MANY => 1, ISSUED_TO_ANOTHER => 1 } ) >- ->json_is( '/confirms' => {} )->json_is( '/warnings' => {} )->json_has('/confirmation_token'); >+ ) >+ ->status_is(200) >+ ->json_is( '/blockers' => { TOO_MANY => 1, ISSUED_TO_ANOTHER => 1 } ) >+ ->json_is( '/confirms' => {} ) >+ ->json_is( '/warnings' => {} ) >+ ->json_has('/confirmation_token'); > %needsconfirmation = (); > > # Remove personal information from public endpoint >@@ -393,7 +453,11 @@ subtest 'get_availability' => sub { > ); > $t->get_ok( > "//$unauth_userid:$unauth_password@/api/v1/public/checkouts/availability?item_id=$item1_id&patron_id=$patron_id" >- )->status_is(200)->json_is( '/blockers' => {} )->json_is( '/confirms' => {} )->json_is( '/warnings' => {} ) >+ ) >+ ->status_is(200) >+ ->json_is( '/blockers' => {} ) >+ ->json_is( '/confirms' => {} ) >+ ->json_is( '/warnings' => {} ) > ->json_has('/confirmation_token'); > %issuingimpossible = (); > %alerts = (); >@@ -504,10 +568,12 @@ subtest 'add checkout' => sub { > > $t->post_ok( > "/api/v1/public/patrons/$patron_id/checkouts" => json => { item_id => $item1_id, patron_id => $patron_id } ) >- ->status_is(401)->json_is( { error => "Authentication failure." } ); >+ ->status_is(401) >+ ->json_is( { error => "Authentication failure." } ); > > $t->post_ok( "//$useridp:$password@/api/v1/public/patrons/$patron_id/checkouts" => json => >- { item_id => $item1_id, patron_id => $patron_id } )->status_is(405) >+ { item_id => $item1_id, patron_id => $patron_id } ) >+ ->status_is(405) > ->json_is( { error => "Feature disabled", error_code => "FEATURE_DISABLED" } ); > > # Feature enabled >@@ -515,10 +581,12 @@ subtest 'add checkout' => sub { > > $t->post_ok( > "/api/v1/public/patrons/$patron_id/checkouts" => json => { item_id => $item1_id, patron_id => $patron_id } ) >- ->status_is(401)->json_is( { error => "Authentication failure." } ); >+ ->status_is(401) >+ ->json_is( { error => "Authentication failure." } ); > > $t->post_ok( "//$userid:$password@/api/v1/public/patrons/$patron_id/checkouts" => json => >- { item_id => $item1_id, patron_id => $patron_id } )->status_is(403) >+ { item_id => $item1_id, patron_id => $patron_id } ) >+ ->status_is(403) > ->json_is( { error => "Unprivileged user cannot access another user's resources" } ); > > $t->post_ok( "//$useridp:$password@/api/v1/public/patrons/$patron_id/checkouts" => json => >diff --git a/t/db_dependent/api/v1/circulation_rules.t b/t/db_dependent/api/v1/circulation_rules.t >index bbc70e2c23a..df7bab4f84c 100755 >--- a/t/db_dependent/api/v1/circulation_rules.t >+++ b/t/db_dependent/api/v1/circulation_rules.t >@@ -94,7 +94,8 @@ subtest 'list_rules() tests' => sub { > ); > > note("One default rule defined"); >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules") >+ ->status_is(200) > ->json_is( '/0/fine' => 2, "Default fine rule is returned as expected" ) > ->json_is( '/0/finedays' => undef, "Rule finedays is undefined as expected" ); > >@@ -113,7 +114,8 @@ subtest 'list_rules() tests' => sub { > ); > > note("Two default rules defined"); >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules") >+ ->status_is(200) > ->json_is( '/0/fine' => 2, "Default fine rule is returned as expected" ) > ->json_is( '/0/finedays' => 5, "Default finedays rule is returned as expected" ); > >@@ -132,14 +134,16 @@ subtest 'list_rules() tests' => sub { > ); > > note("Two default rules and one branch rule defined"); >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=$branchcode")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=$branchcode") >+ ->status_is(200) > ->json_is( '/0/fine' => 4, "Branch specific fine rule is returned when library is added to request query" ) > ->json_is( > '/0/finedays' => 5, > "Default finedays rule is returned when library is added to request query but no branch specific rule is defined" > ); > >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules") >+ ->status_is(200) > ->json_is( '/0/fine' => 2, "Default fine rule returned when no library is added to request query" ) > ->json_is( '/0/finedays' => 5, "Default finedays rule returned when no library is added to request query" ); > >@@ -152,7 +156,8 @@ subtest 'list_rules() tests' => sub { > ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/rules_blah', message => 'Malformed query string' } ] ); > > # Make sure we have a non-existent library >@@ -161,7 +166,8 @@ subtest 'list_rules() tests' => sub { > $library_to_delete->delete; > > # Warn on incorrect query parameter value >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=$non_existent_library")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules?library_id=$non_existent_library") >+ ->status_is(400) > ->json_is( > '' => { > error => 'Invalid parameter value', >@@ -182,7 +188,8 @@ subtest 'list_rules() tests' => sub { > > # Warn on incorrect query parameter value > $t->get_ok("//$userid:$password@/api/v1/circulation_rules?patron_category_id=$non_existent_category") >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > '' => { > error => 'Invalid parameter value', > error_code => 'invalid_parameter_value', >@@ -201,7 +208,8 @@ subtest 'list_rules() tests' => sub { > $itemtype_to_delete->delete; > > # Warn on incorrect query parameter value >- $t->get_ok("//$userid:$password@/api/v1/circulation_rules?item_type_id=$non_existent_itemtype")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/circulation_rules?item_type_id=$non_existent_itemtype") >+ ->status_is(400) > ->json_is( > '' => { > error => 'Invalid parameter value', >@@ -343,21 +351,24 @@ subtest 'set_rules() tests' => sub { > # Invalid item_type_id > note("Invalid item_type_id"); > $rules_to_set->{context}->{item_type_id} = 'invalid_itemtype'; >- $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set ) >+ ->status_is(400) > ->json_is( '/error_code' => 'invalid_parameter_value', "Handled invalid item_type_id" ); > > # Invalid library_id > note("Invalid library_id"); > $rules_to_set->{context}->{item_type_id} = $itemtype; > $rules_to_set->{context}->{library_id} = 'invalid_library'; >- $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set ) >+ ->status_is(400) > ->json_is( '/error_code' => 'invalid_parameter_value', "Handled invalid library_id" ); > > # Invalid patron_category_id > note("Invalid patron_category_id"); > $rules_to_set->{context}->{library_id} = $branchcode; > $rules_to_set->{context}->{patron_category_id} = 'invalid_category'; >- $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/circulation_rules" => json => $rules_to_set ) >+ ->status_is(400) > ->json_is( '/error_code' => 'invalid_parameter_value', "Handled invalid patron_category_id" ); > > # Unauthorized user tests >diff --git a/t/db_dependent/api/v1/cities.t b/t/db_dependent/api/v1/cities.t >index e089103e15c..b24fecd0836 100755 >--- a/t/db_dependent/api/v1/cities.t >+++ b/t/db_dependent/api/v1/cities.t >@@ -91,11 +91,13 @@ subtest 'list() tests' => sub { > ] > ); > >- $t->get_ok( "//$userid:$password@/api/v1/cities?name=" . $city->city_name )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/cities?name=" . $city->city_name ) >+ ->status_is(200) > ->json_is( [ $city->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/cities?city_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/cities?city_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/city_blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -139,7 +141,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $city_to_delete->id; > $city_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/cities/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/cities/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'City not found' ); > > $schema->storage->txn_rollback; >@@ -200,12 +203,16 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $city_id = >- $t->post_ok( "//$userid:$password@/api/v1/cities" => json => $city )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$userid:$password@/api/v1/cities" => json => $city ) >+ ->status_is( 201, 'REST3.2.1' ) > ->header_like( > Location => qr|^\/api\/v1\/cities/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $city->{name} )->json_is( '/state' => $city->{state} ) >- ->json_is( '/postal_code' => $city->{postal_code} )->json_is( '/country' => $city->{country} ) >+ ) >+ ->json_is( '/name' => $city->{name} ) >+ ->json_is( '/state' => $city->{state} ) >+ ->json_is( '/postal_code' => $city->{postal_code} ) >+ ->json_is( '/country' => $city->{country} ) > ->tx->res->json->{city_id}; > > # Authorized attempt to create with null id >@@ -266,7 +273,8 @@ subtest 'update() tests' => sub { > country => 'New country' > }; > >- $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_missing_field )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/postal_code" } ] ); > > # Full object update on PUT >@@ -277,7 +285,8 @@ subtest 'update() tests' => sub { > country => "City Country" > }; > >- $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_updated_field )->status_is(200) >+ $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_updated_field ) >+ ->status_is(200) > ->json_is( '/name' => 'London' ); > > # Authorized attempt to write invalid data >@@ -288,7 +297,8 @@ subtest 'update() tests' => sub { > country => "City Country" > }; > >- $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_invalid_field )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/cities/$city_id" => json => $city_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -344,7 +354,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/cities/$city_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/clubs_holds.t b/t/db_dependent/api/v1/clubs_holds.t >index 702f0d65900..c270207ea79 100755 >--- a/t/db_dependent/api/v1/clubs_holds.t >+++ b/t/db_dependent/api/v1/clubs_holds.t >@@ -134,7 +134,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/clubs/" > . $club_with_enrollments->id >- . "/holds" => json => { pickup_library_id => $non_existent_item_homebranch } )->status_is(400) >+ . "/holds" => json => { pickup_library_id => $non_existent_item_homebranch } ) >+ ->status_is(400) > ->json_is( '/error' => 'At least one of biblio_id, item_id should be given' ); > > $t->post_ok( >@@ -170,12 +171,15 @@ subtest 'add() tests' => sub { > > $t->post_ok( > "//$userid:$password@/api/v1/clubs/" . $club_without_enrollments->id . "/holds" => json => $data ) >- ->status_is(409)->json_is( '/error' => "Cannot place a hold on a club without patrons." ); >+ ->status_is(409) >+ ->json_is( '/error' => "Cannot place a hold on a club without patrons." ); > > # place a club hold with top level reserveforothers permission - should succeed > $t->post_ok( "//$userid:$password@/api/v1/clubs/" . $club_with_enrollments->id . "/holds" => json => $data ) >- ->status_is( 201, 'Created Hold' )->json_has( '/club_hold_id', 'got a club hold id' ) >- ->json_is( '/club_id' => $club_with_enrollments->id )->json_is( '/biblio_id' => $item->biblionumber ) >+ ->status_is( 201, 'Created Hold' ) >+ ->json_has( '/club_hold_id', 'got a club hold id' ) >+ ->json_is( '/club_id' => $club_with_enrollments->id ) >+ ->json_is( '/biblio_id' => $item->biblionumber ) > ->header_is( > 'Location' => '/api/v1/clubs/' > . $club_with_enrollments->id >@@ -189,7 +193,8 @@ subtest 'add() tests' => sub { > "//$userid_2:$password_2@/api/v1/clubs/" . $club_with_enrollments->id . "/holds" => json => $data ) > ->status_is( 201, 'Created Hold with specific place_holds permission' ) > ->json_has( '/club_hold_id', 'got a club hold id' ) >- ->json_is( '/club_id' => $club_with_enrollments->id )->json_is( '/biblio_id' => $item->biblionumber ); >+ ->json_is( '/club_id' => $club_with_enrollments->id ) >+ ->json_is( '/biblio_id' => $item->biblionumber ); > > # place a club hold with no reserveforothers or specific permsision - should fail > $t->post_ok( >@@ -233,12 +238,15 @@ subtest 'add() tests' => sub { > > $t->post_ok( > "//$userid:$password@/api/v1/clubs/" . $club_without_enrollments->id . "/holds" => json => $data ) >- ->status_is(409)->json_is( '/error' => "Cannot place a hold on a club without patrons." ); >+ ->status_is(409) >+ ->json_is( '/error' => "Cannot place a hold on a club without patrons." ); > > # place a club hold with top level reserveforothers permission - should succeed > $t->post_ok( "//$userid:$password@/api/v1/clubs/" . $club_with_enrollments->id . "/holds" => json => $data ) >- ->status_is( 201, 'Created Hold' )->json_has( '/club_hold_id', 'got a club hold id' ) >- ->json_is( '/club_id' => $club_with_enrollments->id )->json_is( '/biblio_id' => $item->biblionumber ) >+ ->status_is( 201, 'Created Hold' ) >+ ->json_has( '/club_hold_id', 'got a club hold id' ) >+ ->json_is( '/club_id' => $club_with_enrollments->id ) >+ ->json_is( '/biblio_id' => $item->biblionumber ) > ->header_is( > 'Location' => '/api/v1/clubs/' > . $club_with_enrollments->id >@@ -252,7 +260,8 @@ subtest 'add() tests' => sub { > "//$userid_2:$password_2@/api/v1/clubs/" . $club_with_enrollments->id . "/holds" => json => $data ) > ->status_is( 201, 'Created Hold with specific place_holds permission' ) > ->json_has( '/club_hold_id', 'got a club hold id' ) >- ->json_is( '/club_id' => $club_with_enrollments->id )->json_is( '/biblio_id' => $item->biblionumber ); >+ ->json_is( '/club_id' => $club_with_enrollments->id ) >+ ->json_is( '/biblio_id' => $item->biblionumber ); > > # place a club hold with no reserveforothers or specific permsision - should fail > $t->post_ok( >@@ -348,7 +357,8 @@ sub unauthorized_access_tests { > $unauthorized_patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $unauthorized_patron->userid; > >- $t->$verb_ok( "//$unauth_userid:$password\@$endpoint" => json => $json )->status_is(403) >+ $t->$verb_ok( "//$unauth_userid:$password\@$endpoint" => json => $json ) >+ ->status_is(403) > ->json_has('/required_permissions'); > }; > } >diff --git a/t/db_dependent/api/v1/deleted_biblios.t b/t/db_dependent/api/v1/deleted_biblios.t >index bd80fbacffc..4cd3f15520d 100755 >--- a/t/db_dependent/api/v1/deleted_biblios.t >+++ b/t/db_dependent/api/v1/deleted_biblios.t >@@ -86,7 +86,8 @@ subtest 'get() tests' => sub { > > $t->get_ok( > "//$userid:$password@/api/v1/deleted/biblios/" . $biblio->biblionumber => { Accept => 'application/json' } ) >- ->status_is(200)->json_is( '/title', 'The unbearable lightness of being' ) >+ ->status_is(200) >+ ->json_is( '/title', 'The unbearable lightness of being' ) > ->json_is( '/author', 'Milan Kundera' ); > > $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios/" >@@ -100,11 +101,13 @@ subtest 'get() tests' => sub { > ->status_is(200); > > $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) >- ->status_is(200)->content_is($formatted); >+ ->status_is(200) >+ ->content_is($formatted); > > my $biblio_exist = $builder->build_sample_biblio(); > $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios/" >- . $biblio_exist->biblionumber => { Accept => 'application/marc' } )->status_is(404) >+ . $biblio_exist->biblionumber => { Accept => 'application/marc' } ) >+ ->status_is(404) > ->json_is( '/error', 'Bibliographic record not found' ); > > subtest 'marc-in-json encoding tests' => sub { >@@ -217,7 +220,8 @@ subtest 'list() tests' => sub { > > my $result = > $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'application/marcxml+xml' } ) >- ->status_is(200)->tx->res->body; >+ ->status_is(200) >+ ->tx->res->body; > > my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); >@@ -249,7 +253,9 @@ subtest 'list() tests' => sub { > ); > > $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'application/json' } ) >- ->status_is(200)->json_is( '/0/biblio_id' => $old_biblio_1->id )->json_is( '/1/biblio_id' => undef ); >+ ->status_is(200) >+ ->json_is( '/0/biblio_id' => $old_biblio_1->id ) >+ ->json_is( '/1/biblio_id' => undef ); > > # DELETE any biblio with ISBN = TOMAS > Koha::Biblios->search( { 'biblioitem.isbn' => 'TOMAS' }, { join => ['biblioitem'] } )->delete; >diff --git a/t/db_dependent/api/v1/edifact_files.t b/t/db_dependent/api/v1/edifact_files.t >index a3e37a85e61..82757d6217b 100755 >--- a/t/db_dependent/api/v1/edifact_files.t >+++ b/t/db_dependent/api/v1/edifact_files.t >@@ -102,12 +102,14 @@ subtest 'list() tests' => sub { > ); > > $api_filter = encode_json( { 'me.filename' => $file->filename } ); >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles?q=$api_filter")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles?q=$api_filter") >+ ->status_is(200) > ->json_is( [ $file->to_api ] ); > > # Warn on unsupported query parameter > $api_filter = encode_json( { 'me.file_blah' => 'blah' } ); >- $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles?file_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/acquisitions/edifiles?file_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/file_blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >diff --git a/t/db_dependent/api/v1/erm_agreements.t b/t/db_dependent/api/v1/erm_agreements.t >index 83236237548..69fbbd900eb 100755 >--- a/t/db_dependent/api/v1/erm_agreements.t >+++ b/t/db_dependent/api/v1/erm_agreements.t >@@ -101,14 +101,16 @@ subtest 'list() tests' => sub { > ); > > # Filtering works, two agreements sharing vendor_id >- $t->get_ok( "//$userid:$password@/api/v1/erm/agreements?vendor_id=" . $vendor_1->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/agreements?vendor_id=" . $vendor_1->id ) >+ ->status_is(200) > ->json_is( [ $agreement->to_api, $another_agreement->to_api ] ); > > # Attempt to search by name like 'ko' > $agreement->delete; > $another_agreement->delete; > $agreement_with_another_vendor_id->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/agreements?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/agreements?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $agreement_to_search = $builder->build_object( >@@ -121,7 +123,8 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for name like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/agreements?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/agreements?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $agreement_to_search->to_api ] ); > > # Warn on incorrect filter date format >@@ -135,7 +138,8 @@ subtest 'list() tests' => sub { > ); > > # Attempt to filter by expired on 2021-03-19 >- $t->get_ok("//$userid:$password@/api/v1/erm/agreements?max_expiration_date=2021-03-19")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/agreements?max_expiration_date=2021-03-19") >+ ->status_is(200) > ->json_is( [] ); > > my $agreement_to_filter = $builder->build_object( { class => 'Koha::ERM::Agreements' } ); >@@ -149,11 +153,13 @@ subtest 'list() tests' => sub { > ); > > # Filter by expired on 2021-03-19 >- $t->get_ok("//$userid:$password@/api/v1/erm/agreements?max_expiration_date=2021-03-19")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/agreements?max_expiration_date=2021-03-19") >+ ->status_is(200) > ->json_is( [ $agreement_to_filter->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/agreements?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/agreements?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -190,7 +196,8 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This agreement exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/erm/agreements/" . $agreement->agreement_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/agreements/" . $agreement->agreement_id ) >+ ->status_is(200) > ->json_is( $agreement->to_api ); > > # Return one agreement with some embeds >@@ -214,7 +221,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $agreement_to_delete->agreement_id; > $agreement_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/agreements/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/agreements/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Agreement not found' ); > > $schema->storage->txn_rollback; >@@ -273,7 +281,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/erm/agreements" => json => $agreement_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -285,19 +294,25 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $agreement_id = > $t->post_ok( "//$userid:$password@/api/v1/erm/agreements" => json => $agreement ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/erm/agreements/\d*|, > 'REST3.4.1' >- )->json_is( '/vendor_id' => $agreement->{vendor_id} )->json_is( '/name' => $agreement->{name} ) >- ->json_is( '/description' => $agreement->{description} )->json_is( '/status' => $agreement->{status} ) >+ ) >+ ->json_is( '/vendor_id' => $agreement->{vendor_id} ) >+ ->json_is( '/name' => $agreement->{name} ) >+ ->json_is( '/description' => $agreement->{description} ) >+ ->json_is( '/status' => $agreement->{status} ) > ->json_is( '/closure_reason' => $agreement->{closure_reason} ) > ->json_is( '/is_perpetual' => $agreement->{is_perpetual} ) > ->json_is( '/renewal_priority' => $agreement->{renewal_priority} ) >- ->json_is( '/license_info' => $agreement->{license_info} )->tx->res->json->{agreement_id}; >+ ->json_is( '/license_info' => $agreement->{license_info} ) >+ ->tx->res->json->{agreement_id}; > > # Authorized attempt to create with null id > $agreement->{agreement_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/erm/agreements" => json => $agreement )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/agreements" => json => $agreement ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id >@@ -357,7 +372,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/agreements/$agreement_id" => json => $agreement_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $agreement_with_updated_field = { >@@ -372,7 +388,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/agreements/$agreement_id" => json => $agreement_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'New name' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'New name' ); > > # Authorized attempt to write invalid data > my $agreement_with_invalid_field = { >@@ -387,7 +404,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/agreements/$agreement_id" => json => $agreement_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -445,7 +463,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/erm/agreements/$agreement_id")->status_is(403); > > # Delete existing agreement >- $t->delete_ok("//$userid:$password@/api/v1/erm/agreements/$agreement_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/erm/agreements/$agreement_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent agreement >@@ -510,7 +529,8 @@ subtest 'extended_attributes() tests' => sub { > # Test with list endpoint > $response = > $t->get_ok( "//$userid:$password@/api/v1/erm/agreements" => { 'x-koha-embed' => 'extended_attributes' } ) >- ->status_is(200)->tx->res->json; >+ ->status_is(200) >+ ->tx->res->json; > > # Verify record_table is still not present in list endpoint > my $found = 0; >diff --git a/t/db_dependent/api/v1/erm_counter_files.t b/t/db_dependent/api/v1/erm_counter_files.t >index 5d0bf510d07..f67164402a9 100755 >--- a/t/db_dependent/api/v1/erm_counter_files.t >+++ b/t/db_dependent/api/v1/erm_counter_files.t >@@ -79,13 +79,15 @@ subtest 'list() tests' => sub { > ); > > # Two counter_files created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/erm/counter_files")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/counter_files") >+ ->status_is(200) > ->json_is( [ $counter_file->to_api, $another_counter_file->to_api, ] ); > > # Attempt to search by type like 'ko' > $counter_file->delete; > $another_counter_file->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/counter_files?q=[{"me.type":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/counter_files?q=[{"me.type":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $counter_file_to_search = $builder->build_object( >@@ -98,11 +100,13 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for type like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/counter_files?q=[{"me.type":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/counter_files?q=[{"me.type":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $counter_file_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/counter_files?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/counter_files?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -153,7 +157,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $counter_file_to_delete->erm_counter_files_id; > $counter_file_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/counter_files/$non_existent_id/file/content")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/counter_files/$non_existent_id/file/content") >+ ->status_is(404) > ->json_is( '/error' => 'COUNTER file not found' ); > > $schema->storage->txn_rollback; >@@ -192,7 +197,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/erm/counter_files/$counter_file_id")->status_is(403); > > # Delete existing counter_file >- $t->delete_ok("//$userid:$password@/api/v1/erm/counter_files/$counter_file_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/erm/counter_files/$counter_file_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent counter_file >diff --git a/t/db_dependent/api/v1/erm_counter_logs.t b/t/db_dependent/api/v1/erm_counter_logs.t >index 00a90f23cf5..16e4f14d331 100755 >--- a/t/db_dependent/api/v1/erm_counter_logs.t >+++ b/t/db_dependent/api/v1/erm_counter_logs.t >@@ -79,11 +79,13 @@ subtest 'list() tests' => sub { > ); > > # Two counter_logs created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/erm/counter_logs")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/counter_logs") >+ ->status_is(200) > ->json_is( [ $counter_log->to_api, $another_counter_log->to_api, ] ); > > # Return 2 counter logs with patron embedded >- $t->get_ok( "//$userid:$password@/api/v1/erm/counter_logs/" => { 'x-koha-embed' => 'patron' } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/counter_logs/" => { 'x-koha-embed' => 'patron' } ) >+ ->status_is(200) > ->json_is( > [ > { %{ $counter_log->to_api }, patron => $counter_log->patron->to_api( { user => $librarian } ) }, >@@ -95,7 +97,8 @@ subtest 'list() tests' => sub { > ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/counter_logs?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/counter_logs?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >diff --git a/t/db_dependent/api/v1/erm_custom_reports.t b/t/db_dependent/api/v1/erm_custom_reports.t >index ac0b97f4bd1..b7277b4afd2 100755 >--- a/t/db_dependent/api/v1/erm_custom_reports.t >+++ b/t/db_dependent/api/v1/erm_custom_reports.t >@@ -113,7 +113,8 @@ subtest "monthly_report" => sub { > my $expected_results1 = 2; # One title, with one row for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/monthly_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); >@@ -135,7 +136,8 @@ subtest "monthly_report" => sub { > my $expected_results2 = 4; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/monthly_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 4 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 3 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) >@@ -210,7 +212,8 @@ subtest "yearly_report" => sub { > my $expected_results1 = 2; # One title, with one row for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/yearly_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_yuses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_yuses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); >@@ -225,7 +228,8 @@ subtest "yearly_report" => sub { > my $expected_results2 = 4; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/yearly_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_yuses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_yuses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 4 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 3 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) >@@ -302,7 +306,8 @@ subtest "metric_types_report" => sub { > my $expected_results1 = 1; # One title > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/metric_types_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); > >@@ -323,7 +328,8 @@ subtest "metric_types_report" => sub { > my $expected_results2 = 2; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/metric_types_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results2) . '/title_id' ); >@@ -398,7 +404,8 @@ subtest "provider_rollup_report" => sub { > my $expected_results1 = 2; # One provider repeated once for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/provider_rollup_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_titles.erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_titles.erm_usage_muses' } ) >+ ->status_is(200) > ->json_is( '/' . ( $expected_results1 - 2 ) . '/provider_rollup_total' => 2, 'Total is correct' ) > ->json_is( '/' . ( $expected_results1 - 1 ) . '/provider_rollup_total' => 1, 'Total is correct' ); > >@@ -476,7 +483,8 @@ subtest "5.1 monthly_report" => sub { > my $expected_results1 = 2; # One title, with one row for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/monthly_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); >@@ -498,7 +506,8 @@ subtest "5.1 monthly_report" => sub { > my $expected_results2 = 4; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/monthly_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 4 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 3 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) >@@ -573,7 +582,8 @@ subtest "5.1 yearly_report" => sub { > my $expected_results1 = 4; # Two titles, with one row for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/yearly_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_yuses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_yuses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); >@@ -588,7 +598,8 @@ subtest "5.1 yearly_report" => sub { > my $expected_results2 = 4; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/yearly_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_yuses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_yuses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 4 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 3 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) >@@ -665,7 +676,8 @@ subtest "5.1 metric_types_report" => sub { > my $expected_results1 = 1; # One title > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/metric_types_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results1 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results1) . '/title_id' ); > >@@ -686,7 +698,8 @@ subtest "5.1 metric_types_report" => sub { > my $expected_results2 = 2; # Two titles this time > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/metric_types_report/title?$query_string_with_multiple_years" => >- { 'x-koha-embed' => 'erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_muses' } ) >+ ->status_is(200) > ->json_has( '/' . ( $expected_results2 - 2 ) . '/title_id' ) > ->json_has( '/' . ( $expected_results2 - 1 ) . '/title_id' ) > ->json_hasnt( '/' . ($expected_results2) . '/title_id' ); >@@ -761,7 +774,8 @@ subtest "5.1 provider_rollup_report" => sub { > my $expected_results1 = 2; # One provider repeated once for each metric type > > $t->get_ok( "//$userid:$password@/api/v1/erm/eUsage/provider_rollup_report/title?$query_string" => >- { 'x-koha-embed' => 'erm_usage_titles.erm_usage_muses' } )->status_is(200) >+ { 'x-koha-embed' => 'erm_usage_titles.erm_usage_muses' } ) >+ ->status_is(200) > ->json_is( '/' . ( $expected_results1 - 2 ) . '/provider_rollup_total' => 528, 'Total is correct' ) > ->json_is( '/' . ( $expected_results1 - 1 ) . '/provider_rollup_total' => 228, 'Total is correct' ); > >diff --git a/t/db_dependent/api/v1/erm_documents.t b/t/db_dependent/api/v1/erm_documents.t >index 378fca08455..a566d892d47 100755 >--- a/t/db_dependent/api/v1/erm_documents.t >+++ b/t/db_dependent/api/v1/erm_documents.t >@@ -74,7 +74,8 @@ subtest 'get() tests' => sub { > > # This document exists, should get returned > $t->get_ok( "//$userid:$password@/api/v1/erm/documents/" . $document->document_id . "/file/content" ) >- ->status_is(200)->json_is('123'); >+ ->status_is(200) >+ ->json_is('123'); > > # Create a document through a license, gets returned > my $license = $builder->build_object( { class => 'Koha::ERM::Licenses' } ); >@@ -94,7 +95,8 @@ subtest 'get() tests' => sub { > my @documents = $license->documents->as_list; > my $license_document_id = $documents[0]->document_id; > >- $t->get_ok( "//$userid:$password@/api/v1/erm/documents/" . $license_document_id . "/file/content" )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/documents/" . $license_document_id . "/file/content" ) >+ ->status_is(200) > ->content_is( decode_base64('321') ); > > # Delete a document through a license, no longer exists >@@ -122,7 +124,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $document_to_delete->id; > $document_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/documents/$non_existent_id/file/content")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/documents/$non_existent_id/file/content") >+ ->status_is(404) > ->json_is( '/error' => 'Document not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/erm_eholdings_packages.t b/t/db_dependent/api/v1/erm_eholdings_packages.t >index a7ddf28769c..1fd1ec48954 100755 >--- a/t/db_dependent/api/v1/erm_eholdings_packages.t >+++ b/t/db_dependent/api/v1/erm_eholdings_packages.t >@@ -73,7 +73,8 @@ subtest 'list() tests' => sub { > ); > > # One EHoldings package created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages") >+ ->status_is(200) > ->json_is( [ $ehpackage->to_api ] ); > > my $another_ehpackage = $builder->build_object( >@@ -103,14 +104,16 @@ subtest 'list() tests' => sub { > > # Filtering works, two EHoldings packages sharing package_type > $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages?package_type=" . $ehpackage->package_type ) >- ->status_is(200)->json_is( [ $ehpackage->to_api, $another_ehpackage->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $ehpackage->to_api, $another_ehpackage->to_api ] ); > > # Attempt to search by name like 'ko' > $ehpackage->delete; > $another_ehpackage->delete; > $ehpackage_with_another_package_type->delete; > $t->get_ok(qq~//$userid:$password@/api/v1/erm/eholdings/local/packages?q=[{"me.name":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [] ); >+ ->status_is(200) >+ ->json_is( [] ); > > my $ehpackage_to_search = $builder->build_object( > { >@@ -124,10 +127,12 @@ subtest 'list() tests' => sub { > > # Search works, searching for name like 'ko' > $t->get_ok(qq~//$userid:$password@/api/v1/erm/eholdings/local/packages?q=[{"me.name":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [ $ehpackage_to_search->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $ehpackage_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -164,12 +169,14 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This EHoldings package exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages/" . $ehpackage->package_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages/" . $ehpackage->package_id ) >+ ->status_is(200) > ->json_is( $ehpackage->to_api ); > > # Return one EHoldings package with embed > $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages/" >- . $ehpackage->package_id => { 'x-koha-embed' => 'resources+count' } )->status_is(200) >+ . $ehpackage->package_id => { 'x-koha-embed' => 'resources+count' } ) >+ ->status_is(200) > ->json_is( { %{ $ehpackage->to_api }, resources_count => 0 } ); > > # Unauthorized access >@@ -181,7 +188,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $ehpackage_to_delete->package_id; > $ehpackage_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Package not found' ); > > $schema->storage->txn_rollback; >@@ -231,7 +239,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -243,21 +252,27 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $ehpackage_id = > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/erm/eholdings/local/packages/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $ehpackage->{name} )->json_is( '/print_identifier' => $ehpackage->{print_identifier} ) >- ->json_is( '/notes' => $ehpackage->{notes} )->json_is( '/publisher_name' => $ehpackage->{publisher_name} ) >+ ) >+ ->json_is( '/name' => $ehpackage->{name} ) >+ ->json_is( '/print_identifier' => $ehpackage->{print_identifier} ) >+ ->json_is( '/notes' => $ehpackage->{notes} ) >+ ->json_is( '/publisher_name' => $ehpackage->{publisher_name} ) > ->tx->res->json->{package_id}; > > # Authorized attempt to create with null id > $ehpackage->{package_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $ehpackage->{package_id} = $ehpackage_id; >- $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages" => json => $ehpackage ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -306,7 +321,8 @@ subtest 'update() tests' => sub { > my $ehpackage_with_missing_field = { package_type => "Package type", }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/eholdings/local/packages/$ehpackage_id" => json => >- $ehpackage_with_missing_field )->status_is(400) >+ $ehpackage_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT >@@ -386,7 +402,8 @@ subtest 'delete() tests' => sub { > > # Delete existing EHolding package > $t->delete_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages/$ehpackage_id") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent EHolding package > $t->delete_ok("//$userid:$password@/api/v1/erm/eholdings/local/packages/$ehpackage_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/erm_eholdings_resources.t b/t/db_dependent/api/v1/erm_eholdings_resources.t >index 1e88c1edc7e..b9586eef8b0 100755 >--- a/t/db_dependent/api/v1/erm_eholdings_resources.t >+++ b/t/db_dependent/api/v1/erm_eholdings_resources.t >@@ -68,7 +68,8 @@ subtest 'list() tests' => sub { > my $resource = $builder->build_object( { class => 'Koha::ERM::EHoldings::Resources' } ); > > # One resource created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources") >+ ->status_is(200) > ->json_is( [ $resource->to_api ] ); > > my $another_resource = $builder->build_object( >@@ -90,10 +91,12 @@ subtest 'list() tests' => sub { > > # Filtering works, two resources sharing vendor_id > $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/resources?vendor_id=" . $resource->vendor_id ) >- ->status_is(200)->json_is( [ $resource->to_api, $another_resource->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $resource->to_api, $another_resource->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -130,7 +133,8 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This resource exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/resources/" . $resource->resource_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/resources/" . $resource->resource_id ) >+ ->status_is(200) > ->json_is( $resource->to_api ); > > # Unauthorized access >@@ -142,7 +146,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $resource_to_delete->resource_id; > $resource_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/resources/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'eHolding resource not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/erm_eholdings_titles.t b/t/db_dependent/api/v1/erm_eholdings_titles.t >index 7aa914339e0..1203f2aee04 100755 >--- a/t/db_dependent/api/v1/erm_eholdings_titles.t >+++ b/t/db_dependent/api/v1/erm_eholdings_titles.t >@@ -72,7 +72,8 @@ subtest 'list() tests' => sub { > my $ehtitle = $builder->build_object( { class => 'Koha::ERM::EHoldings::Titles' } ); > > # One EHoldings title created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles") >+ ->status_is(200) > ->json_is( [ $ehtitle->to_api ] ); > > my $another_ehtitle = $builder->build_object( >@@ -95,14 +96,16 @@ subtest 'list() tests' => sub { > # Filtering works, two EHoldings titles sharing publication_type > $t->get_ok( > "//$userid:$password@/api/v1/erm/eholdings/local/titles?publication_type=" . $ehtitle->publication_type ) >- ->status_is(200)->json_is( [ $ehtitle->to_api, $another_ehtitle->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $ehtitle->to_api, $another_ehtitle->to_api ] ); > > # Attempt to search by publication_title like 'ko' > $ehtitle->delete; > $another_ehtitle->delete; > $ehtitle_with_another_publication_type->delete; > $t->get_ok(qq~//$userid:$password@/api/v1/erm/eholdings/local/titles?q=[{"me.publication_title":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [] ); >+ ->status_is(200) >+ ->json_is( [] ); > > my $ehtitle_to_search = $builder->build_object( > { >@@ -115,10 +118,12 @@ subtest 'list() tests' => sub { > > # Search works, searching for publication_title like 'ko' > $t->get_ok(qq~//$userid:$password@/api/v1/erm/eholdings/local/titles?q=[{"me.publication_title":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [ $ehtitle_to_search->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $ehtitle_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -155,12 +160,14 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This EHoldings title exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" . $ehtitle->title_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" . $ehtitle->title_id ) >+ ->status_is(200) > ->json_is( $ehtitle->to_api ); > > # Return one EHoldings title with embed > $t->get_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" >- . $ehtitle->title_id => { 'x-koha-embed' => 'resources,resources.package' } )->status_is(200) >+ . $ehtitle->title_id => { 'x-koha-embed' => 'resources,resources.package' } ) >+ ->status_is(200) > ->json_is( { %{ $ehtitle->to_api }, resources => [] } ); > > # Unauthorized access >@@ -171,7 +178,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $ehtitle_to_delete->title_id; > $ehtitle_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'eHolding title not found' ); > > $schema->storage->txn_rollback; >@@ -241,7 +249,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -253,12 +262,16 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $ehtitle_id = > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/erm/eholdings/local/titles/\d*|, > 'REST3.4.1' >- )->json_is( '/publication_title' => $ehtitle->{publication_title} ) >- ->json_is( '/print_identifier' => $ehtitle->{print_identifier} )->json_is( '/notes' => $ehtitle->{notes} ) >- ->json_is( '/publisher_name' => $ehtitle->{publisher_name} )->tx->res->json->{title_id}; >+ ) >+ ->json_is( '/publication_title' => $ehtitle->{publication_title} ) >+ ->json_is( '/print_identifier' => $ehtitle->{print_identifier} ) >+ ->json_is( '/notes' => $ehtitle->{notes} ) >+ ->json_is( '/publisher_name' => $ehtitle->{publisher_name} ) >+ ->tx->res->json->{title_id}; > > # Import titles from virtualshelf to package > my $ehpackage_id = $builder->build_object( { class => 'Koha::ERM::EHoldings::Packages' } )->package_id; >@@ -277,21 +290,25 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/import" => json => $import_request ) >- ->status_is(201)->json_has('/job_id'); >+ ->status_is(201) >+ ->json_has('/job_id'); > > # Attempt to import titles from a virtualshelf that doesn't exist > $virtual_shelf->delete; > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/import" => json => $import_request ) >- ->status_is(404)->json_is( '/error' => 'List not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'List not found' ); > > # Authorized attempt to create with null id > $ehtitle->{title_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $ehtitle->{title_id} = $ehtitle_id; >- $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles" => json => $ehtitle ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -312,7 +329,8 @@ subtest 'add() tests' => sub { > $request_body->{create_linked_biblio} = 1; > my $biblios_count = Koha::Biblios->search()->count; > $t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" => json => $request_body ) >- ->status_is(201)->json_is( '/publication_title' => 'Publication title' ); >+ ->status_is(201) >+ ->json_is( '/publication_title' => 'Publication title' ); > my $new_biblios_count = Koha::Biblios->search()->count; > is( $new_biblios_count, $biblios_count + 1, "Biblio was added" ); > }; >@@ -359,7 +377,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => $ehtitle_with_missing_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Missing property.", >@@ -398,7 +417,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => $ehtitle_with_updated_field ) >- ->status_is(200)->json_is( '/publication_title' => 'Publication title' ); >+ ->status_is(200) >+ ->json_is( '/publication_title' => 'Publication title' ); > > # Authorized attempt to write invalid data > my $ehtitle_with_invalid_field = { >@@ -409,7 +429,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => $ehtitle_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -446,7 +467,8 @@ subtest 'update() tests' => sub { > my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => >- { %$ehtitle_updated_title, create_linked_biblio => 1 } )->status_is(200) >+ { %$ehtitle_updated_title, create_linked_biblio => 1 } ) >+ ->status_is(200) > ->json_is( '/publication_title' => 'The journal of writing unit tests :' ); > > $biblio->discard_changes; >@@ -502,7 +524,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id")->status_is(403); > > # Delete existing EHolding title >- $t->delete_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent EHolding title >diff --git a/t/db_dependent/api/v1/erm_licenses.t b/t/db_dependent/api/v1/erm_licenses.t >index fd9ce39b7b4..92b710fdd79 100755 >--- a/t/db_dependent/api/v1/erm_licenses.t >+++ b/t/db_dependent/api/v1/erm_licenses.t >@@ -88,14 +88,16 @@ subtest 'list() tests' => sub { > ); > > # Filtering works, two licenses sharing vendor_id >- $t->get_ok( "//$userid:$password@/api/v1/erm/licenses?vendor_id=" . $license->vendor_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/licenses?vendor_id=" . $license->vendor_id ) >+ ->status_is(200) > ->json_is( [ $license->to_api, $another_license->to_api ] ); > > # Attempt to search by name like 'ko' > $license->delete; > $another_license->delete; > $license_with_another_vendor_id->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/licenses?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/licenses?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $license_to_search = $builder->build_object( >@@ -108,11 +110,13 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for name like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/licenses?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/licenses?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $license_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/licenses?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/licenses?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -149,13 +153,15 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This license exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/erm/licenses/" . $license->license_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/erm/licenses/" . $license->license_id ) >+ ->status_is(200) > ->json_is( $license->to_api ); > > # Return one license with embed > $t->get_ok( > "//$userid:$password@/api/v1/erm/licenses/" . $license->license_id => { 'x-koha-embed' => 'documents' } ) >- ->status_is(200)->json_is( { %{ $license->to_api }, documents => [] } ); >+ ->status_is(200) >+ ->json_is( { %{ $license->to_api }, documents => [] } ); > > # Unauthorized access > $t->get_ok( "//$unauth_userid:$password@/api/v1/erm/licenses/" . $license->license_id )->status_is(403); >@@ -165,7 +171,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $license_to_delete->license_id; > $license_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/licenses/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/licenses/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'License not found' ); > > $schema->storage->txn_rollback; >@@ -220,7 +227,8 @@ subtest 'add() tests' => sub { > ended_on => undef, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/erm/licenses" => json => $license_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/licenses" => json => $license_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -232,12 +240,16 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $license_id = >- $t->post_ok( "//$userid:$password@/api/v1/erm/licenses" => json => $license )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$userid:$password@/api/v1/erm/licenses" => json => $license ) >+ ->status_is( 201, 'REST3.2.1' ) > ->header_like( > Location => qr|^/api/v1/erm/licenses/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $license->{name} )->json_is( '/description' => $license->{description} ) >- ->json_is( '/type' => $license->{type} )->json_is( '/status' => $license->{status} ) >+ ) >+ ->json_is( '/name' => $license->{name} ) >+ ->json_is( '/description' => $license->{description} ) >+ ->json_is( '/type' => $license->{type} ) >+ ->json_is( '/status' => $license->{status} ) > ->tx->res->json->{license_id}; > > # Authorized attempt to create with null id >@@ -300,7 +312,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/licenses/$license_id" => json => $license_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $license_with_updated_field = { >@@ -313,7 +326,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/licenses/$license_id" => json => $license_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'New name' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'New name' ); > > # Authorized attempt to write invalid data > my $license_with_invalid_field = { >@@ -327,7 +341,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/licenses/$license_id" => json => $license_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -385,7 +400,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/erm/licenses/$license_id")->status_is(403); > > # Delete existing license >- $t->delete_ok("//$userid:$password@/api/v1/erm/licenses/$license_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/erm/licenses/$license_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent license >diff --git a/t/db_dependent/api/v1/erm_usage_data_providers.t b/t/db_dependent/api/v1/erm_usage_data_providers.t >index 2d161515529..e8731300bf8 100755 >--- a/t/db_dependent/api/v1/erm_usage_data_providers.t >+++ b/t/db_dependent/api/v1/erm_usage_data_providers.t >@@ -104,7 +104,8 @@ subtest 'list() tests' => sub { > $usage_data_provider->delete; > $another_usage_data_provider->delete; > $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_data_providers?q=[{"me.name":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [] ); >+ ->status_is(200) >+ ->json_is( [] ); > > my $usage_data_provider_to_search = $builder->build_object( > { >@@ -118,10 +119,12 @@ subtest 'list() tests' => sub { > > # Search works, searching for name like 'ko' > $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_data_providers?q=[{"me.name":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [$search_udp_result] ); >+ ->status_is(200) >+ ->json_is( [$search_udp_result] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/usage_data_providers?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/usage_data_providers?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -160,7 +163,8 @@ subtest 'get() tests' => sub { > # This usage_data_provider exists, should get returned > $t->get_ok( > "//$userid:$password@/api/v1/erm/usage_data_providers/" . $usage_data_provider->erm_usage_data_provider_id ) >- ->status_is(200)->json_is( $usage_data_provider->to_api ); >+ ->status_is(200) >+ ->json_is( $usage_data_provider->to_api ); > > # Unauthorized access > $t->get_ok( "//$unauth_userid:$password@/api/v1/erm/usage_data_providers/" >@@ -171,7 +175,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $usage_data_provider_to_delete->erm_usage_data_provider_id; > $usage_data_provider_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/erm/usage_data_providers/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/erm/usage_data_providers/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Usage data provider not found' ); > > $schema->storage->txn_rollback; >@@ -229,7 +234,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( > "//$userid:$password@/api/v1/erm/usage_data_providers" => json => $usage_data_provider_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -241,10 +247,12 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $usage_data_provider_id = > $t->post_ok( "//$userid:$password@/api/v1/erm/usage_data_providers" => json => $usage_data_provider ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/erm/usage_data_providers/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $usage_data_provider->{name} ) >+ ) >+ ->json_is( '/name' => $usage_data_provider->{name} ) > ->json_is( '/customer_id' => $usage_data_provider->{customer_id} ) > ->json_is( '/requestor_id' => $usage_data_provider->{requestor_id} ) > ->json_is( '/api_key' => $usage_data_provider->{api_key} ) >@@ -255,12 +263,14 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with null id > $usage_data_provider->{erm_usage_data_provider_id} = undef; > $t->post_ok( "//$userid:$password@/api/v1/erm/usage_data_providers" => json => $usage_data_provider ) >- ->status_is(400)->json_has('/errors'); >+ ->status_is(400) >+ ->json_has('/errors'); > > # Authorized attempt to create with existing id > $usage_data_provider->{erm_usage_data_provider_id} = $usage_data_provider_id; > $t->post_ok( "//$userid:$password@/api/v1/erm/usage_data_providers" => json => $usage_data_provider ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Read-only.", >@@ -316,7 +326,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/erm/usage_data_providers/$usage_data_provider_id" => json => >- $usage_data_provider_with_missing_field )->status_is(400) >+ $usage_data_provider_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT >@@ -402,7 +413,8 @@ subtest 'delete() tests' => sub { > > # Delete existing usage_data_provider > $t->delete_ok("//$userid:$password@/api/v1/erm/usage_data_providers/$usage_data_provider_id") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent usage_data_provider > $t->delete_ok("//$userid:$password@/api/v1/erm/usage_data_providers/$usage_data_provider_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/erm_usage_titles.t b/t/db_dependent/api/v1/erm_usage_titles.t >index dd04ec2e569..ca5cd9008ba 100755 >--- a/t/db_dependent/api/v1/erm_usage_titles.t >+++ b/t/db_dependent/api/v1/erm_usage_titles.t >@@ -79,13 +79,15 @@ subtest 'list() tests' => sub { > ); > > # Two usage_titles created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/erm/usage_titles")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/usage_titles") >+ ->status_is(200) > ->json_is( [ $usage_title->to_api, $another_usage_title->to_api, ] ); > > # Attempt to search by title like 'ko' > $usage_title->delete; > $another_usage_title->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_titles?q=[{"me.title":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_titles?q=[{"me.title":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $usage_title_to_search = $builder->build_object( >@@ -98,11 +100,13 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for title like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_titles?q=[{"me.title":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/erm/usage_titles?q=[{"me.title":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $usage_title_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/usage_titles?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/usage_titles?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >diff --git a/t/db_dependent/api/v1/erm_users.t b/t/db_dependent/api/v1/erm_users.t >index 19ea928570b..b900e24e697 100755 >--- a/t/db_dependent/api/v1/erm_users.t >+++ b/t/db_dependent/api/v1/erm_users.t >@@ -61,7 +61,8 @@ subtest 'list() tests' => sub { > ## Authorized user tests > # One erm_user created, should get returned > $librarian->discard_changes; >- $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/users") >+ ->status_is(200) > ->json_is( [ $librarian->to_api( { user => $librarian } ) ] ); > > my $another_erm_user = $builder->build_object( >@@ -72,7 +73,8 @@ subtest 'list() tests' => sub { > ); > > # Two erm_users created, only self is returned without permission to view_any_borrower >- $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/users") >+ ->status_is(200) > ->json_is( [ $librarian->to_api( { user => $librarian } ) ] ); > > my $dbh = C4::Context->dbh; >@@ -82,12 +84,14 @@ subtest 'list() tests' => sub { > ); > > # Two erm_users created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/users") >+ ->status_is(200) > ->json_is( > [ $librarian->to_api( { user => $librarian } ), $another_erm_user->to_api( { user => $another_erm_user } ) ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/users?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/users?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > my $patron = $builder->build_object( >diff --git a/t/db_dependent/api/v1/extended_attribute_types.t b/t/db_dependent/api/v1/extended_attribute_types.t >index c293cb73bfe..ce63cb1ee57 100755 >--- a/t/db_dependent/api/v1/extended_attribute_types.t >+++ b/t/db_dependent/api/v1/extended_attribute_types.t >@@ -73,7 +73,8 @@ subtest 'list() tests' => sub { > ); > > # One additional_field created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types") >+ ->status_is(200) > ->json_is( [ $additional_field->to_api ] ); > > my $another_additional_field = $builder->build_object( >@@ -117,15 +118,18 @@ subtest 'list() tests' => sub { > ); > > # Filtering works, two existing additional fields returned for the queried table name >- $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=invoice")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=invoice") >+ ->status_is(200) > ->json_is( [ $additional_field->to_api, $another_additional_field->to_api ] ); > > # Filtering works for unmapped tablename >- $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=subscription")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=subscription") >+ ->status_is(200) > ->json_is( [ $additional_field_yet_another_different_tablename->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -208,16 +212,19 @@ subtest 'list_erm() tests' => sub { > ); > > # Filtering works, two existing additional fields returned for the queried table name >- $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?resource_type=license")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?resource_type=license") >+ ->status_is(200) > ->json_is( [ $erm_license_additional_field->to_api ] ); > > # Cannot retrieve attributes from other tables >- $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?resource_type=order")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?resource_type=order") >+ ->status_is(400) > ->json_is( "/errors" => > [ { message => "Not in enum list: license, agreement, package, title.", path => "/resource_type" } ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/erm/extended_attribute_types?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # erm only user >diff --git a/t/db_dependent/api/v1/file_transports.t b/t/db_dependent/api/v1/file_transports.t >index f59e79db13f..4a2846a92d3 100755 >--- a/t/db_dependent/api/v1/file_transports.t >+++ b/t/db_dependent/api/v1/file_transports.t >@@ -78,7 +78,8 @@ subtest 'list() tests' => sub { > ); > > # One file transport created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/config/file_transports")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/config/file_transports") >+ ->status_is(200) > ->json_is( [ $file_transport->to_api ] ); > > my $another_file_transport = $builder->build_object( >@@ -94,7 +95,8 @@ subtest 'list() tests' => sub { > ); > > # Two File transports created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/config/file_transports")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/config/file_transports") >+ ->status_is(200) > ->json_is( [ $file_transport->to_api, $another_file_transport->to_api, ] ); > > # Unauthorized access >@@ -140,7 +142,8 @@ subtest 'get() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/config/file_transports/" . $file_transport->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/config/file_transports/" . $file_transport->id ) >+ ->status_is(200) > ->json_is( $file_transport->to_api ); > > $t->get_ok( "//$unauth_userid:$password@/api/v1/config/file_transports/" . $file_transport->id )->status_is(403); >@@ -159,7 +162,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $file_transport_to_delete->id; > $file_transport_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/config/file_transports/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/config/file_transports/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'File transport not found' ); > > $schema->storage->txn_rollback; >@@ -219,7 +223,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -233,16 +238,19 @@ subtest 'add() tests' => sub { > $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_data ) > ->status_is( 201, 'SWAGGER3.2.1' ) > ->header_like( Location => qr|^\/api\/v1\/config\/file_transports\/\d*|, 'SWAGGER3.4.1' ) >- ->json_is( '/name' => $file_transport_data->{name} )->tx->res->json->{file_transport_id}; >+ ->json_is( '/name' => $file_transport_data->{name} ) >+ ->tx->res->json->{file_transport_id}; > > # Authorized attempt to create with null id > $file_transport_data->{file_transport_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_data ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $file_transport_data->{file_transport_id} = $file_transport_id; >- $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/config/file_transports" => json => $file_transport_data ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -304,7 +312,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/config/file_transports/$file_transport_id" => json => >- $file_transport_with_missing_field )->status_is(400) >+ $file_transport_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT >@@ -400,7 +409,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/config/file_transports/$file_transport_id")->status_is(403); > > $t->delete_ok("//$userid:$password@/api/v1/config/file_transports/$file_transport_id") >- ->status_is( 204, 'SWAGGER3.2.4' )->content_is( '', 'SWAGGER3.3.4' ); >+ ->status_is( 204, 'SWAGGER3.2.4' ) >+ ->content_is( '', 'SWAGGER3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/config/file_transports/$file_transport_id")->status_is(404); > >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index e0f2183f53d..4181a667564 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -209,26 +209,33 @@ subtest "Test endpoints with permission" => sub { > > $t->get_ok("//$userid_1:$password@/api/v1/holds")->status_is(200)->json_has('/0')->json_has('/1')->json_hasnt('/2'); > >- $t->get_ok("//$userid_1:$password@/api/v1/holds?priority=2")->status_is(200) >- ->json_is( '/0/patron_id', $patron_2->borrowernumber )->json_hasnt('/1'); >+ $t->get_ok("//$userid_1:$password@/api/v1/holds?priority=2") >+ ->status_is(200) >+ ->json_is( '/0/patron_id', $patron_2->borrowernumber ) >+ ->json_hasnt('/1'); > >- $t->delete_ok("//$userid_3:$password@/api/v1/holds/$reserve_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid_3:$password@/api/v1/holds/$reserve_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > >- $t->patch_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $patch_data )->status_is(404) >+ $t->patch_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $patch_data ) >+ ->status_is(404) > ->json_has('/error'); > > $t->delete_ok("//$userid_3:$password@/api/v1/holds/$reserve_id")->status_is(404)->json_has('/error'); > >- $t->get_ok( "//$userid_3:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )->status_is(200) >+ $t->get_ok( "//$userid_3:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber ) >+ ->status_is(200) > ->json_is( [] ); > > my $inexisting_borrowernumber = $patron_2->borrowernumber * 2; >- $t->get_ok("//$userid_1:$password@/api/v1/holds?patron_id=$inexisting_borrowernumber")->status_is(200) >+ $t->get_ok("//$userid_1:$password@/api/v1/holds?patron_id=$inexisting_borrowernumber") >+ ->status_is(200) > ->json_is( [] ); > > $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" => json => "Cancellation reason" ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Make sure pickup location checks doesn't get in the middle > my $mock_biblio = Test::MockModule->new('Koha::Biblio'); >@@ -236,24 +243,29 @@ subtest "Test endpoints with permission" => sub { > my $mock_item = Test::MockModule->new('Koha::Item'); > $mock_item->mock( 'pickup_locations', sub { return Koha::Libraries->search } ); > >- $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )->status_is(201)->json_has('/hold_id') >+ $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(201) >+ ->json_has('/hold_id') > ->header_is( 'Location' => '/api/v1/holds/' . $t->tx->res->json->{hold_id}, "REST3.4.1" ); > > # Get id from response > $reserve_id = $t->tx->res->json->{hold_id}; > >- $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )->status_is(200) >+ $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber ) >+ ->status_is(200) > ->json_is( '/0/hold_id', $reserve_id ) > ->json_is( '/0/expiration_date', output_pref( { dt => $expiration_date, dateformat => 'iso', dateonly => 1 } ) ) > ->json_is( '/0/pickup_library_id', $branchcode ); > >- $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )->status_is(403) >+ $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(403) > ->json_like( '/error', qr/itemAlreadyOnHold/ ); > > $post_data->{biblio_id} = $biblio_2->biblionumber; > $post_data->{item_id} = $item_2->itemnumber; > >- $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )->status_is(403) >+ $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(403) > ->json_like( '/error', qr/Hold cannot be placed. Reason: tooManyReserves/ ); > > my $to_delete_patron = $builder->build_object( { class => 'Koha::Patrons' } ); >@@ -262,7 +274,8 @@ subtest "Test endpoints with permission" => sub { > > my $tmp_patron_id = $post_data->{patron_id}; > $post_data->{patron_id} = $deleted_patron_id; >- $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )->status_is(400) >+ $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(400) > ->json_is( { error => 'patron_id not found' } ); > > # Restore the original patron_id as it is expected by the next subtest >@@ -280,7 +293,8 @@ subtest 'Reserves with itemtype' => sub { > item_type_id => $itemtype, > }; > >- $t->delete_ok("//$userid_3:$password@/api/v1/holds/$reserve_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid_3:$password@/api/v1/holds/$reserve_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Make sure pickup location checks doesn't get in the middle >@@ -293,8 +307,10 @@ subtest 'Reserves with itemtype' => sub { > > $reserve_id = $t->tx->res->json->{hold_id}; > >- $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )->status_is(200) >- ->json_is( '/0/hold_id', $reserve_id )->json_is( '/0/item_type_id', $itemtype ); >+ $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber ) >+ ->status_is(200) >+ ->json_is( '/0/hold_id', $reserve_id ) >+ ->json_is( '/0/item_type_id', $itemtype ); > }; > > subtest 'test AllowHoldDateInFuture' => sub { >@@ -326,7 +342,8 @@ subtest 'test AllowHoldDateInFuture' => sub { > my $mock_item = Test::MockModule->new('Koha::Item'); > $mock_item->mock( 'pickup_locations', sub { return Koha::Libraries->search } ); > >- $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )->status_is(201) >+ $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(201) > ->json_is( '/hold_date', output_pref( { dt => $future_hold_date, dateformat => 'iso', dateonly => 1 } ) ); > }; > >@@ -385,7 +402,8 @@ subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > > $can_item_be_reserved_result = { status => 'ageRestricted' }; > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data )->status_is(403) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(403) > ->json_is( '/error' => "Hold cannot be placed. Reason: ageRestricted" ); > > # x-koha-override doesn't override if AllowHoldPolicyOverride not set >@@ -396,7 +414,8 @@ subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > > $can_item_be_reserved_result = { status => 'pickupNotInHoldGroup' }; > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data )->status_is(403) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(403) > ->json_is( '/error' => "Hold cannot be placed. Reason: pickupNotInHoldGroup" ); > > # x-koha-override overrides the status >@@ -494,7 +513,8 @@ subtest 'suspend and resume tests' => sub { > 'Hold suspension has correct end date' > ); > >- $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Pass a an expiration date for the suspension >@@ -503,12 +523,14 @@ subtest 'suspend and resume tests' => sub { > . $hold->id > . "/suspension" => json => > { end_date => output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) } ) >- ->status_is( 201, 'Hold suspension created' )->json_is( >+ ->status_is( 201, 'Hold suspension created' ) >+ ->json_is( > '/end_date', > output_pref( { dt => $date, dateformat => 'iso', dateonly => 1 } ) >- )->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' ); >+ )->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' ); > >- $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $hold->set_waiting->discard_changes; >@@ -694,14 +716,16 @@ subtest 'PUT /holds/{hold_id}/priority tests' => sub { > > $t->put_ok( "//$userid_np:$password@/api/v1/holds/" . $hold_3->id . "/priority" => json => 1 )->status_is(403); > >- $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold_3->id . "/priority" => json => 1 )->status_is(200) >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold_3->id . "/priority" => json => 1 ) >+ ->status_is(200) > ->json_is(1); > > is( $hold_1->discard_changes->priority, 2, 'Priority adjusted correctly' ); > is( $hold_2->discard_changes->priority, 3, 'Priority adjusted correctly' ); > is( $hold_3->discard_changes->priority, 1, 'Priority adjusted correctly' ); > >- $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold_3->id . "/priority" => json => 3 )->status_is(200) >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold_3->id . "/priority" => json => 3 ) >+ ->status_is(200) > ->json_is(3); > > is( $hold_1->discard_changes->priority, 1, 'Priority adjusted correctly' ); >@@ -881,7 +905,8 @@ subtest 'add() + can_place_holds() tests' => sub { > my $hold_id = > $t->post_ok( > "//$userid:$password@/api/v1/holds" => { 'x-koha-override' => 'debt_limit' } => json => $post_data ) >- ->status_is( 201, "Override works for 'debt_limit'" )->tx->res->json->{hold_id}; >+ ->status_is( 201, "Override works for 'debt_limit'" ) >+ ->tx->res->json->{hold_id}; > > Koha::Holds->find($hold_id)->delete(); > >@@ -1004,7 +1029,8 @@ subtest 'add() + can_place_holds() tests' => sub { > > my $hold_id = $t->post_ok( > "//$userid:$password@/api/v1/holds" => { 'x-koha-override' => 'hold_limit' } => json => $post_data ) >- ->status_is( 201, "Override works for 'hold_limit'" )->tx->res->json->{hold_id}; >+ ->status_is( 201, "Override works for 'hold_limit'" ) >+ ->tx->res->json->{hold_id}; > > Koha::Holds->find($hold_id)->delete(); > >@@ -1284,20 +1310,24 @@ subtest 'edit() tests' => sub { > }; > > $t->patch_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id => json => $biblio_hold_data ) >- ->status_is(400)->json_is( { error => 'The supplied pickup location is not valid' } ); >+ ->status_is(400) >+ ->json_is( { error => 'The supplied pickup location is not valid' } ); > >- $t->put_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id => json => $biblio_hold_data )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id => json => $biblio_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $biblio_hold->discard_changes; > is( $biblio_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); > > $t->patch_ok( "//$userid:$password@/api/v1/holds/" >- . $biblio_hold->id => { 'x-koha-override' => 'any' } => json => $biblio_hold_data )->status_is(200) >+ . $biblio_hold->id => { 'x-koha-override' => 'any' } => json => $biblio_hold_data ) >+ ->status_is(200) > ->json_has( '/pickup_library_id' => $library_1->id ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" >- . $biblio_hold->id => { 'x-koha-override' => 'any' } => json => $biblio_hold_data )->status_is(200) >+ . $biblio_hold->id => { 'x-koha-override' => 'any' } => json => $biblio_hold_data ) >+ ->status_is(200) > ->json_has( '/pickup_library_id' => $library_1->id ); > > $biblio_hold_data->{pickup_library_id} = $library_2->branchcode; >@@ -1347,21 +1377,25 @@ subtest 'edit() tests' => sub { > priority => $item_hold_api_data->{priority} > }; > >- $t->patch_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id => json => $item_hold_data )->status_is(400) >+ $t->patch_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id => json => $item_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > >- $t->put_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id => json => $item_hold_data )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id => json => $item_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $item_hold->discard_changes; > is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); > > $t->patch_ok( "//$userid:$password@/api/v1/holds/" >- . $item_hold->id => { 'x-koha-override' => 'any' } => json => $item_hold_data )->status_is(200) >+ . $item_hold->id => { 'x-koha-override' => 'any' } => json => $item_hold_data ) >+ ->status_is(200) > ->json_has( '/pickup_library_id' => $library_1->id ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" >- . $item_hold->id => { 'x-koha-override' => 'any' } => json => $item_hold_data )->status_is(200) >+ . $item_hold->id => { 'x-koha-override' => 'any' } => json => $item_hold_data ) >+ ->status_is(200) > ->json_has( '/pickup_library_id' => $library_1->id ); > > $item_hold_data->{pickup_library_id} = $library_2->branchcode; >@@ -1484,7 +1518,8 @@ subtest 'add() tests' => sub { > pickup_library_id => $library_1->branchcode, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $biblio_hold_data->{pickup_library_id} = $library_2->branchcode; >@@ -1513,7 +1548,8 @@ subtest 'add() tests' => sub { > pickup_library_id => $library_1->branchcode, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $biblio_hold_data->{pickup_library_id} = $library_2->branchcode; >@@ -1541,7 +1577,8 @@ subtest 'add() tests' => sub { > pickup_library_id => $library_1->branchcode, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $can_item_be_reserved = 'notReservable'; >@@ -1566,7 +1603,8 @@ subtest 'add() tests' => sub { > } > ); > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > # empty cases >@@ -1577,7 +1615,8 @@ subtest 'add() tests' => sub { > } > ); > >- $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) >+ ->status_is(400) > ->json_is( { error => 'The supplied pickup location is not valid' } ); > > $schema->storage->txn_rollback; >@@ -1637,14 +1676,16 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(200) >+ . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(200) > ->json_is( { pickup_library_id => $library_2->branchcode } ); > > is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } )->status_is(400) >+ . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) > ->json_is( { error => '[The supplied pickup location is not valid]' } ); > > is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library unchanged' ); >@@ -1665,7 +1706,8 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > # Attempt to use an invalid pickup locations ends in 400 > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } )->status_is(400) >+ . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) > ->json_is( { error => '[The supplied pickup location is not valid]' } ); > > is( $hold->discard_changes->branchcode, $library_1->branchcode, 'pickup library unchanged' ); >@@ -1676,7 +1718,8 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id > . "/pickup_location" => { 'x-koha-override' => 'any' } => json => >- { pickup_library_id => $library_2->branchcode } )->status_is(200) >+ { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(200) > ->json_is( { pickup_library_id => $library_2->branchcode } ); > > is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library changed' ); >@@ -1685,14 +1728,16 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(200) >+ . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(200) > ->json_is( { pickup_library_id => $library_2->branchcode } ); > > is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } )->status_is(400) >+ . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) > ->json_is( { error => '[The supplied pickup location is not valid]' } ); > > is( $hold->discard_changes->branchcode, $library_2->branchcode, 'invalid pickup library not used' ); >@@ -1700,7 +1745,8 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $hold->id > . "/pickup_location" => { 'x-koha-override' => 'any' } => json => >- { pickup_library_id => $library_3->branchcode } )->status_is(400) >+ { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) > ->json_is( { error => '[The supplied pickup location is not valid]' } ); > > is( >@@ -1714,17 +1760,20 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $waiting_hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(409) >+ . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(409) > ->json_is( { error => q{Cannot change pickup location}, error_code => 'hold_waiting' } ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $in_processing_hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(409) >+ . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(409) > ->json_is( { error => q{Cannot change pickup location}, error_code => 'hold_in_processing' } ); > > $t->put_ok( "//$userid:$password@/api/v1/holds/" > . $in_transit_hold->id >- . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(200) >+ . "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } ) >+ ->status_is(200) > ->json_is( { pickup_library_id => $library_2->branchcode } ); > > $schema->storage->txn_rollback; >@@ -1778,7 +1827,8 @@ subtest 'delete() tests' => sub { > ) > ); > >- $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $hold = Koha::Holds->find( >@@ -1794,7 +1844,8 @@ subtest 'delete() tests' => sub { > ); > > $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{} } ) >- ->status_is( 204, 'Same behavior if header not set' )->content_is(''); >+ ->status_is( 204, 'Same behavior if header not set' ) >+ ->content_is(''); > > $hold = Koha::Holds->find( > AddReserve( >@@ -1810,7 +1861,8 @@ subtest 'delete() tests' => sub { > > $t->delete_ok( > "//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{cancellation-request-flow} } ) >- ->status_is( 204, 'Same behavior if header set but hold not waiting' )->content_is(''); >+ ->status_is( 204, 'Same behavior if header set but hold not waiting' ) >+ ->content_is(''); > > $hold = Koha::Holds->find( > AddReserve( >@@ -1886,7 +1938,8 @@ subtest 'delete_bulk) tests' => sub { > ); > > $t->delete_ok( "//$userid:$password@/api/v1/holds/cancellation_bulk" => json => { hold_ids => [ $hold->id ] } ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > is( $hold->get_from_storage, undef, "Hold has been successfully deleted" ); > >@@ -1907,7 +1960,8 @@ subtest 'delete_bulk) tests' => sub { > $mock_letters->mock( 'GetPreparedLetter', sub { return } ); > > $t->delete_ok( "//$userid:$password@/api/v1/holds/cancellation_bulk" => json => >- { hold_ids => [ $hold_2->id ], cancellation_reason => 'DAMAGED' } )->status_is( 204, 'REST3.2.4' ) >+ { hold_ids => [ $hold_2->id ], cancellation_reason => 'DAMAGED' } ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > my $old_hold_2 = Koha::Old::Holds->find( $hold_2->id ); >@@ -2027,7 +2081,8 @@ subtest 'Bug 40866: API hold creation with override logs confirmations' => sub { > # Create hold with override > my $hold_id = > $t->post_ok( "//$userid:$password@/api/v1/holds" => { 'x-koha-override' => 'any' } => json => $post_data ) >- ->status_is(201)->tx->res->json->{hold_id}; >+ ->status_is(201) >+ ->tx->res->json->{hold_id}; > > ok( $hold_id, 'Hold created via API with override' ); > >diff --git a/t/db_dependent/api/v1/ill_backends.t b/t/db_dependent/api/v1/ill_backends.t >index 1fc82eb0ab3..973d6ab4635 100755 >--- a/t/db_dependent/api/v1/ill_backends.t >+++ b/t/db_dependent/api/v1/ill_backends.t >@@ -187,11 +187,13 @@ subtest 'list() tests' => sub { > > #Check for backend existing statuses > $t->get_ok( "//$userid:$password@/api/v1/ill/backends/Mock" => { 'x-koha-embed' => 'statuses+strings' } ) >- ->status_is(200)->json_has( '/statuses', [ $backend_status, $core_status, $alias_status ] ); >+ ->status_is(200) >+ ->json_has( '/statuses', [ $backend_status, $core_status, $alias_status ] ); > > #Check for backend existing statuses of a backend that doesn't exist > $t->get_ok( "//$userid:$password@/api/v1/ill/backends/GhostBackend" => { 'x-koha-embed' => 'statuses+strings' } ) >- ->status_is(200)->json_hasnt('statuses'); >+ ->status_is(200) >+ ->json_hasnt('statuses'); > > # Unauthorized attempt to list > $t->get_ok("//$unauth_userid:$password@/api/v1/ill/backends")->status_is(403); >diff --git a/t/db_dependent/api/v1/ill_batches.t b/t/db_dependent/api/v1/ill_batches.t >index 25d5a40735b..76f9f2f9b95 100755 >--- a/t/db_dependent/api/v1/ill_batches.t >+++ b/t/db_dependent/api/v1/ill_batches.t >@@ -94,11 +94,16 @@ subtest 'list() tests' => sub { > > # One batch created, should get returned > $t->get_ok( "//$userid:$password@/api/v1/ill/batches?q=" >- . encode_json($query) => { 'x-koha-embed' => '+strings,requests+count,patron,library' } )->status_is(200) >- ->json_has( '/0/ill_batch_id', 'Batch ID' )->json_has( '/0/name', 'Batch name' ) >- ->json_has( '/0/backend', 'Backend name' )->json_has( '/0/patron_id', 'Borrowernumber' ) >- ->json_has( '/0/library_id', 'Branchcode' )->json_has( '/0/patron', 'patron embedded' ) >- ->json_has( '/0/library', 'branch embedded' )->json_has( '/0/requests_count', 'request count' ); >+ . encode_json($query) => { 'x-koha-embed' => '+strings,requests+count,patron,library' } ) >+ ->status_is(200) >+ ->json_has( '/0/ill_batch_id', 'Batch ID' ) >+ ->json_has( '/0/name', 'Batch name' ) >+ ->json_has( '/0/backend', 'Backend name' ) >+ ->json_has( '/0/patron_id', 'Borrowernumber' ) >+ ->json_has( '/0/library_id', 'Branchcode' ) >+ ->json_has( '/0/patron', 'patron embedded' ) >+ ->json_has( '/0/library', 'branch embedded' ) >+ ->json_has( '/0/requests_count', 'request count' ); > > # Create a second batch with a different name > my $batch_2 = $builder->build_object( { class => 'Koha::ILL::Batches' } ); >@@ -106,9 +111,12 @@ subtest 'list() tests' => sub { > $query = { ill_batch_id => [ $batch_1->id, $batch_2->id ] }; > > # Two batches created, they should both be returned >- $t->get_ok( "//$userid:$password@/api/v1/ill/batches?q=" . encode_json($query) )->status_is(200) >- ->json_has( '/0', 'has first batch' )->json_is( '/0/ill_batch_id', $batch_1->id ) >- ->json_has( '/1', 'has second batch' )->json_is( '/1/ill_batch_id', $batch_2->id ); >+ $t->get_ok( "//$userid:$password@/api/v1/ill/batches?q=" . encode_json($query) ) >+ ->status_is(200) >+ ->json_has( '/0', 'has first batch' ) >+ ->json_is( '/0/ill_batch_id', $batch_1->id ) >+ ->json_has( '/1', 'has second batch' ) >+ ->json_is( '/1/ill_batch_id', $batch_2->id ); > > my $patron = $builder->build_object( > { >@@ -169,11 +177,16 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > $t->get_ok( "//$userid:$password@/api/v1/ill/batches/" >- . $batch->id => { 'x-koha-embed' => '+strings,requests+count,patron,library' } )->status_is(200) >- ->json_has( '/ill_batch_id', 'Batch ID' )->json_has( '/name', 'Batch name' ) >- ->json_has( '/backend', 'Backend name' )->json_has( '/patron_id', 'Borrowernumber' ) >- ->json_has( '/library_id', 'Branchcode' )->json_has( '/patron', 'patron embedded' ) >- ->json_has( '/library', 'library embedded' )->json_has( '/requests_count', 'request count' ); >+ . $batch->id => { 'x-koha-embed' => '+strings,requests+count,patron,library' } ) >+ ->status_is(200) >+ ->json_has( '/ill_batch_id', 'Batch ID' ) >+ ->json_has( '/name', 'Batch name' ) >+ ->json_has( '/backend', 'Backend name' ) >+ ->json_has( '/patron_id', 'Borrowernumber' ) >+ ->json_has( '/library_id', 'Branchcode' ) >+ ->json_has( '/patron', 'patron embedded' ) >+ ->json_has( '/library', 'library embedded' ) >+ ->json_has( '/requests_count', 'request count' ); > > $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batches/" . $batch->id )->status_is(403); > >@@ -181,7 +194,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $batch_to_delete->id; > $batch_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/ill/batches/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/ill/batches/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'ILL batch not found' ); > > $schema->storage->txn_rollback; >@@ -234,7 +248,8 @@ subtest 'add() tests' => sub { > doh => 1 > }; > >- $t->post_ok( "//$userid:$password@/api/v1/ill/batches" => json => $batch_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/ill/batches" => json => $batch_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -248,15 +263,23 @@ subtest 'add() tests' => sub { > my $batch_id = > $t->post_ok( > "//$userid:$password@/api/v1/ill/batches" => { 'x-koha-embed' => '+strings,requests+count,patron,library' } => >- json => $batch_metadata )->status_is(201)->json_is( '/name' => $batch_metadata->{name} ) >- ->json_is( '/backend' => $batch_metadata->{backend} )->json_is( '/patron_id' => $librarian->borrowernumber ) >- ->json_is( '/library_id' => $batch_metadata->{library_id} )->json_is( '/status_code' => $batch_status->code ) >- ->json_has('/patron')->json_has('/_strings/status_code')->json_has('/_strings/library_id') >- ->json_has('/requests_count')->json_has('/library'); >+ json => $batch_metadata ) >+ ->status_is(201) >+ ->json_is( '/name' => $batch_metadata->{name} ) >+ ->json_is( '/backend' => $batch_metadata->{backend} ) >+ ->json_is( '/patron_id' => $librarian->borrowernumber ) >+ ->json_is( '/library_id' => $batch_metadata->{library_id} ) >+ ->json_is( '/status_code' => $batch_status->code ) >+ ->json_has('/patron') >+ ->json_has('/_strings/status_code') >+ ->json_has('/_strings/library_id') >+ ->json_has('/requests_count') >+ ->json_has('/library'); > > # Authorized attempt to create with null id > $batch_metadata->{id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/ill/batches" => json => $batch_metadata )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/ill/batches" => json => $batch_metadata ) >+ ->status_is(400) > ->json_has('/errors'); > > $schema->storage->txn_rollback; >@@ -306,7 +329,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batches/$batch_id" => json => $batch_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $batch_with_updated_field = { >@@ -318,7 +342,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batches/$batch_id" => json => $batch_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'Master Ploo Koon' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'Master Ploo Koon' ); > > # Authorized attempt to write invalid data > my $batch_with_invalid_field = { >@@ -328,7 +353,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batches/$batch_id" => json => $batch_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: doh.", >diff --git a/t/db_dependent/api/v1/ill_batchstatuses.t b/t/db_dependent/api/v1/ill_batchstatuses.t >index 15a87b1971b..86930fe8aa5 100755 >--- a/t/db_dependent/api/v1/ill_batchstatuses.t >+++ b/t/db_dependent/api/v1/ill_batchstatuses.t >@@ -71,8 +71,12 @@ subtest 'list() tests' => sub { > ); > > # One batch created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/ill/batchstatuses")->status_is(200)->json_has( '/0/id', 'ID' ) >- ->json_has( '/0/name', 'Name' )->json_has( '/0/code', 'Code' )->json_has( '/0/is_system', 'is_system' ); >+ $t->get_ok("//$userid:$password@/api/v1/ill/batchstatuses") >+ ->status_is(200) >+ ->json_has( '/0/id', 'ID' ) >+ ->json_has( '/0/name', 'Name' ) >+ ->json_has( '/0/code', 'Code' ) >+ ->json_has( '/0/is_system', 'is_system' ); > > $schema->storage->txn_rollback; > }; >@@ -114,8 +118,11 @@ subtest 'get() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/ill/batchstatuses/" . $status->code )->status_is(200) >- ->json_has( '/id', 'ID' )->json_has( '/name', 'Name' )->json_has( '/code', 'Code' ) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/batchstatuses/" . $status->code ) >+ ->status_is(200) >+ ->json_has( '/id', 'ID' ) >+ ->json_has( '/name', 'Name' ) >+ ->json_has( '/code', 'Code' ) > ->json_has( '/is_system', 'is_system' ); > > $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batchstatuses/" . $status->id )->status_is(403); >@@ -124,7 +131,8 @@ subtest 'get() tests' => sub { > my $non_existent_code = $status_to_delete->code; > $status_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/ill/batchstatuses/$non_existent_code")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/ill/batchstatuses/$non_existent_code") >+ ->status_is(404) > ->json_is( '/error' => 'ILL batch status not found' ); > > $schema->storage->txn_rollback; >@@ -171,7 +179,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: doh.", >@@ -181,14 +190,18 @@ subtest 'add() tests' => sub { > ); > > # Authorized attempt to write >- $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata )->status_is(201) >- ->json_has( '/id', 'ID' )->json_has( '/name', 'Name' )->json_has( '/code', 'Code' ) >+ $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata ) >+ ->status_is(201) >+ ->json_has( '/id', 'ID' ) >+ ->json_has( '/name', 'Name' ) >+ ->json_has( '/code', 'Code' ) > ->json_has( '/is_system', 'is_system' ) > ->header_is( 'Location' => '/api/v1/ill/batchstatuses/' . $t->tx->res->json->{code}, "REST3.4.1" ); > > # Authorized attempt to create with null id > $status_metadata->{id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata ) >+ ->status_is(400) > ->json_has('/errors'); > > $schema->storage->txn_rollback; >@@ -232,7 +245,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batchstatuses/$status_code" => json => $status_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $status_with_updated_field = { >@@ -242,7 +256,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batchstatuses/$status_code" => json => $status_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'Master Ploo Koon' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'Master Ploo Koon' ); > > # Authorized attempt to write invalid data > my $status_with_invalid_field = { >@@ -252,7 +267,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/ill/batchstatuses/$status_code" => json => $status_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: doh.", >@@ -319,7 +335,8 @@ subtest 'delete() tests' => sub { > > $t->delete_ok( "//$userid:$password@/api/v1/ill/batchstatuses/" . $non_system_status->code )->status_is(404); > >- $t->delete_ok( "//$userid:$password@/api/v1/ill/batchstatuses/" . $system_status->code )->status_is(400) >+ $t->delete_ok( "//$userid:$password@/api/v1/ill/batchstatuses/" . $system_status->code ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "ILL batch status cannot be deleted" } ] ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/ill_requests.t b/t/db_dependent/api/v1/ill_requests.t >index edd8bfec021..d32ba2312fc 100755 >--- a/t/db_dependent/api/v1/ill_requests.t >+++ b/t/db_dependent/api/v1/ill_requests.t >@@ -181,7 +181,8 @@ subtest 'list() tests' => sub { > # Two requests exist with status 'REQ', expect them to be returned > # One of which also has a status_alias, expect that to be in that request's body > $t->get_ok( "//$userid:$password@/api/v1/ill/requests?q=$status_query" => { "x-koha-embed" => "+strings" } ) >- ->status_is(200)->json_is( >+ ->status_is(200) >+ ->json_is( > [ > { _strings => { status => $response_status }, %{ $req_1->to_api( { user => $librarian } ) } }, > { >@@ -193,7 +194,8 @@ subtest 'list() tests' => sub { > > # One request with status_alias 'print_copy' exists, expect that to be returned > $t->get_ok( "//$userid:$password@/api/v1/ill/requests?q=$status_alias_query" => { "x-koha-embed" => "+strings" } ) >- ->status_is(200)->json_is( >+ ->status_is(200) >+ ->json_is( > [ > { > _strings => { status => $response_status, status_av => $response_status_av }, >@@ -206,7 +208,8 @@ subtest 'list() tests' => sub { > my $patron_query = encode_json( { borrowernumber => $patron->borrowernumber } ); > > # One request related to $patron, make sure it comes back >- $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "patron" } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "patron" } ) >+ ->status_is(200) > ->json_has( '/0/patron', $patron->to_api( { user => $librarian } ) ); > > # x-koha-embed: comments >@@ -223,7 +226,8 @@ subtest 'list() tests' => sub { > ); > > # Make sure comments come back >- $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "comments" } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "comments" } ) >+ ->status_is(200) > ->json_has( '/0/comments', $comment_text ); > > # x-koha-embed: id_prefix >@@ -234,23 +238,27 @@ subtest 'list() tests' => sub { > $config->set_always( 'getPrefixes', $id_prefix ); > > # Make sure id_prefix comes back >- $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "id_prefix" } )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/requests" => { "x-koha-embed" => "id_prefix" } ) >+ ->status_is(200) > ->json_has( '/0/id_prefix', $id_prefix ); > > # ILLHiddenRequestStatuses syspref > # Hide 'REQ', expect to return just 1 'RET' > t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'REQ' ); >- $t->get_ok("//$userid:$password@/api/v1/ill/requests")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/ill/requests") >+ ->status_is(200) > ->json_is( [ $ret->to_api( { user => $librarian } ) ] ); > > # Hide 'RET', expect to return 2 'REQ' > t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'RET' ); >- $t->get_ok("//$userid:$password@/api/v1/ill/requests?_order_by=staff_notes")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/ill/requests?_order_by=staff_notes") >+ ->status_is(200) > ->json_is( [ $req_1->to_api( { user => $librarian } ), $req_2->to_api( { user => $librarian } ) ] ); > > # Status code > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/ill/requests?request_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/ill/requests?request_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/request_blah', message => 'Malformed query string' } ] ); > > # Unauthorized attempt to list >@@ -311,10 +319,12 @@ subtest 'public_patron_list() tests' => sub { > my $patron_2_id = $patron_2->id; > > # No requests yet, expect empty for both >- $t->get_ok("//$patron_1_userid:$password@/api/v1/public/patrons/$patron_1_id/ill/requests")->status_is(200) >+ $t->get_ok("//$patron_1_userid:$password@/api/v1/public/patrons/$patron_1_id/ill/requests") >+ ->status_is(200) > ->json_is( [] ); > >- $t->get_ok("//$patron_2_userid:$password@/api/v1/public/patrons/$patron_2_id/ill/requests")->status_is(200) >+ $t->get_ok("//$patron_2_userid:$password@/api/v1/public/patrons/$patron_2_id/ill/requests") >+ ->status_is(200) > ->json_is( [] ); > > for ( 0 .. 25 ) { >@@ -333,12 +343,14 @@ subtest 'public_patron_list() tests' => sub { > } > > # Other user should not see anything >- $t->get_ok("//$patron_2_userid:$password@/api/v1/public/patrons/$patron_2_id/ill/requests")->status_is(200) >+ $t->get_ok("//$patron_2_userid:$password@/api/v1/public/patrons/$patron_2_id/ill/requests") >+ ->status_is(200) > ->json_is( [] ); > > # Staff notes hidden in the public API > $t->get_ok("//$patron_1_userid:$password@/api/v1/public/patrons/$patron_1_id/ill/requests?_per_page=-1") >- ->status_is(200)->json_is( >+ ->status_is(200) >+ ->json_is( > '/0/staff_notes' => undef, > ); > >diff --git a/t/db_dependent/api/v1/import_batch_profiles.t b/t/db_dependent/api/v1/import_batch_profiles.t >index 3a37011d216..f4149b6a026 100755 >--- a/t/db_dependent/api/v1/import_batch_profiles.t >+++ b/t/db_dependent/api/v1/import_batch_profiles.t >@@ -96,8 +96,10 @@ subtest 'list profiles' => sub { > > my $uid = $patron->userid; > >- $t->get_ok("//$uid:$pwd@/api/v1/import_batch_profiles?_order_by=+name")->status_is(200) >- ->json_is( '/0/name', $ibp1->name )->json_is( '/1/name', $ibp2->name ); >+ $t->get_ok("//$uid:$pwd@/api/v1/import_batch_profiles?_order_by=+name") >+ ->status_is(200) >+ ->json_is( '/0/name', $ibp1->name ) >+ ->json_is( '/1/name', $ibp2->name ); > > $schema->storage->txn_rollback; > >@@ -135,8 +137,10 @@ subtest 'add() tests' => sub { > overlay_action => 'overlay_action' > }; > >- $t->post_ok( "//$uid:$pwd@/api/v1/import_batch_profiles", json => $post_data )->status_is(201) >- ->json_has('/profile_id')->json_is( '/name', $post_data->{name} ) >+ $t->post_ok( "//$uid:$pwd@/api/v1/import_batch_profiles", json => $post_data ) >+ ->status_is(201) >+ ->json_has('/profile_id') >+ ->json_is( '/name', $post_data->{name} ) > ->json_is( '/overlay_action', $post_data->{overlay_action} ) > ->header_is( 'Location', '/api/v1/import_batch_profiles/' . $t->tx->res->json->{profile_id}, 'REST3.4.1' ); > >@@ -175,8 +179,10 @@ subtest 'edit profile' => sub { > > my $post_data = { name => 'theProfile' }; > >- $t->put_ok( "//$uid:$pwd@/api/v1/import_batch_profiles/" . $ibp->id, json => $post_data )->status_is(200) >- ->json_is( '/profile_id', $ibp->id )->json_is( '/name', $post_data->{name} ); >+ $t->put_ok( "//$uid:$pwd@/api/v1/import_batch_profiles/" . $ibp->id, json => $post_data ) >+ ->status_is(200) >+ ->json_is( '/profile_id', $ibp->id ) >+ ->json_is( '/name', $post_data->{name} ); > > $ibp->discard_changes; > >diff --git a/t/db_dependent/api/v1/import_record_matches.t b/t/db_dependent/api/v1/import_record_matches.t >index 1c176a3fd5f..cbf1017811c 100755 >--- a/t/db_dependent/api/v1/import_record_matches.t >+++ b/t/db_dependent/api/v1/import_record_matches.t >@@ -102,7 +102,8 @@ subtest 'import record matches tests' => sub { > . $del_import_batch_id > . "/records/" > . $del_match_id >- . "/matches/chosen" => json => { candidate_match_id => $match_1->candidate_match_id } )->status_is(404) >+ . "/matches/chosen" => json => { candidate_match_id => $match_1->candidate_match_id } ) >+ ->status_is(404) > ->json_is( '/error' => "Match not found" ); > > # Valid, authorised update >diff --git a/t/db_dependent/api/v1/item_groups.t b/t/db_dependent/api/v1/item_groups.t >index bf048c079f4..24eda70ab5f 100755 >--- a/t/db_dependent/api/v1/item_groups.t >+++ b/t/db_dependent/api/v1/item_groups.t >@@ -161,7 +161,8 @@ subtest 'update() tests' => sub { > > # Authorized attempt > $t->put_ok( "//$auth_userid:$password@/api/v1/biblios/$biblio_id/item_groups/$item_group_id" => json => >- { description => "Vol A" } )->status_is( 200, 'REST3.2.1' ) >+ { description => "Vol A" } ) >+ ->status_is( 200, 'REST3.2.1' ) > ->json_has( '/description' => "Vol A", 'REST3.3.3' ); > > # Invalid biblio id >@@ -209,7 +210,8 @@ subtest 'delete() tests' => sub { > my $item_groupid = $item_group->id; > > $t->delete_ok("//$auth_userid:$password@/api/v1/biblios/$biblio_id/item_groups/$item_groupid") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/biblios/$biblio_id/item_groups/$item_groupid")->status_is(403); >@@ -270,7 +272,8 @@ subtest 'volume items add() + delete() tests' => sub { > is( scalar(@items), 2, 'Item group now has two items' ); > > $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id/item_groups/$item_groupid/items/$item_1_id") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > @items = $item_group->items; > is( scalar(@items), 1, 'Item group now has one item' ); >diff --git a/t/db_dependent/api/v1/item_types.t b/t/db_dependent/api/v1/item_types.t >index db232ec6efe..5f1fb454dc1 100755 >--- a/t/db_dependent/api/v1/item_types.t >+++ b/t/db_dependent/api/v1/item_types.t >@@ -112,12 +112,18 @@ subtest 'list() tests' => sub { > > ## Authorized user tests > my $query = encode_json( { item_type_id => $item_type->id } ); >- $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query")->status_is(200)->json_has('/0') >- ->json_is( '/0/description', $item_type->description )->json_hasnt('/0/translated_descriptions'); >+ $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query") >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_is( '/0/description', $item_type->description ) >+ ->json_hasnt('/0/translated_descriptions'); > > $t->get_ok( "//$userid:$password@/api/v1/item_types?q=$query" => { 'x-koha-embed' => 'translated_descriptions' } ) >- ->status_is(200)->json_has('/0')->json_is( '/0/description', $item_type->description ) >- ->json_has('/0/translated_descriptions')->json_is( >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_is( '/0/description', $item_type->description ) >+ ->json_has('/0/translated_descriptions') >+ ->json_is( > '/0/translated_descriptions', > [ > { lang => 'en', translation => 'English word "test"' }, >diff --git a/t/db_dependent/api/v1/items.t b/t/db_dependent/api/v1/items.t >index 16975e74a28..b5d1b591cad 100755 >--- a/t/db_dependent/api/v1/items.t >+++ b/t/db_dependent/api/v1/items.t >@@ -73,7 +73,8 @@ subtest 'list() tests' => sub { > $nonprivilegedpatron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $nonprivilegedpatron->userid; > >- $t->get_ok("//$userid:$password@/api/v1/items")->status_is(403) >+ $t->get_ok("//$userid:$password@/api/v1/items") >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); >@@ -85,16 +86,19 @@ subtest 'list() tests' => sub { > > is( $response_count, 10, 'The API returns 10 items' ); > >- $t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode ) >+ ->status_is(200) > ->json_is( '' => [ $item->to_api ], 'REST3.3.2' ); > > $t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode => { 'x-koha-embed' => 'biblio' } ) >- ->status_is(200)->json_is( '' => [ { %{ $item->to_api }, biblio => $item->biblio->to_api } ], 'REST3.3.2' ); >+ ->status_is(200) >+ ->json_is( '' => [ { %{ $item->to_api }, biblio => $item->biblio->to_api } ], 'REST3.3.2' ); > > my $barcode = $item->barcode; > $item->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode ) >+ ->status_is(200) > ->json_is( '' => [] ); > > $schema->storage->txn_rollback; >@@ -277,19 +281,22 @@ subtest 'get() tests' => sub { > $nonprivilegedpatron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $nonprivilegedpatron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is(403) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); > $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '' => $item->to_api, 'REST3.3.2' ); > > my $non_existent_code = $item->itemnumber; > $item->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $non_existent_code )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $non_existent_code ) >+ ->status_is(404) > ->json_is( '/error' => 'Item not found' ); > > t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >@@ -300,13 +307,15 @@ subtest 'get() tests' => sub { > > isnt( $biblio->itemtype, $itype->itemtype, "Test biblio level itemtype and item level itemtype do not match" ); > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '/item_type_id' => $itype->itemtype, 'item-level_itypes:0' ) > ->json_is( '/effective_item_type_id' => $biblio->itemtype, 'item-level_itypes:0' ); > > t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '/item_type_id' => $itype->itemtype, 'item-level_itype:1' ) > ->json_is( '/effective_item_type_id' => $itype->itemtype, 'item-level_itypes:1' ); > >@@ -315,27 +324,34 @@ subtest 'get() tests' => sub { > $itype->notforloan(2)->store(); > $item->notforloan(1)->store(); > >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '/not_for_loan_status' => 1, 'not_for_loan_status is 1' ) > ->json_is( '/effective_not_for_loan_status' => 1, 'effective_not_for_loan_status picks up item level' ); > > $item->notforloan(0)->store(); >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >- ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' )->json_is( >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' ) >+ ->json_is( > '/effective_not_for_loan_status' => 2, > 'effective_not_for_loan_status now picks up itemtype level - item-level_itypes:1' > ); > > $itype->notforloan(0)->store(); >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >- ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' )->json_is( >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' ) >+ ->json_is( > '/effective_not_for_loan_status' => 0, > 'effective_not_for_loan_status now picks up itemtype level and falls back to 0 because undef' > ); > > t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >- $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber )->status_is( 200, 'REST3.2.2' ) >- ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' )->json_is( >+ $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '/not_for_loan_status' => 0, 'not_for_loan_status is 0' ) >+ ->json_is( > '/effective_not_for_loan_status' => 3, > 'effective_not_for_loan_status now picks up itemtype level - item-level_itypes:0' > ); >@@ -416,7 +432,8 @@ subtest 'delete() tests' => sub { > > $expected_error = 'unknown_error'; > $t->delete_ok( "//$userid:$password@/api/v1/items/" . $item->id ) >- ->status_is( 500, 'unhandled error case generated default unhandled exception message' )->json_is( >+ ->status_is( 500, 'unhandled error case generated default unhandled exception message' ) >+ ->json_is( > { > error => 'Something went wrong, check Koha logs for details.', > error_code => 'internal_server_error', >@@ -425,7 +442,8 @@ subtest 'delete() tests' => sub { > > $fail = 0; > >- $t->delete_ok( "//$userid:$password@/api/v1/items/" . $item->id )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/items/" . $item->id ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok( "//$userid:$password@/api/v1/items/" . $item->id )->status_is(404); >@@ -548,7 +566,8 @@ subtest 'pickup_locations() tests' => sub { > . "patron_id=" > . $patron->id > . "&_order_by=marc_org_code" >- . "&_per_page=1" )->json_is( [$library_1_api] ) >+ . "&_per_page=1" ) >+ ->json_is( [$library_1_api] ) > ->header_is( 'X-Total-Count', '4', '4 is the count for libraries with pickup_location=1' ) > ->header_is( 'X-Base-Total-Count', '4', '4 is the count for libraries with pickup_location=1' ) > ->header_unlike( 'Link', qr|rel="prev"| ) >@@ -579,8 +598,11 @@ subtest 'pickup_locations() tests' => sub { > . "patron_id=" > . $patron->id > . "&_order_by=marc_org_code" >- . "&_per_page=1" )->json_is( [$library_1_api] )->header_is( 'X-Total-Count', '2' ) >- ->header_is( 'X-Base-Total-Count', '2' )->header_unlike( 'Link', qr|rel="prev"| ) >+ . "&_per_page=1" ) >+ ->json_is( [$library_1_api] ) >+ ->header_is( 'X-Total-Count', '2' ) >+ ->header_is( 'X-Base-Total-Count', '2' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=2.*|_page=2.*\&_per_page=1.*)>\; rel="next"# ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=1.*|_page=1.*\&_per_page=1).*>\; rel="first"# ) > ->header_like( 'Link', qr#(_per_page=1.*\&_page=2.*|_page=2.*\&_per_page=1).*>\; rel="last"# ); >@@ -592,12 +614,14 @@ subtest 'pickup_locations() tests' => sub { > > $t->get_ok( > "//$userid:$password@/api/v1/items/" . $item->id . "/pickup_locations?" . "patron_id=" . $deleted_patron_id ) >- ->status_is(400)->json_is( '/error' => 'Patron not found' ); >+ ->status_is(400) >+ ->json_is( '/error' => 'Patron not found' ); > > $item->delete; > > $t->get_ok( "//$userid:$password@/api/v1/items/" . $item->id . "/pickup_locations?" . "patron_id=" . $patron->id ) >- ->status_is(404)->json_is( '/error' => 'Item not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Item not found' ); > > $schema->storage->txn_rollback; > }; >diff --git a/t/db_dependent/api/v1/items/bundled_items.t b/t/db_dependent/api/v1/items/bundled_items.t >index aa582b3173c..cfcbff22d7e 100755 >--- a/t/db_dependent/api/v1/items/bundled_items.t >+++ b/t/db_dependent/api/v1/items/bundled_items.t >@@ -51,7 +51,8 @@ subtest 'bundled_items()' => sub { > $nonprivilegedpatron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $nonprivilegedpatron->userid; > >- $t->get_ok("//$userid:$password@/api/v1/items/$itemnumber/bundled_items")->status_is(403) >+ $t->get_ok("//$userid:$password@/api/v1/items/$itemnumber/bundled_items") >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); >@@ -130,7 +131,8 @@ subtest 'add_to_bundle' => sub { > marc_link => 0 > }; > >- $t->post_ok( "//$userid:$password@/api/v1/items/$itemnumber/bundled_items" => json => $link )->status_is(403) >+ $t->post_ok( "//$userid:$password@/api/v1/items/$itemnumber/bundled_items" => json => $link ) >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); >diff --git a/t/db_dependent/api/v1/jobs.t b/t/db_dependent/api/v1/jobs.t >index a1a6a984844..bd09ad343bd 100755 >--- a/t/db_dependent/api/v1/jobs.t >+++ b/t/db_dependent/api/v1/jobs.t >@@ -106,10 +106,12 @@ my $job_current = $builder->build_object( > ); > > { >- $t->get_ok("//$superlibrarian_userid:$password@/api/v1/jobs")->status_is(200) >+ $t->get_ok("//$superlibrarian_userid:$password@/api/v1/jobs") >+ ->status_is(200) > ->json_is( [ $job->to_api, $job_current->to_api ] ); > >- $t->get_ok("//$superlibrarian_userid:$password@/api/v1/jobs?only_current=1")->status_is(200) >+ $t->get_ok("//$superlibrarian_userid:$password@/api/v1/jobs?only_current=1") >+ ->status_is(200) > ->json_is( [ $job_current->to_api ] ); > > $t->get_ok("//$librarian_userid:$password@/api/v1/jobs")->status_is(200)->json_is( [] ); >@@ -124,7 +126,8 @@ my $job_current = $builder->build_object( > } > > { >- $t->get_ok( "//$superlibrarian_userid:$password@/api/v1/jobs/" . $job->id )->status_is(200) >+ $t->get_ok( "//$superlibrarian_userid:$password@/api/v1/jobs/" . $job->id ) >+ ->status_is(200) > ->json_is( $job->to_api ); > > $t->get_ok( "//$librarian_userid:$password@/api/v1/jobs/" . $job->id )->status_is(200)->json_is( $job->to_api ); >@@ -135,7 +138,8 @@ my $job_current = $builder->build_object( > > { > $job->delete; >- $t->get_ok( "//$superlibrarian_userid:$password@/api/v1/jobs/" . $job->id )->status_is(404) >+ $t->get_ok( "//$superlibrarian_userid:$password@/api/v1/jobs/" . $job->id ) >+ ->status_is(404) > ->json_is( '/error' => 'Job not found' ); > } > >@@ -187,7 +191,9 @@ subtest 'finished jobs' => sub { > > $job->finish()->discard_changes(); > >- $t->get_ok( "//$userid:$password@/api/v1/jobs/" . $job->id )->status_is(200)->json_is( $job->to_api ) >+ $t->get_ok( "//$userid:$password@/api/v1/jobs/" . $job->id ) >+ ->status_is(200) >+ ->json_is( $job->to_api ) > ->json_is( '/data' => undef ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/libraries.t b/t/db_dependent/api/v1/libraries.t >index 3710eef183d..e775a799179 100755 >--- a/t/db_dependent/api/v1/libraries.t >+++ b/t/db_dependent/api/v1/libraries.t >@@ -104,7 +104,8 @@ subtest 'list() tests' => sub { > }; > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/libraries?library_blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/libraries?library_blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/library_blah', message => 'Malformed query string' } ] ); > > $schema->storage->txn_rollback; >@@ -127,11 +128,13 @@ subtest 'get() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '' => $library->to_api, 'REST3.3.2' ); > > $t->get_ok( "//$userid:$password@/api/v1/libraries/" >- . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200) >+ . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } ) >+ ->status_is(200) > ->json_is( { %{ $library->to_api }, desks => [], cash_registers => [] } ); > > my $desk = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } ); >@@ -139,14 +142,16 @@ subtest 'get() tests' => sub { > $builder->build_object( { class => 'Koha::Cash::Registers', value => { branch => $library->id } } ); > > $t->get_ok( "//$userid:$password@/api/v1/libraries/" >- . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200) >+ . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } ) >+ ->status_is(200) > ->json_is( > { %{ $library->to_api }, desks => [ $desk->to_api ], cash_registers => [ $cash_register->to_api ] } ); > > my $non_existent_code = $library->branchcode; > $library->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code ) >+ ->status_is(404) > ->json_is( '/error' => 'Library not found' ); > > $schema->storage->txn_rollback; >@@ -188,7 +193,8 @@ subtest 'add() tests' => sub { > my $library_with_invalid_field = {%$library}; > $library_with_invalid_field->{'branchinvalid'} = 'Library invalid'; > >- $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -199,7 +205,8 @@ subtest 'add() tests' => sub { > ); > > # Authorized attempt to write >- $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library ) >+ ->status_is( 201, 'REST3.2.1' ) > ->json_is( '' => $library, 'REST3.3.1' ) > ->header_is( Location => '/api/v1/libraries/' . $library->{library_id}, 'REST3.4.1' ); > >@@ -209,14 +216,16 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with null id > $library->{library_id} = undef; > >- $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $library->{library_id} = $library_id; > > warning_like { >- $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library )->status_is(409) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library ) >+ ->status_is(409) > ->json_has( '/error' => "Fails when trying to add an existing library_id" ) > ->json_like( '/conflict' => qr/(branches\.)?PRIMARY/ ); > } >@@ -262,7 +271,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$auth_userid:$password@/api/v1/libraries/$library_id" => json => $library_with_missing_field ) >- ->status_is(400)->json_has( "/errors" => [ { message => "Missing property.", path => "/body/address2" } ] ); >+ ->status_is(400) >+ ->json_has( "/errors" => [ { message => "Missing property.", path => "/body/address2" } ] ); > > my $deleted_library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $library_with_updated_field = $deleted_library->to_api; >@@ -270,14 +280,16 @@ subtest 'update() tests' => sub { > $deleted_library->delete; > > $t->put_ok( "//$auth_userid:$password@/api/v1/libraries/$library_id" => json => $library_with_updated_field ) >- ->status_is( 200, 'REST3.2.1' )->json_is( '' => $library_with_updated_field, 'REST3.3.3' ); >+ ->status_is( 200, 'REST3.2.1' ) >+ ->json_is( '' => $library_with_updated_field, 'REST3.3.3' ); > > # Authorized attempt to write invalid data > my $library_with_invalid_field = {%$library_with_updated_field}; > $library_with_invalid_field->{'branchinvalid'} = 'Library invalid'; > > $t->put_ok( "//$auth_userid:$password@/api/v1/libraries/$library_id" => json => $library_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: branchinvalid.", >@@ -322,7 +334,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/libraries/$library_id")->status_is(403); > >- $t->delete_ok("//$auth_userid:$password@/api/v1/libraries/$library_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$auth_userid:$password@/api/v1/libraries/$library_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$auth_userid:$password@/api/v1/libraries/$library_id")->status_is(404); >@@ -349,7 +362,8 @@ subtest 'list_desks() tests' => sub { > > t::lib::Mocks::mock_preference( 'UseCirculationDesks', 0 ); > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/desks" )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/desks" ) >+ ->status_is(404) > ->json_is( '/error' => q{Feature disabled} ); > > my $non_existent_code = $library->branchcode; >@@ -357,14 +371,19 @@ subtest 'list_desks() tests' => sub { > > t::lib::Mocks::mock_preference( 'UseCirculationDesks', 1 ); > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code . "/desks" )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code . "/desks" ) >+ ->status_is(404) > ->json_is( '/error' => 'Library not found' ); > > my $desk_1 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } ); > my $desk_2 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } ); > >- my $res = $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/desks" )->status_is(200) >- ->json_is( '/0/desk_id' => $desk_1->id )->json_is( '/1/desk_id' => $desk_2->id )->tx->res->json; >+ my $res = >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/desks" ) >+ ->status_is(200) >+ ->json_is( '/0/desk_id' => $desk_1->id ) >+ ->json_is( '/1/desk_id' => $desk_2->id ) >+ ->tx->res->json; > > is( scalar @{$res}, 2 ); > >@@ -390,7 +409,8 @@ subtest 'list_cash_registers() tests' => sub { > > t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/cash_registers" )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/cash_registers" ) >+ ->status_is(404) > ->json_is( '/error' => q{Feature disabled} ); > > my $non_existent_code = $library->branchcode; >@@ -398,7 +418,8 @@ subtest 'list_cash_registers() tests' => sub { > > t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); > >- $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code . "/cash_registers" )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $non_existent_code . "/cash_registers" ) >+ ->status_is(404) > ->json_is( '/error' => 'Library not found' ); > > my $cash_register_1 = >@@ -408,8 +429,10 @@ subtest 'list_cash_registers() tests' => sub { > > my $res = > $t->get_ok( "//$userid:$password@/api/v1/libraries/" . $library->branchcode . "/cash_registers" ) >- ->status_is(200)->json_is( '/0/cash_register_id' => $cash_register_1->id ) >- ->json_is( '/1/cash_register_id' => $cash_register_2->id )->tx->res->json; >+ ->status_is(200) >+ ->json_is( '/0/cash_register_id' => $cash_register_1->id ) >+ ->json_is( '/1/cash_register_id' => $cash_register_2->id ) >+ ->tx->res->json; > > is( scalar @{$res}, 2 ); > >diff --git a/t/db_dependent/api/v1/oauth.t b/t/db_dependent/api/v1/oauth.t >index 0276ad70aab..3879ec24a32 100755 >--- a/t/db_dependent/api/v1/oauth.t >+++ b/t/db_dependent/api/v1/oauth.t >@@ -52,13 +52,15 @@ subtest '/oauth/token tests' => sub { > $t->post_ok('/api/v1/oauth/token')->status_is(400); > > # Wrong grant type >- $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'password' } )->status_is(400) >+ $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'password' } ) >+ ->status_is(400) > ->json_is( { error => 'Unimplemented grant type' } ); > > t::lib::Mocks::mock_preference( 'RESTOAuth2ClientCredentials', 1 ); > > # No client_id/client_secret >- $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'client_credentials' } )->status_is(403) >+ $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'client_credentials' } ) >+ ->status_is(403) > ->json_is( { error => 'unauthorized_client' } ); > > subtest 'Client credentials in body' => sub { >@@ -96,8 +98,11 @@ subtest 'Net::OAuth2::AuthorizationServer missing tests' => sub { > client_secret => $api_key->plain_text_secret > }; > >- $t->post_ok( '/api/v1/oauth/token', form => $form_data )->status_is(200)->json_is( '/expires_in' => 3600 ) >- ->json_is( '/token_type' => 'Bearer' )->json_has('/access_token'); >+ $t->post_ok( '/api/v1/oauth/token', form => $form_data ) >+ ->status_is(200) >+ ->json_is( '/expires_in' => 3600 ) >+ ->json_is( '/token_type' => 'Bearer' ) >+ ->json_has('/access_token'); > > my $access_token = $t->tx->res->json->{access_token}; > >@@ -107,7 +112,8 @@ subtest 'Net::OAuth2::AuthorizationServer missing tests' => sub { > $tx->req->headers->authorization("Bearer $access_token"); > $t->request_ok($tx)->status_is(403); > >- $t->post_ok( '/api/v1/oauth/token', form => $form_data )->status_is(400) >+ $t->post_ok( '/api/v1/oauth/token', form => $form_data ) >+ ->status_is(400) > ->json_is( { error => 'Unimplemented grant type' } ); > > $schema->storage->txn_rollback; >@@ -139,8 +145,11 @@ sub run_oauth_tests { > > $formData = { grant_type => 'client_credentials' }; > >- $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData )->status_is(200) >- ->json_is( '/expires_in' => 3600 )->json_is( '/token_type' => 'Bearer' )->json_has('/access_token'); >+ $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData ) >+ ->status_is(200) >+ ->json_is( '/expires_in' => 3600 ) >+ ->json_is( '/token_type' => 'Bearer' ) >+ ->json_has('/access_token'); > } else { > > $formData = { >@@ -149,8 +158,11 @@ sub run_oauth_tests { > client_secret => $api_key->plain_text_secret > }; > >- $t->post_ok( '/api/v1/oauth/token', form => $formData )->status_is(200)->json_is( '/expires_in' => 3600 ) >- ->json_is( '/token_type' => 'Bearer' )->json_has('/access_token'); >+ $t->post_ok( '/api/v1/oauth/token', form => $formData ) >+ ->status_is(200) >+ ->json_is( '/expires_in' => 3600 ) >+ ->json_is( '/token_type' => 'Bearer' ) >+ ->json_has('/access_token'); > } > > my $access_token = $t->tx->res->json->{access_token}; >@@ -180,10 +192,12 @@ sub run_oauth_tests { > $api_key->active(0)->store; > > if ( $test_case eq 'header' ) { >- $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData )->status_is(403) >+ $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData ) >+ ->status_is(403) > ->json_is( { error => 'unauthorized_client' } ); > } else { >- $t->post_ok( '/api/v1/oauth/token', form => $formData )->status_is(403) >+ $t->post_ok( '/api/v1/oauth/token', form => $formData ) >+ ->status_is(403) > ->json_is( { error => 'unauthorized_client' } ); > } > >@@ -195,10 +209,12 @@ sub run_oauth_tests { > > # Wrong grant type > if ( $test_case eq 'header' ) { >- $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData )->status_is(400) >+ $t->post_ok( "//$client_id:$client_secret@/api/v1/oauth/token", form => $formData ) >+ ->status_is(400) > ->json_is( { error => 'Unimplemented grant type' } ); > } else { >- $t->post_ok( '/api/v1/oauth/token', form => $formData )->status_is(400) >+ $t->post_ok( '/api/v1/oauth/token', form => $formData ) >+ ->status_is(400) > ->json_is( { error => 'Unimplemented grant type' } ); > } > >diff --git a/t/db_dependent/api/v1/pagination.t b/t/db_dependent/api/v1/pagination.t >index 45709b4820c..7535a351042 100755 >--- a/t/db_dependent/api/v1/pagination.t >+++ b/t/db_dependent/api/v1/pagination.t >@@ -76,29 +76,36 @@ subtest 'list() pagination tests' => sub { > t::lib::Mocks::mock_preference( 'RESTdefaultPageSize', 20 ); > > my $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities")->status_is(200)->header_is( 'X-Total-Count', '10' ) >- ->header_is( 'X-Base-Total-Count', '10' )->header_unlike( 'Link', qr|rel="prev"| ) >- ->header_unlike( 'Link', qr|rel="next"| )->header_like( >+ $t->get_ok("//$userid:$password@/api/v1/cities") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '10' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) >+ ->header_unlike( 'Link', qr|rel="next"| ) >+ ->header_like( > 'Link', > qr#(_per_page=20\&_page=1|_page=1\&_per_page=20)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=20\&_page=1|_page=1\&_per_page=20)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 10, '10 cities retrieved' ); > > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?q={\"name\":{\"-like\":\"\%A\"}}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cities?q={\"name\":{\"-like\":\"\%A\"}}") >+ ->status_is(200) > ->header_is( 'X-Total-Count', '5', 'The resultset has 5 items' ) > ->header_is( 'X-Base-Total-Count', '10', 'The resultset, without the filter, has 10' ) >- ->header_unlike( 'Link', qr|rel="prev"| )->header_unlike( 'Link', qr|rel="next"| )->header_like( >+ ->header_unlike( 'Link', qr|rel="prev"| ) >+ ->header_unlike( 'Link', qr|rel="next"| ) >+ ->header_like( > 'Link', > qr#(_per_page=20.*\&_page=1.*|_page=1.*\&_per_page=20.*)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=20.*\&_page=1.*|_page=1.*\&_per_page=20.*)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 5, '5 cities retrieved' ); > >@@ -106,31 +113,39 @@ subtest 'list() pagination tests' => sub { > > # _per_page overrides RESTdefaultPageSize > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?_per_page=20")->status_is(200) >- ->header_is( 'X-Total-Count', '10' )->header_is( 'X-Base-Total-Count', '10' ) >- ->header_unlike( 'Link', qr|rel="prev"| )->header_unlike( 'Link', qr|rel="next"| )->header_like( >+ $t->get_ok("//$userid:$password@/api/v1/cities?_per_page=20") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '10' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) >+ ->header_unlike( 'Link', qr|rel="next"| ) >+ ->header_like( > 'Link', > qr#(_per_page=20\&_page=1|_page=1\&_per_page=20)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=20\&_page=1|_page=1\&_per_page=20)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 10, '10 cities retrieved' ); > > # page 1 > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities")->status_is(200)->header_is( 'X-Total-Count', '10' ) >- ->header_is( 'X-Base-Total-Count', '10' )->header_unlike( 'Link', qr|rel="prev"| )->header_like( >+ $t->get_ok("//$userid:$password@/api/v1/cities") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '10' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) >+ ->header_like( > 'Link', > qr#(_per_page=3\&_page=1|_page=1\&_per_page=3)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=3\&_page=2|_page=2\&_per_page=3)>\; rel="next"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=3\&_page=4|_page=4\&_per_page=3)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 3, '3 cities retrieved' ); > >@@ -138,48 +153,58 @@ subtest 'list() pagination tests' => sub { > # to add all combinations to the regex > $cities = > $t->get_ok("//$userid:$password@/api/v1/cities?_per_page=2&_page=2&q={\"name\":{\"-like\":\"\%A\"}}") >- ->status_is(200)->header_is( 'X-Total-Count', '5' )->header_is( 'X-Base-Total-Count', '10' )->header_like( >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '5' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_like( > 'Link', > qr#(_per_page=2.*\&_page=1.*|_page=1.*\&_per_page=2.*)>\; rel="prev"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=2.*\&_page=1.*|_page=1.*\&_per_page=2.*)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=2.*\&_page=3.*|_page=3.*\&_per_page=2.*)>\; rel="next"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=2.*\&_page=3.*|_page=3.*\&_per_page=2.*)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 2, '2 cities retrieved' ); > > # last page, with only one result > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?_page=4")->status_is(200)->header_is( 'X-Total-Count', '10' ) >- ->header_is( 'X-Base-Total-Count', '10' )->header_like( >+ $t->get_ok("//$userid:$password@/api/v1/cities?_page=4") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '10' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_like( > 'Link', > qr#(_per_page=3\&_page=3|_page=3\&_per_page=3)>\; rel="prev"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=3\&_page=1|_page=1\&_per_page=3)>\; rel="first"# >- )->header_unlike( 'Link', qr#rel="next"# )->header_like( >+ )->header_unlike( 'Link', qr#rel="next"# )->header_like( > 'Link', > qr#(_per_page=3\&_page=4|_page=4\&_per_page=3)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 1, '1 city retrieved' ); > > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?_per_page=-1")->status_is(200) >- ->header_is( 'X-Total-Count', '10' )->header_is( 'X-Base-Total-Count', '10' ) >- ->header_unlike( 'Link', qr|rel="prev"| )->header_unlike( 'Link', qr|rel="next"| )->header_like( >+ $t->get_ok("//$userid:$password@/api/v1/cities?_per_page=-1") >+ ->status_is(200) >+ ->header_is( 'X-Total-Count', '10' ) >+ ->header_is( 'X-Base-Total-Count', '10' ) >+ ->header_unlike( 'Link', qr|rel="prev"| ) >+ ->header_unlike( 'Link', qr|rel="next"| ) >+ ->header_like( > 'Link', > qr#(_per_page=-1\&_page=1|_page=1\&_per_page=-1)>\; rel="first"# >- )->header_like( >+ )->header_like( > 'Link', > qr#(_per_page=-1\&_page=1|_page=1\&_per_page=-1)>\; rel="last"# >- )->tx->res->json; >+ )->tx->res->json; > > is( scalar @{$cities}, 10, '10 cities retrieved, -1 means all' ); > >diff --git a/t/db_dependent/api/v1/password_validation.t b/t/db_dependent/api/v1/password_validation.t >index a20342dfb70..05b865e5d1b 100755 >--- a/t/db_dependent/api/v1/password_validation.t >+++ b/t/db_dependent/api/v1/password_validation.t >@@ -73,12 +73,14 @@ subtest 'password validation - account lock out' => sub { > password => "bad", > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(400) > ->json_is( { error => q{Validation failed} } ); > > $json->{password} = $password; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(400) > ->json_is( { error => q{Validation failed} } ); > > $schema->storage->txn_rollback; >@@ -105,7 +107,8 @@ subtest 'password validation - unauthorized user' => sub { > password => "test", > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(403) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $schema->storage->txn_rollback; >@@ -122,7 +125,8 @@ subtest 'password validation - unauthenticated user' => sub { > }; > > $t->post_ok( "/api/v1/auth/password/validation" => json => $json ) >- ->json_is( '/error' => 'Authentication failure.' )->status_is(401); >+ ->json_is( '/error' => 'Authentication failure.' ) >+ ->status_is(401); > > $schema->storage->txn_rollback; > }; >@@ -185,7 +189,8 @@ subtest 'Password validation - authorized requests tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >- ->status_is( 400, 'Validating using and invalid userid fails' )->json_is( { error => 'Validation failed' } ); >+ ->status_is( 400, 'Validating using and invalid userid fails' ) >+ ->json_is( { error => 'Validation failed' } ); > > $json = { > password => $password, >@@ -293,7 +298,8 @@ subtest 'password validation - expired password' => sub { > password => $patron_password, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(400) > ->json_is( '/error' => 'Password expired' ); > > $schema->storage->txn_rollback; >@@ -328,7 +334,8 @@ subtest 'password validation - users with shared cardnumber / userid' => sub { > password => $patron_password_1, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(201) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(201) > ->json_is( > { cardnumber => $patron_1->cardnumber, patron_id => $patron_1->borrowernumber, userid => $patron_1->userid } ); > >@@ -337,7 +344,8 @@ subtest 'password validation - users with shared cardnumber / userid' => sub { > password => $patron_password_2, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(201) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(201) > ->json_is( > { cardnumber => $patron_2->cardnumber, patron_id => $patron_2->borrowernumber, userid => $patron_2->userid } ); > >@@ -346,7 +354,8 @@ subtest 'password validation - users with shared cardnumber / userid' => sub { > password => $patron_password_1, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(201) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(201) > ->json_is( > { cardnumber => $patron_1->cardnumber, patron_id => $patron_1->borrowernumber, userid => $patron_1->userid } ); > >@@ -355,7 +364,8 @@ subtest 'password validation - users with shared cardnumber / userid' => sub { > password => $patron_password_2, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(201) >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json ) >+ ->status_is(201) > ->json_is( > { cardnumber => $patron_2->cardnumber, patron_id => $patron_2->borrowernumber, userid => $patron_2->userid } ); > >diff --git a/t/db_dependent/api/v1/patron_categories.t b/t/db_dependent/api/v1/patron_categories.t >index d3cf067e09d..d383be3a47f 100755 >--- a/t/db_dependent/api/v1/patron_categories.t >+++ b/t/db_dependent/api/v1/patron_categories.t >@@ -66,8 +66,11 @@ subtest 'list() tests' => sub { > > $t->get_ok("//$userid:$password@/api/v1/patron_categories")->status_is(200); > >- $t->get_ok("//$userid:$password@/api/v1/patron_categories?q={\"me.categorycode\":\"TEST\"}")->status_is(200) >- ->json_has('/0/name')->json_is( '/0/name' => 'Test' )->json_hasnt('/1'); >+ $t->get_ok("//$userid:$password@/api/v1/patron_categories?q={\"me.categorycode\":\"TEST\"}") >+ ->status_is(200) >+ ->json_has('/0/name') >+ ->json_is( '/0/name' => 'Test' ) >+ ->json_hasnt('/1'); > > # Off limits search > >@@ -92,14 +95,18 @@ subtest 'list() tests' => sub { > my $off_limits_userid = $off_limits_librarian->userid; > > $t->get_ok("//$off_limits_userid:$off_limits_password@/api/v1/patron_categories?q={\"me.categorycode\":\"TEST\"}") >- ->status_is(200)->json_hasnt('/0'); >+ ->status_is(200) >+ ->json_hasnt('/0'); > > # Off limits librarian category has changed to one within limits > > $off_limits_librarian->branchcode( $library->branchcode )->store; > > $t->get_ok("//$off_limits_userid:$off_limits_password@/api/v1/patron_categories?q={\"me.categorycode\":\"TEST\"}") >- ->status_is(200)->json_has('/0/name')->json_is( [ $category->to_api ] )->json_hasnt('/1'); >+ ->status_is(200) >+ ->json_has('/0/name') >+ ->json_is( [ $category->to_api ] ) >+ ->json_hasnt('/1'); > > $schema->storage->txn_rollback; > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 6673030c371..1ec56c94595 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -125,13 +125,16 @@ subtest 'list() tests' => sub { > > $t->get_ok("//$userid:$password@/api/v1/patrons")->status_is( 200, 'list_borrowers makes /patrons accessible' ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons?cardnumber=" . $librarian->cardnumber )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons?cardnumber=" . $librarian->cardnumber ) >+ ->status_is(200) > ->json_is( '/0/cardnumber' => $librarian->cardnumber ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons?q={\"cardnumber\":\"" . $librarian->cardnumber . "\"}" ) >- ->status_is(200)->json_is( '/0/cardnumber' => $librarian->cardnumber ); >+ ->status_is(200) >+ ->json_is( '/0/cardnumber' => $librarian->cardnumber ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons?address2=" . $librarian->address2 )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons?address2=" . $librarian->address2 ) >+ ->status_is(200) > ->json_is( '/0/address2' => $librarian->address2 ); > > subtest 'restricted & expired' => sub { >@@ -145,13 +148,19 @@ subtest 'list() tests' => sub { > $t->get_ok( "//$userid:$password@/api/v1/patrons?restricted=" > . Mojo::JSON->true > . "&cardnumber=" >- . $patron->cardnumber )->status_is(200)->json_has('/0/restricted') >- ->json_is( '/0/restricted' => Mojo::JSON->true )->json_has('/0/expired') >- ->json_is( '/0/expired' => Mojo::JSON->false )->json_hasnt('/1'); >+ . $patron->cardnumber ) >+ ->status_is(200) >+ ->json_has('/0/restricted') >+ ->json_is( '/0/restricted' => Mojo::JSON->true ) >+ ->json_has('/0/expired') >+ ->json_is( '/0/expired' => Mojo::JSON->false ) >+ ->json_hasnt('/1'); > > $patron->dateexpiry( dt_from_string->subtract( days => 2 ) )->store; >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber )->status_is(200) >- ->json_has('/expired')->json_is( '/expired' => Mojo::JSON->true ); >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >+ ->status_is(200) >+ ->json_has('/expired') >+ ->json_is( '/expired' => Mojo::JSON->true ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons?" > . 'q={"extended_attributes.type":"CODE"}' => { 'x-koha-embed' => 'extended_attributes' } ) >@@ -180,13 +189,15 @@ subtest 'list() tests' => sub { > $t->get_ok( "//$userid:$password@/api/v1/patrons?date_of_birth=" > . $date_of_birth > . "&cardnumber=" >- . $patron->cardnumber )->status_is(200) >+ . $patron->cardnumber ) >+ ->status_is(200) > ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date works' ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons?last_seen=" > . $last_seen_rfc3339 > . "&cardnumber=" >- . $patron->cardnumber )->status_is(200) >+ . $patron->cardnumber ) >+ ->status_is(200) > ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date-time works' ); > > my $q = encode_json( >@@ -196,7 +207,8 @@ subtest 'list() tests' => sub { > } > ); > >- $t->get_ok("//$userid:$password@/api/v1/patrons?q=$q")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/patrons?q=$q") >+ ->status_is(200) > ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date works' ); > > $q = encode_json( >@@ -206,7 +218,8 @@ subtest 'list() tests' => sub { > } > ); > >- $t->get_ok("//$userid:$password@/api/v1/patrons?q=$q")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/patrons?q=$q") >+ ->status_is(200) > ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date-time works' ); > }; > >@@ -250,16 +263,20 @@ subtest 'list() tests' => sub { > my $userid = $librarian->userid; > > $t->get_ok( "//$userid:$password@/api/v1/patrons?_order_by=patron_id&q=" >- . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) )->status_is(200) >- ->json_is( '/0/patron_id' => $patron_1->id )->json_is( '/1/patron_id' => $patron_2->id ) >+ . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) ) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_1->id ) >+ ->json_is( '/1/patron_id' => $patron_2->id ) > ->json_is( '/2/patron_id' => $patron_3->id ); > > @libraries_where_can_see_patrons = ( $library_2->id ); > > my $res = > $t->get_ok( "//$userid:$password@/api/v1/patrons?_order_by=patron_id&q=" >- . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) )->status_is(200) >- ->json_is( '/0/patron_id' => $patron_3->id, 'Returns the only allowed patron' )->tx->res->json; >+ . encode_json( { library_id => [ $library_1->id, $library_2->id ] } ) ) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron_3->id, 'Returns the only allowed patron' ) >+ ->tx->res->json; > > is( scalar @{$res}, 1, 'Only one patron returned' ); > >@@ -322,8 +339,10 @@ subtest 'get() tests' => sub { > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id ) > ->status_is( 200, 'list_borrowers permission makes patron visible' ) >- ->json_is( '/patron_id' => $patron->id )->json_is( '/category_id' => $patron->categorycode ) >- ->json_is( '/surname' => $patron->surname )->json_is( '/patron_card_lost' => Mojo::JSON->false ); >+ ->json_is( '/patron_id' => $patron->id ) >+ ->json_is( '/category_id' => $patron->categorycode ) >+ ->json_is( '/surname' => $patron->surname ) >+ ->json_is( '/patron_card_lost' => Mojo::JSON->false ); > > $schema->storage->txn_rollback; > }; >@@ -365,18 +384,22 @@ subtest 'get() tests' => sub { > $librarian->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $librarian->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_1->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_1->id ) >+ ->status_is(200) > ->json_is( '/patron_id' => $patron_1->id ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id ) >+ ->status_is(200) > ->json_is( '/patron_id' => $patron_2->id ); > > @libraries_where_can_see_patrons = ( $library_1->id ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_1->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_1->id ) >+ ->status_is(200) > ->json_is( '/patron_id' => $patron_1->id ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id ) >+ ->status_is(404) > ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; >@@ -464,7 +487,8 @@ subtest 'add() tests' => sub { > my $userid = $librarian->userid; > t::lib::Mocks::mock_preference( 'PatronDuplicateMatchingAddFields', 'firstname|surname|dateofbirth' ); > >- $t->post_ok( "//$userid:$password@/api/v1/patrons" => json => $newpatron )->status_is(409) >+ $t->post_ok( "//$userid:$password@/api/v1/patrons" => json => $newpatron ) >+ ->status_is(409) > ->json_is( '/error' => "A patron record matching these details already exists" ); > > # Create a library just to make sure its ID doesn't exist on the DB >@@ -478,7 +502,8 @@ subtest 'add() tests' => sub { > > # Test duplicate userid constraint > $t->post_ok( "//$userid:$password@/api/v1/patrons" => { 'x-confirm-not-duplicate' => 1 } => json => $newpatron ) >- ->status_is(400)->json_is( '/error' => "Problem with " . $newpatron->{userid} ); >+ ->status_is(400) >+ ->json_is( '/error' => "Problem with " . $newpatron->{userid} ); > > $newpatron->{library_id} = $patron->branchcode; > >@@ -487,7 +512,8 @@ subtest 'add() tests' => sub { > warning_like { > $t->post_ok( > "//$userid:$password@/api/v1/patrons" => { 'x-confirm-not-duplicate' => 1 } => json => $newpatron ) >- ->status_is(409)->json_has( '/error', 'Fails when trying to POST duplicate cardnumber' ) >+ ->status_is(409) >+ ->json_has( '/error', 'Fails when trying to POST duplicate cardnumber' ) > ->json_like( '/conflict' => qr/(borrowers\.)?cardnumber/ ); > } > qr/DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key '(borrowers\.)?cardnumber'/; >@@ -502,7 +528,8 @@ subtest 'add() tests' => sub { > $newpatron->{category_id} = $deleted_category_id; # Test invalid patron category > > $t->post_ok( "//$userid:$password@/api/v1/patrons" => { 'x-confirm-not-duplicate' => 1 } => json => $newpatron ) >- ->status_is(400)->json_is( '/error' => "Given category_id does not exist" ); >+ ->status_is(400) >+ ->json_is( '/error' => "Given category_id does not exist" ); > $newpatron->{category_id} = $patron->categorycode; > > $newpatron->{falseproperty} = "Non existent property"; >@@ -532,11 +559,15 @@ subtest 'add() tests' => sub { > $letter_enqueued = 0; > $t->post_ok( > "//$userid:$password@/api/v1/patrons" => { 'x-koha-override' => 'welcome_yes' } => json => $newpatron ) >- ->status_is( 201, 'Patron created successfully' )->header_like( >+ ->status_is( 201, 'Patron created successfully' ) >+ ->header_like( > Location => qr|^\/api\/v1\/patrons/\d*|, > 'REST3.4.1' >- )->json_has( '/patron_id', 'got a patron_id' )->json_is( '/cardnumber' => $newpatron->{cardnumber} ) >- ->json_is( '/surname' => $newpatron->{surname} )->json_is( '/firstname' => $newpatron->{firstname} ) >+ ) >+ ->json_has( '/patron_id', 'got a patron_id' ) >+ ->json_is( '/cardnumber' => $newpatron->{cardnumber} ) >+ ->json_is( '/surname' => $newpatron->{surname} ) >+ ->json_is( '/firstname' => $newpatron->{firstname} ) > ->json_is( '/date_of_birth' => $newpatron->{date_of_birth}, 'Date field set (Bug 28585)' ) > ->json_is( '/last_seen' => $newpatron->{last_seen}, 'Date-time field set (Bug 28585)' ); > >@@ -663,7 +694,8 @@ subtest 'add() tests' => sub { > "city" => "Konstanz", > "library_id" => "MPL" > } >- )->status_is(400) >+ ) >+ ->status_is(400) > ->json_is( '/error' => "Tried to add more than one non-repeatable attributes. type=$code value=$attr" ); > > is( Koha::Patrons->search->count, $patrons_count, 'No patron added' ); >@@ -678,7 +710,8 @@ subtest 'add() tests' => sub { > "city" => "Konstanz", > "library_id" => "MPL" > } >- )->status_is(400) >+ ) >+ ->status_is(400) > ->json_is( > '/error' => "Your action breaks a unique constraint on the attribute. type=$code value=$attr" ); > >@@ -839,7 +872,8 @@ subtest 'add() tests' => sub { > "city" => "Bigtown", > "library_id" => "MPL", > } >- )->status_is( 201, 'Patron added with EnhancedMessagingPreferences disabled' ) >+ ) >+ ->status_is( 201, 'Patron added with EnhancedMessagingPreferences disabled' ) > ->tx->res->json->{patron_id}; > > # No messaging preferences should be set >@@ -898,7 +932,8 @@ subtest 'update() tests' => sub { > delete $newpatron->{expired}; > delete $newpatron->{anonymized}; > >- $t->put_ok( "//$userid:$password@/api/v1/patrons/-1" => json => $newpatron )->status_is(404) >+ $t->put_ok( "//$userid:$password@/api/v1/patrons/-1" => json => $newpatron ) >+ ->status_is(404) > ->json_has( '/error', 'Fails when trying to PUT nonexistent patron' ); > > # Create a library just to make sure its ID doesn't exist on the DB >@@ -912,7 +947,8 @@ subtest 'update() tests' => sub { > $newpatron->{category_id} = $deleted_category_id; > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) >- ->status_is(400)->json_is( '/error' => "Given category_id does not exist" ); >+ ->status_is(400) >+ ->json_is( '/error' => "Given category_id does not exist" ); > > # Restore the valid category > $newpatron->{category_id} = $patron_2->categorycode; >@@ -929,7 +965,8 @@ subtest 'update() tests' => sub { > > warning_like { > $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) >- ->status_is(400)->json_is( '/error' => "Given library_id does not exist" ); >+ ->status_is(400) >+ ->json_is( '/error' => "Given library_id does not exist" ); > } > qr/DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails/; > >@@ -940,7 +977,8 @@ subtest 'update() tests' => sub { > $newpatron->{falseproperty} = "Non existent property"; > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) >- ->status_is(400)->json_is( '/errors/0/message' => 'Properties not allowed: falseproperty.' ); >+ ->status_is(400) >+ ->json_is( '/errors/0/message' => 'Properties not allowed: falseproperty.' ); > > # Get rid of the invalid attribute > delete $newpatron->{falseproperty}; >@@ -950,7 +988,8 @@ subtest 'update() tests' => sub { > $newpatron->{userid} = $patron_1->userid; > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) >- ->status_is(400)->json_has( '/error', "Problem with userid " . $patron_1->userid ); >+ ->status_is(400) >+ ->json_has( '/error', "Problem with userid " . $patron_1->userid ); > > $newpatron->{cardnumber} = $patron_1->id . $patron_2->id; > $newpatron->{userid} = "user" . $patron_1->id . $patron_2->id; >@@ -1034,7 +1073,7 @@ subtest 'update() tests' => sub { > ->status_is( > 403, > "Non-superlibrarian user change of superlibrarian secondary_email to undefined forbidden" >- )->json_is( { error => "Not enough privileges to change a superlibrarian's email" } ); >+ )->json_is( { error => "Not enough privileges to change a superlibrarian's email" } ); > > $newpatron->{secondary_email} = $superlibrarian->emailpro; > $newpatron->{altaddress_email} = 'nonsense@no.no'; >@@ -1050,7 +1089,7 @@ subtest 'update() tests' => sub { > ->status_is( > 403, > "Non-superlibrarian user change of superlibrarian altaddress_email to undefined forbidden" >- )->json_is( { error => "Not enough privileges to change a superlibrarian's email" } ); >+ )->json_is( { error => "Not enough privileges to change a superlibrarian's email" } ); > > # update patron without sending email > delete $newpatron->{email}; >@@ -1121,13 +1160,15 @@ subtest 'update() tests' => sub { > "city" => "Konstanz", > "library_id" => "MPL" > } >- )->status_is(400) >+ ) >+ ->status_is(400) > ->json_is( > '/error' => "Missing mandatory extended attribute (type=" . $attr_type_mandatory->code . ")" ); > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $superlibrarian->borrowernumber => { 'x-koha-embed' => 'extended_attributes' } => json => >- $newpatron )->status_is(400) >+ $newpatron ) >+ ->status_is(400) > ->json_is( '/error' => 'Tried to use an invalid attribute type. type=' . $deleted_attr_code ) > ->json_is( '/error_code' => 'invalid_attribute_type' ); > >@@ -1144,11 +1185,13 @@ subtest 'update() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $superlibrarian->borrowernumber => { 'x-koha-embed' => 'extended_attributes' } => json => >- $newpatron )->status_is(400) >+ $newpatron ) >+ ->status_is(400) > ->json_is( '/error' => 'Your action breaks a unique constraint on the attribute. type=' > . $attr_type_unique->code > . ' value=' >- . $unique_attr->attribute )->json_is( '/error_code' => 'attribute_not_unique' ); >+ . $unique_attr->attribute ) >+ ->json_is( '/error_code' => 'attribute_not_unique' ); > > $newpatron->{extended_attributes} = [ > { type => $attr_type_repeatable->code, value => 'a' }, >@@ -1159,11 +1202,13 @@ subtest 'update() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $superlibrarian->borrowernumber => { 'x-koha-embed' => 'extended_attributes' } => json => >- $newpatron )->status_is(400) >+ $newpatron ) >+ ->status_is(400) > ->json_is( '/error' => 'Your action breaks a unique constraint on the attribute. type=' > . $attr_type_unique->code > . ' value=' >- . $unique_attr->attribute )->json_is( '/error_code' => 'attribute_not_unique' ); >+ . $unique_attr->attribute ) >+ ->json_is( '/error_code' => 'attribute_not_unique' ); > > $newpatron->{extended_attributes} = [ > { type => $attr_type_repeatable->code, value => 'a' }, >@@ -1173,10 +1218,12 @@ subtest 'update() tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $superlibrarian->borrowernumber => { 'x-koha-embed' => 'extended_attributes' } => json => >- $newpatron )->status_is(400) >+ $newpatron ) >+ ->status_is(400) > ->json_is( '/error' => 'Tried to add more than one non-repeatable attributes. type=' > . $attr_type_mandatory->code >- . ' value=pong' )->json_is( '/error_code' => 'non_repeatable_attribute' ); >+ . ' value=pong' ) >+ ->json_is( '/error_code' => 'non_repeatable_attribute' ); > > my $unique_value = $unique_attr->attribute; > $unique_attr->delete; >@@ -1235,7 +1282,8 @@ subtest 'delete() tests' => sub { > > t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->borrowernumber ); > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 409, 'Anonymous patron cannot be deleted' )->json_is( >+ ->status_is( 409, 'Anonymous patron cannot be deleted' ) >+ ->json_is( > { > error => 'Anonymous patron cannot be deleted', > error_code => 'is_anonymous_patron' >@@ -1257,7 +1305,8 @@ subtest 'delete() tests' => sub { > $guarantee->add_guarantor( { guarantor_id => $patron->id, relationship => 'parent' } ); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 409, 'Patron with checkouts cannot be deleted' )->json_is( >+ ->status_is( 409, 'Patron with checkouts cannot be deleted' ) >+ ->json_is( > { > error => 'Pending checkouts prevent deletion', > error_code => 'has_checkouts' >@@ -1268,7 +1317,8 @@ subtest 'delete() tests' => sub { > $checkout->delete; > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 409, 'Patron with debt cannot be deleted' )->json_is( >+ ->status_is( 409, 'Patron with debt cannot be deleted' ) >+ ->json_is( > { > error => 'Pending debts prevent deletion', > error_code => 'has_debt' >@@ -1279,7 +1329,8 @@ subtest 'delete() tests' => sub { > $patron->account->pay( { amount => 10, debits => [$debit] } ); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 409, 'Patron with guarantees cannot be deleted' )->json_is( >+ ->status_is( 409, 'Patron with guarantees cannot be deleted' ) >+ ->json_is( > { > error => 'Patron is a guarantor and it prevents deletion', > error_code => 'has_guarantees' >@@ -1292,7 +1343,8 @@ subtest 'delete() tests' => sub { > $patron->protected(1)->store(); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 409, 'Protected patron cannot be deleted' )->json_is( >+ ->status_is( 409, 'Protected patron cannot be deleted' ) >+ ->json_is( > { > error => 'Protected patrons cannot be deleted', > error_code => 'is_protected' >@@ -1302,7 +1354,8 @@ subtest 'delete() tests' => sub { > $patron->protected(0)->store(); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > my $deleted_patrons = Koha::Old::Patrons->search( { borrowernumber => $patron->borrowernumber } ); > is( $deleted_patrons->count, 1, 'The patron has been moved to the vault' ); >@@ -1334,11 +1387,13 @@ subtest 'guarantors_can_see_charges() tests' => sub { > )->status_is(401)->json_is( { error => "Authentication failure." } ); > > $t->put_ok( "//$userid:$password@/api/v1/public/patrons/$other_patron_id/guarantors/can_see_charges" => json => >- { allowed => Mojo::JSON->true } )->status_is(403) >+ { allowed => Mojo::JSON->true } ) >+ ->status_is(403) > ->json_is( { error => "Unprivileged user cannot access another user's resources" } ); > > $t->put_ok( "//$userid:$password@/api/v1/public/patrons/$patron_id/guarantors/can_see_charges" => json => >- { allowed => Mojo::JSON->true } )->status_is(403) >+ { allowed => Mojo::JSON->true } ) >+ ->status_is(403) > ->json_is( '/error', 'The current configuration doesn\'t allow the requested action.' ); > > t::lib::Mocks::mock_preference( 'AllowPatronToSetFinesVisibilityForGuarantor', 1 ); >@@ -1376,13 +1431,15 @@ subtest 'guarantors_can_see_checkouts() tests' => sub { > { allowed => Mojo::JSON->true } )->status_is(401)->json_is( { error => "Authentication failure." } ); > > $t->put_ok( "//$userid:$password@/api/v1/public/patrons/$other_patron_id/guarantors/can_see_checkouts" => json => >- { allowed => Mojo::JSON->true } )->status_is(403) >+ { allowed => Mojo::JSON->true } ) >+ ->status_is(403) > ->json_is( { error => "Unprivileged user cannot access another user's resources" } ); > > t::lib::Mocks::mock_preference( 'AllowPatronToSetCheckoutsVisibilityForGuarantor', 0 ); > > $t->put_ok( "//$userid:$password@/api/v1/public/patrons/$patron_id/guarantors/can_see_checkouts" => json => >- { allowed => Mojo::JSON->true } )->status_is(403) >+ { allowed => Mojo::JSON->true } ) >+ ->status_is(403) > ->json_is( '/error', 'The current configuration doesn\'t allow the requested action.' ); > > t::lib::Mocks::mock_preference( 'AllowPatronToSetCheckoutsVisibilityForGuarantor', 1 ); >@@ -1425,7 +1482,8 @@ sub unauthorized_access_tests { > $unauthorized_patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $unauthorized_patron->userid; > >- $t->$verb_ok( "//$unauth_userid:$password\@$endpoint" => json => $json )->status_is(403) >+ $t->$verb_ok( "//$unauth_userid:$password\@$endpoint" => json => $json ) >+ ->status_is(403) > ->json_has('/required_permissions'); > }; > } >diff --git a/t/db_dependent/api/v1/patrons_accounts.t b/t/db_dependent/api/v1/patrons_accounts.t >index 8c43b78021c..e0d88fd28f7 100755 >--- a/t/db_dependent/api/v1/patrons_accounts.t >+++ b/t/db_dependent/api/v1/patrons_accounts.t >@@ -90,8 +90,10 @@ subtest 'get_balance() tests' => sub { > )->store(); > $debit_2->discard_changes; > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account")->status_is(200) >- ->or( sub { diag $t->tx->res->body } )->json_is( >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account") >+ ->status_is(200) >+ ->or( sub { diag $t->tx->res->body } ) >+ ->json_is( > { > balance => 100.01, > outstanding_debits => { >@@ -213,10 +215,11 @@ subtest 'add_credit() tests' => sub { > > my $ret = > $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) >- ->status_is(201)->header_is( >+ ->status_is(201) >+ ->header_is( > 'Location' => "/api/v1/patrons/$patron_id/account/credits/" . $t->tx->res->json->{account_line_id}, > "REST3.4.1" >- )->tx->res->json; >+ )->tx->res->json; > > is_deeply( > $ret, >@@ -225,7 +228,7 @@ subtest 'add_credit() tests' => sub { > ); > > my $outstanding_credits = $account->outstanding_credits; >- is( $outstanding_credits->count, 1 ); >+ is( $outstanding_credits->count, 1 ); > is( $outstanding_credits->total_outstanding, -100 ); > > my $debit_1 = $account->add_debit( >@@ -250,8 +253,10 @@ subtest 'add_credit() tests' => sub { > is( $account->outstanding_debits->total_outstanding, 25 ); > $credit->{library_id} = $library->id; > >- $ret = $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) >- ->status_is(201)->tx->res->json; >+ $ret = >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) >+ ->status_is(201) >+ ->tx->res->json; > > is_deeply( > $ret, >@@ -285,8 +290,10 @@ subtest 'add_credit() tests' => sub { > account_lines_ids => [ $debit_1->id, $debit_2->id, $debit_3->id ] > }; > >- $ret = $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) >- ->status_is(201)->tx->res->json; >+ $ret = >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) >+ ->status_is(201) >+ ->tx->res->json; > > is_deeply( > $ret, >@@ -328,20 +335,26 @@ subtest 'get_credit() tests' => sub { > ); > my $credit_id = $credit->id; > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits/$credit_id")->status_is(200) >- ->json_is( '/account_line_id' => $credit_id )->json_is( '/patron_id' => $patron_id ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits/$credit_id") >+ ->status_is(200) >+ ->json_is( '/account_line_id' => $credit_id ) >+ ->json_is( '/patron_id' => $patron_id ); > > $credit->delete(); > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits/$credit_id")->status_is(404) >- ->json_is( '/error_code' => 'not_found' )->json_is( '/error' => 'Credit not found' ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits/$credit_id") >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ) >+ ->json_is( '/error' => 'Credit not found' ); > > my $deleted_patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $deleted_patron_id = $deleted_patron->id; > $deleted_patron->delete(); > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$deleted_patron_id/account/credits/$credit_id")->status_is(404) >- ->json_is( '/error_code' => 'not_found' )->json_is( '/error' => 'Patron not found' ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$deleted_patron_id/account/credits/$credit_id") >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ) >+ ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; > }; >@@ -413,20 +426,26 @@ subtest 'get_debit() tests' => sub { > ); > my $debit_id = $debit->id; > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/debits/$debit_id")->status_is(200) >- ->json_is( '/account_line_id' => $debit_id )->json_is( '/patron_id' => $patron_id ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/debits/$debit_id") >+ ->status_is(200) >+ ->json_is( '/account_line_id' => $debit_id ) >+ ->json_is( '/patron_id' => $patron_id ); > > $debit->delete(); > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/debits/$debit_id")->status_is(404) >- ->json_is( '/error_code' => 'not_found' )->json_is( '/error' => 'Debit not found' ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/debits/$debit_id") >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ) >+ ->json_is( '/error' => 'Debit not found' ); > > my $deleted_patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $deleted_patron_id = $deleted_patron->id; > $deleted_patron->delete(); > >- $t->get_ok("//$userid:$password@/api/v1/patrons/$deleted_patron_id/account/debits/$debit_id")->status_is(404) >- ->json_is( '/error_code' => 'not_found' )->json_is( '/error' => 'Patron not found' ); >+ $t->get_ok("//$userid:$password@/api/v1/patrons/$deleted_patron_id/account/debits/$debit_id") >+ ->status_is(404) >+ ->json_is( '/error_code' => 'not_found' ) >+ ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; > }; >@@ -513,8 +532,11 @@ subtest 'add_debit() tests' => sub { > library_id => $library->id, > }; > >- my $ret = $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit ) >- ->status_is(201)->json_is( '/user_id' => $librarian_x->id, 'Passed user_id is stored' )->tx->res->json; >+ my $ret = >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit ) >+ ->status_is(201) >+ ->json_is( '/user_id' => $librarian_x->id, 'Passed user_id is stored' ) >+ ->tx->res->json; > my $account_line = Koha::Account::Debits->find( $ret->{account_line_id} ); > > is_deeply( $ret, $account_line->to_api, 'Line returned correctly' ); >@@ -549,7 +571,8 @@ subtest 'add_debit() tests' => sub { > > my $account_line_id = $ret->{account_line_id}; > >- $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit )->status_is(201) >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit ) >+ ->status_is(201) > ->header_is( > 'Location' => "/api/v1/patrons/$patron_id/account/debits/" . $t->tx->res->json->{account_line_id}, > "REST3.4.1" >@@ -571,13 +594,16 @@ subtest 'add_debit() tests' => sub { > library_id => $library->id, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $payout )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $payout ) >+ ->status_is(400) > ->json_is( '/error' => 'Account transaction requires a cash register' ); > > my $register = $builder->build_object( { class => 'Koha::Cash::Registers', } ); > $payout->{cash_register_id} = $register->id; >- my $res = $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $payout ) >- ->status_is(201)->tx->res->json; >+ my $res = >+ $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $payout ) >+ ->status_is(201) >+ ->tx->res->json; > > is( $res->{user_id}, $librarian->id, 'If not passed, the session user ID is picked' ); > >diff --git a/t/db_dependent/api/v1/patrons_checkouts.t b/t/db_dependent/api/v1/patrons_checkouts.t >index 7084f6d9322..d9156235958 100755 >--- a/t/db_dependent/api/v1/patrons_checkouts.t >+++ b/t/db_dependent/api/v1/patrons_checkouts.t >@@ -67,14 +67,17 @@ subtest 'Patron checkouts list() tests' => sub { > my $issue1 = C4::Circulation::AddIssue( $patron, $item1->barcode, $date_due ); > my $issue2 = C4::Circulation::AddIssue( $patron, $item2->barcode, $date_due ); > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/checkouts' )->status_is(200) >- ->json_is( '/0/item_id' => $item1->itemnumber )->json_is( '/1/item_id' => $item2->itemnumber ); >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/checkouts' ) >+ ->status_is(200) >+ ->json_is( '/0/item_id' => $item1->itemnumber ) >+ ->json_is( '/1/item_id' => $item2->itemnumber ); > > my $non_existent_patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $non_existent_patron_id = $non_existent_patron->id; > $non_existent_patron->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/checkouts' )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/checkouts' ) >+ ->status_is(404) > ->json_is( '/error' => 'Patron not found' ); > > my $unauthorized_patron = $builder->build_object( >@@ -89,5 +92,6 @@ subtest 'Patron checkouts list() tests' => sub { > my $unauthorized_userid = $unauthorized_patron->userid; > > $t->get_ok( "//$unauthorized_userid:$unauthorized_password@/api/v1/patrons/" . $patron->id . '/checkouts' ) >- ->status_is(403)->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); >+ ->status_is(403) >+ ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > } >diff --git a/t/db_dependent/api/v1/patrons_extended_attributes.t b/t/db_dependent/api/v1/patrons_extended_attributes.t >index 24b0fe0f0b1..a449bd55a37 100755 >--- a/t/db_dependent/api/v1/patrons_extended_attributes.t >+++ b/t/db_dependent/api/v1/patrons_extended_attributes.t >@@ -50,7 +50,8 @@ subtest 'list_patron_attributes() tests' => sub { > my $userid = $patron->userid; > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/extended_attributes' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( [] ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( [] ); > > # Let's add 3 attributes > foreach my $i ( 1 .. 5 ) { >@@ -68,7 +69,8 @@ subtest 'list_patron_attributes() tests' => sub { > $non_existent_patron->delete; > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/extended_attributes' ) >- ->status_is(404)->json_is( '/error' => 'Patron not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Patron not found' ); > > subtest 'nullable value' => sub { > >@@ -86,7 +88,8 @@ subtest 'list_patron_attributes() tests' => sub { > ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $user->id . '/extended_attributes' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( > '' => $user->extended_attributes->to_api, > 'Extended attributes retrieved correctly' > ); >@@ -155,13 +158,15 @@ subtest 'add() tests' => sub { > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $non_existent_patron_id > . '/extended_attributes' => json => { type => $repeatable_attr_type->code, value => 'something' } ) >- ->status_is(404)->json_is( '/error' => 'Patron not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Patron not found' ); > > my $response = > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . '/extended_attributes' => json => { type => $repeatable_attr_type->code, value => 'something' } ) >- ->status_is(201)->tx->res->json; >+ ->status_is(201) >+ ->tx->res->json; > > is_deeply( > Koha::Patron::Attributes->find( $response->{extended_attribute_id} )->to_api, >@@ -210,7 +215,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . '/extended_attributes' => json => { type => $invalid_type, value => 'blah' } )->status_is(400) >+ . '/extended_attributes' => json => { type => $invalid_type, value => 'blah' } ) >+ ->status_is(400) > ->json_is( '/error' => "Tried to use an invalid attribute type. type=$invalid_type" ); > }; > >@@ -281,11 +287,13 @@ subtest 'overwrite() tests' => sub { > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $non_existent_patron_id > . '/extended_attributes' => json => [ { type => $repeatable_attr_type->code, value => 'something' } ] ) >- ->status_is(404)->json_is( '/error' => 'Patron not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Patron not found' ); > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . '/extended_attributes' => json => [ { type => $invalid_type, value => 'something' } ] )->status_is(400) >+ . '/extended_attributes' => json => [ { type => $invalid_type, value => 'something' } ] ) >+ ->status_is(400) > ->json_is( '/error' => "Tried to use an invalid attribute type. type=$invalid_type" ); > > my $unique_value = 'The only one!'; >@@ -308,7 +316,8 @@ subtest 'overwrite() tests' => sub { > { type => $unique_attr_type->code, value => $value_1 }, > { type => $unique_attr_type->code, value => $value_2 } > ] >- )->status_is(409) >+ ) >+ ->status_is(409) > ->json_is( '/error' => "Tried to add more than one non-repeatable attributes. type=" > . $unique_attr_type->code > . " value=$value_2" ); >@@ -349,14 +358,16 @@ subtest 'overwrite() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/patrons/" . $patron->id . '/extended_attributes' => json => $updated_attributes ) >- ->status_is(200)->json_is( '/0/type' => $updated_attributes->[0]->{type} ) >+ ->status_is(200) >+ ->json_is( '/0/type' => $updated_attributes->[0]->{type} ) > ->json_is( '/0/value' => $updated_attributes->[0]->{value} ) > ->json_is( '/1/type' => $updated_attributes->[1]->{type} ) > ->json_is( '/1/value' => $updated_attributes->[1]->{value} ) > ->json_is( '/2/type' => $updated_attributes->[2]->{type} ) > ->json_is( '/2/value' => $updated_attributes->[2]->{value} ) > ->json_is( '/3/type' => $updated_attributes->[3]->{type} ) >- ->json_is( '/3/value' => $updated_attributes->[3]->{value} )->json_hasnt('/4'); >+ ->json_is( '/3/value' => $updated_attributes->[3]->{value} ) >+ ->json_hasnt('/4'); > > $schema->storage->txn_rollback; > }; >@@ -394,15 +405,18 @@ subtest 'delete() tests' => sub { > my $attr = $dummy_patron->add_extended_attribute( { code => $attr_type->code, attribute => 'blah' } ); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $dummy_patron->id . '/extended_attributes/' . $attr->id ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $dummy_patron->id . '/extended_attributes/' . $attr->id ) >- ->status_is(404)->json_is( '/error' => 'Attribute not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Attribute not found' ); > > $dummy_patron->delete; > > $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $dummy_patron->id . '/extended_attributes/' . $attr->id ) >- ->status_is(404)->json_is( '/error' => 'Patron not found' ); >+ ->status_is(404) >+ ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; > }; >@@ -478,7 +492,8 @@ subtest 'update() tests' => sub { > $t->patch_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . '/extended_attributes/' >- . $non_existent_attribute_id => json => { value => 'something' } )->status_is(404) >+ . $non_existent_attribute_id => json => { value => 'something' } ) >+ ->status_is(404) > ->json_is( '/error' => 'Attribute not found' ); > > my $response = >@@ -506,7 +521,8 @@ subtest 'update() tests' => sub { > $t->patch_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . '/extended_attributes/' >- . $unique_attribute->id => json => { value => $unique_value } )->status_is(409) >+ . $unique_attribute->id => json => { value => $unique_value } ) >+ ->status_is(409) > ->json_is( '/error' => "Your action breaks a unique constraint on the attribute. type=" > . $unique_attr_type->code > . " value=$unique_value" ); >diff --git a/t/db_dependent/api/v1/patrons_hold_groups.t b/t/db_dependent/api/v1/patrons_hold_groups.t >index 259aebdd925..37ee9016bd5 100755 >--- a/t/db_dependent/api/v1/patrons_hold_groups.t >+++ b/t/db_dependent/api/v1/patrons_hold_groups.t >@@ -50,7 +50,8 @@ subtest 'list() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/hold_groups' )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/hold_groups' ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( [] ); > > my $hold_group_1 = $builder->build_object( >@@ -79,7 +80,8 @@ subtest 'list() tests' => sub { > ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/hold_groups' => { 'x-koha-embed' => 'holds' } ) >- ->status_is( 200, 'REST3.2.2' )->json_has( "/0/holds", "holds object correctly embedded" ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_has( "/0/holds", "holds object correctly embedded" ); > > $schema->storage->txn_rollback; > }; >@@ -133,7 +135,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $other_patron->id >- . "/hold_groups" => json => { hold_ids => [ $hold_3->reserve_id ] } )->status_is( 400, 'REST3.2.1' ) >+ . "/hold_groups" => json => { hold_ids => [ $hold_3->reserve_id ] } ) >+ ->status_is( 400, 'REST3.2.1' ) > ->json_is( > { > error => 'One or more holds have already been found: ' . $hold_3->item->barcode, >@@ -143,7 +146,8 @@ subtest 'add() tests' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/hold_groups" => json => { hold_ids => [ $hold_3->reserve_id ] } )->status_is( 400, 'REST3.2.1' ) >+ . "/hold_groups" => json => { hold_ids => [ $hold_3->reserve_id ] } ) >+ ->status_is( 400, 'REST3.2.1' ) > ->json_is( > { > error => 'One or more holds do not belong to patron: ' . $hold_3->reserve_id, >@@ -154,12 +158,14 @@ subtest 'add() tests' => sub { > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . "/hold_groups" => json => { hold_ids => [ $hold_1->reserve_id, $hold_2->reserve_id ] } ) >- ->status_is( 201, 'REST3.2.1' )->json_has( "/holds", "holds object correctly embedded" ); >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( "/holds", "holds object correctly embedded" ); > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . "/hold_groups" => json => { hold_ids => [ $hold_1->reserve_id, $hold_2->reserve_id ] } ) >- ->status_is( 400, 'REST3.2.1' )->json_is( >+ ->status_is( 400, 'REST3.2.1' ) >+ ->json_is( > { > error => "One or more holds already belong to a hold group: " > . $hold_1->reserve_id . ", " >diff --git a/t/db_dependent/api/v1/patrons_holds.t b/t/db_dependent/api/v1/patrons_holds.t >index 78f995488c6..48cb3c8dca7 100755 >--- a/t/db_dependent/api/v1/patrons_holds.t >+++ b/t/db_dependent/api/v1/patrons_holds.t >@@ -50,7 +50,8 @@ subtest 'list() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds' )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds' ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( [] ); > > my $hold_1 = $builder->build_object( >@@ -68,7 +69,8 @@ subtest 'list() tests' => sub { > $hold_3->fill; > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?_order_by=+me.hold_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( '' => [ $hold_2->to_api ], 'Only current holds retrieved' ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '' => [ $hold_2->to_api ], 'Only current holds retrieved' ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?old=1&_order_by=+me.hold_id' ) > ->status_is( 200, 'REST3.2.2' ) >@@ -79,14 +81,16 @@ subtest 'list() tests' => sub { > $old_hold_1->pickup_library->delete; > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?old=1&_order_by=+me.hold_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( > '' => [ $old_hold_1->get_from_storage->to_api, $hold_3->to_api ], > 'Old holds even after item and library removed' > ); > > $old_hold_1->biblio->delete; > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?old=1&_order_by=+me.hold_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( > '' => [ $old_hold_1->get_from_storage->to_api, $hold_3->to_api ], > 'Old holds even after biblio removed' > ); >@@ -97,7 +101,8 @@ subtest 'list() tests' => sub { > # get rid of the patron > $non_existent_patron->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/holds' )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/holds' ) >+ ->status_is(404) > ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; >@@ -125,7 +130,8 @@ subtest 'delete_public() tests' => sub { > my $deleted_hold_id = $hold_to_delete->id; > $hold_to_delete->delete; > >- $t->delete_ok( "/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id )->status_is(401) >+ $t->delete_ok( "/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id ) >+ ->status_is(401) > ->json_is( { error => 'Authentication failure.' } ); > > $t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id ) >@@ -154,7 +160,8 @@ subtest 'delete_public() tests' => sub { > ); > > $t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $non_waiting_hold->id ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > my $cancellation_requestable; > >@@ -176,7 +183,8 @@ subtest 'delete_public() tests' => sub { > $cancellation_requestable = 0; > > $t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $waiting_hold->id ) >- ->status_is(403)->json_is( { error => 'Cancellation forbidden' } ); >+ ->status_is(403) >+ ->json_is( { error => 'Cancellation forbidden' } ); > > $cancellation_requestable = 1; > >diff --git a/t/db_dependent/api/v1/patrons_password.t b/t/db_dependent/api/v1/patrons_password.t >index 1e08f1dc2ab..17f813f63db 100755 >--- a/t/db_dependent/api/v1/patrons_password.t >+++ b/t/db_dependent/api/v1/patrons_password.t >@@ -59,43 +59,50 @@ subtest 'set() (authorized user tests)' => sub { > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(200) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(200) > ->json_is(''); > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => 'cde' } )->status_is(400) >+ . "/password" => json => { password => $new_password, password_2 => 'cde' } ) >+ ->status_is(400) > ->json_is( { error => 'Passwords don\'t match' } ); > > t::lib::Mocks::mock_preference( 'minPasswordLength', 5 ); > > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(400) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(400) > ->json_is( { error => 'Password length (3) is shorter than required (5)' } ); > > $new_password = 'abc '; > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(400) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(400) > ->json_is( { error => '[Password contains leading/trailing whitespace character(s)]' } ); > > $new_password = 'abcdefg'; > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(200) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(200) > ->json_is(''); > > t::lib::Mocks::mock_preference( 'RequireStrongPassword', 1 ); > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(400) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(400) > ->json_is( { error => '[Password is too weak]' } ); > > $new_password = 'ABcde123%&'; > $t->post_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password } )->status_is(200) >+ . "/password" => json => { password => $new_password, password_2 => $new_password } ) >+ ->status_is(200) > ->json_is(''); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/patrons_password_expiration.t b/t/db_dependent/api/v1/patrons_password_expiration.t >index 2e6cf60c080..c213d5fa1e6 100755 >--- a/t/db_dependent/api/v1/patrons_password_expiration.t >+++ b/t/db_dependent/api/v1/patrons_password_expiration.t >@@ -60,12 +60,14 @@ subtest 'basic tests' => sub { > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password/expiration_date" => json => { expiration_date => '01/13/2021' } )->status_is(400) >+ . "/password/expiration_date" => json => { expiration_date => '01/13/2021' } ) >+ ->status_is(400) > ->json_is( '/errors/0/message' => 'Does not match date format.' ); > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id >- . "/password/expiration_date" => json => { expiration_date => '13/01/2021' } )->status_is(400) >+ . "/password/expiration_date" => json => { expiration_date => '13/01/2021' } ) >+ ->status_is(400) > ->json_is( '/errors/0/message' => 'Does not match date format.' ); > > $privileged_patron->flags(0)->store(); >diff --git a/t/db_dependent/api/v1/patrons_recalls.t b/t/db_dependent/api/v1/patrons_recalls.t >index 7d126dbe678..052ec948d09 100755 >--- a/t/db_dependent/api/v1/patrons_recalls.t >+++ b/t/db_dependent/api/v1/patrons_recalls.t >@@ -49,7 +49,8 @@ subtest 'list() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/recalls' )->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/recalls' ) >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( [] ); > > my $recall_1 = $builder->build_object( { class => 'Koha::Recalls', value => { patron_id => $patron->id } } ); >@@ -60,15 +61,18 @@ subtest 'list() tests' => sub { > my $recall_3 = $builder->build_object( { class => 'Koha::Recalls', value => { patron_id => $patron_2->id } } ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/recalls?_order_by=+me.recall_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( '' => [ $recall_1->to_api, $recall_2->to_api ], 'Recalls retrieved' ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '' => [ $recall_1->to_api, $recall_2->to_api ], 'Recalls retrieved' ); > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id . '/recalls?_order_by=+me.recall_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( '' => [ $recall_3->to_api ], 'Recalls retrieved' ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( '' => [ $recall_3->to_api ], 'Recalls retrieved' ); > > $recall_3->delete; > > $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id . '/recalls?_order_by=+me.recall_id' ) >- ->status_is( 200, 'REST3.2.2' )->json_is( [] ); >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_is( [] ); > > my $non_existent_patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $non_existent_patron_id = $non_existent_patron->id; >@@ -76,7 +80,8 @@ subtest 'list() tests' => sub { > # get rid of the patron > $non_existent_patron->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/recalls' )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $non_existent_patron_id . '/recalls' ) >+ ->status_is(404) > ->json_is( '/error' => 'Patron not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/preservation_Processings.t b/t/db_dependent/api/v1/preservation_Processings.t >index 1509e2eee77..786f821eaf1 100755 >--- a/t/db_dependent/api/v1/preservation_Processings.t >+++ b/t/db_dependent/api/v1/preservation_Processings.t >@@ -72,7 +72,8 @@ subtest 'list() tests' => sub { > ); > > # One processing created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/preservation/processings")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/preservation/processings") >+ ->status_is(200) > ->json_is( [ $processing->to_api ] ); > > # Unauthorized access >@@ -122,12 +123,14 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This processing exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/preservation/processings/" . $processing->processing_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/preservation/processings/" . $processing->processing_id ) >+ ->status_is(200) > ->json_is( $processing->to_api ); > > # Return one processing with attributes > $t->get_ok( "//$userid:$password@/api/v1/preservation/processings/" >- . $processing->processing_id => { 'x-koha-embed' => 'attributes' } )->status_is(200) >+ . $processing->processing_id => { 'x-koha-embed' => 'attributes' } ) >+ ->status_is(200) > ->json_is( { %{ $processing->to_api }, attributes => $attributes->to_api } ); > > # Unauthorized access >@@ -139,7 +142,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $processing_to_delete->processing_id; > $processing_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/preservation/processings/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/preservation/processings/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Processing not found' ); > > $schema->storage->txn_rollback; >@@ -186,7 +190,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -198,19 +203,22 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $processing_id = > $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/preservation/processings/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $processing->{name} )->tx->res->json->{processing_id}; >+ )->json_is( '/name' => $processing->{name} )->tx->res->json->{processing_id}; > > # Authorized attempt to create with null id > $processing->{processing_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $processing->{processing_id} = $processing_id; >- $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/preservation/processings" => json => $processing ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -259,7 +267,8 @@ subtest 'update() tests' => sub { > my $processing_with_missing_field = {}; > > $t->put_ok( "//$userid:$password@/api/v1/preservation/processings/$processing_id" => json => >- $processing_with_missing_field )->status_is(400) >+ $processing_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > my $default_processing = $builder->build_object( { class => 'Koha::Preservation::Processings' } ); >@@ -337,7 +346,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/preservation/processings/$processing_id")->status_is(403); > > # Delete existing processing >- $t->delete_ok("//$userid:$password@/api/v1/preservation/processings/$processing_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/preservation/processings/$processing_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent processing >diff --git a/t/db_dependent/api/v1/preservation_Trains.t b/t/db_dependent/api/v1/preservation_Trains.t >index 9cb2bfe3cbd..aa3e0db2b9b 100755 >--- a/t/db_dependent/api/v1/preservation_Trains.t >+++ b/t/db_dependent/api/v1/preservation_Trains.t >@@ -110,12 +110,14 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This train exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/preservation/trains/" . $train->train_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/preservation/trains/" . $train->train_id ) >+ ->status_is(200) > ->json_is( $train->to_api ); > > # Return one train with some embeds > $t->get_ok( "//$userid:$password@/api/v1/preservation/trains/" >- . $train->train_id => { 'x-koha-embed' => 'items,default_processing' } )->status_is(200) >+ . $train->train_id => { 'x-koha-embed' => 'items,default_processing' } ) >+ ->status_is(200) > ->json_is( { %{ $train->to_api }, items => [], default_processing => $default_processing->unblessed } ); > > # Return one train with all embeds >@@ -140,7 +142,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $train_to_delete->train_id; > $train_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/preservation/trains/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/preservation/trains/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Train not found' ); > > $schema->storage->txn_rollback; >@@ -190,7 +193,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/preservation/trains" => json => $train_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -202,16 +206,21 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $train_id = > $t->post_ok( "//$userid:$password@/api/v1/preservation/trains" => json => $train ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/preservation/trains/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $train->{name} )->json_is( '/description' => $train->{description} ) >+ ) >+ ->json_is( '/name' => $train->{name} ) >+ ->json_is( '/description' => $train->{description} ) > ->json_is( '/default_processing_id' => $train->{default_processing_id} ) >- ->json_is( '/not_for_loan' => $train->{not_for_loan} )->tx->res->json->{train_id}; >+ ->json_is( '/not_for_loan' => $train->{not_for_loan} ) >+ ->tx->res->json->{train_id}; > > # Authorized attempt to create with null id > $train->{train_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/preservation/trains" => json => $train )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/preservation/trains" => json => $train ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id >@@ -264,7 +273,8 @@ subtest 'update() tests' => sub { > my $train_with_missing_field = {}; > > $t->put_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id" => json => $train_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > my $default_processing = $builder->build_object( { class => 'Koha::Preservation::Processings' } ); > >@@ -277,7 +287,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id" => json => $train_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'New name' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'New name' ); > > # Authorized attempt to write invalid data > my $train_with_invalid_field = { >@@ -286,7 +297,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id" => json => $train_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -345,7 +357,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/preservation/trains/$train_id")->status_is(403); > > # Delete existing train >- $t->delete_ok("//$userid:$password@/api/v1/preservation/trains/$train_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/preservation/trains/$train_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent train >@@ -436,9 +449,12 @@ subtest '*_item() tests' => sub { > ]; > my $train_item_id = > $t->post_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id/items" => json => >- { item_id => $item_1->itemnumber, attributes => $item_attributes } )->status_is( 201, 'REST3.2.1' ) >- ->json_is( '/item_id' => $item_1->itemnumber )->json_is( '/processing_id' => $train->default_processing_id ) >- ->json_has('/added_on')->tx->res->json->{train_item_id}; >+ { item_id => $item_1->itemnumber, attributes => $item_attributes } ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_is( '/item_id' => $item_1->itemnumber ) >+ ->json_is( '/processing_id' => $train->default_processing_id ) >+ ->json_has('/added_on') >+ ->tx->res->json->{train_item_id}; > my $train_item = Koha::Preservation::Train::Items->find($train_item_id); > > $t->get_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id/items/$train_item_id" => >@@ -471,8 +487,11 @@ subtest '*_item() tests' => sub { > > $item_3->notforloan($not_for_loan_waiting_list_in)->store; > $t->post_ok( "//$userid:$password@/api/v1/preservation/trains/$train_id/items/batch" => json => >- [ { item_id => $item_3->itemnumber } ] )->status_is(201)->json_is( '/0/item_id' => $item_3->itemnumber ) >- ->json_is( '/0/processing_id' => $train->default_processing_id )->json_has('/0/added_on'); >+ [ { item_id => $item_3->itemnumber } ] ) >+ ->status_is(201) >+ ->json_is( '/0/item_id' => $item_3->itemnumber ) >+ ->json_is( '/0/processing_id' => $train->default_processing_id ) >+ ->json_has('/0/added_on'); > > # Update item > my $new_item_attributes = [ >@@ -502,10 +521,12 @@ subtest '*_item() tests' => sub { > > # Delete existing item > $t->delete_ok("//$userid:$password@/api/v1/preservation/trains/$train_id/items/$train_item_id") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Delete non existing item >- $t->delete_ok("//$userid:$password@/api/v1/preservation/trains/$train_id/items/$train_item_id")->status_is(404) >+ $t->delete_ok("//$userid:$password@/api/v1/preservation/trains/$train_id/items/$train_item_id") >+ ->status_is(404) > ->json_is( '/error' => 'Train item not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/public/lists.t b/t/db_dependent/api/v1/public/lists.t >index 1fa0e7c5d03..15512e6593a 100755 >--- a/t/db_dependent/api/v1/public/lists.t >+++ b/t/db_dependent/api/v1/public/lists.t >@@ -75,7 +75,8 @@ subtest 'list_public() tests' => sub { > ); > > # anonymous >- $t->get_ok("/api/v1/public/lists?q=$q")->status_is( 200, "Anonymous users can only fetch public lists" ) >+ $t->get_ok("/api/v1/public/lists?q=$q") >+ ->status_is( 200, "Anonymous users can only fetch public lists" ) > ->json_is( [ $list_1->to_api( { public => 1 } ), $list_3->to_api( { public => 1 } ) ] ); > > $t->get_ok("/api/v1/public/lists?q=$q&only_public=1") >diff --git a/t/db_dependent/api/v1/query.t b/t/db_dependent/api/v1/query.t >index 6c2809ffc22..63fe07d7a62 100755 >--- a/t/db_dependent/api/v1/query.t >+++ b/t/db_dependent/api/v1/query.t >@@ -82,13 +82,15 @@ subtest 'q handling tests' => sub { > my $q_empty_list = "q=[]"; > > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?$q_ends_with_a&$q_starts_with_a&$q_empty_list")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cities?$q_ends_with_a&$q_starts_with_a&$q_empty_list") >+ ->status_is(200) > ->tx->res->json; > > is( scalar @{$cities}, 1, 'empty list as trailing query, 1 city retrieved' ); > > $cities = >- $t->get_ok("//$userid:$password@/api/v1/cities?$q_empty_list&$q_ends_with_a&$q_starts_with_a")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/cities?$q_empty_list&$q_ends_with_a&$q_starts_with_a") >+ ->status_is(200) > ->tx->res->json; > > is( scalar @{$cities}, 1, 'empty list as first query, 1 city retrieved' ); >@@ -143,19 +145,22 @@ subtest 'q in body handling tests' => sub { > > $cities = > $t->get_ok( "//$userid:$password@/api/v1/cities?q=$q_starts_with_a_str" => json => $q_ends_with_a ) >- ->status_is(200)->tx->res->json; >+ ->status_is(200) >+ ->tx->res->json; > > is( scalar @{$cities}, 1, 'Mixing query parameter and body, 1 city retrieved' ); > > $cities = > $t->get_ok( "//$userid:$password@/api/v1/cities?q=$q_ends_with_a_str" => json => $q_starts_with_a ) >- ->status_is(200)->tx->res->json; >+ ->status_is(200) >+ ->tx->res->json; > > is( scalar @{$cities}, 1, 'Mixing query parameter and body (flipped), 1 city retrieved' ); > > $cities = > $t->get_ok( "//$userid:$password@/api/v1/cities" => json => { "-and" => [ $q_ends_with_a, $q_starts_with_a ] } ) >- ->status_is(200)->tx->res->json; >+ ->status_is(200) >+ ->tx->res->json; > > is( scalar @{$cities}, 1, 'Body query is passed through, 1 city retrieved' ); > >@@ -189,7 +194,8 @@ subtest 'x-koha-embed tests' => sub { > { 'x-koha-embed' => 'extended_attributes,custom_bad_embed,another_bad_embed' } )->status_is(400); > > $res = >- $t->get_ok( "//$userid:$password@/api/v1/cities" => { 'x-koha-embed' => 'any_embed' } )->status_is(400) >+ $t->get_ok( "//$userid:$password@/api/v1/cities" => { 'x-koha-embed' => 'any_embed' } ) >+ ->status_is(400) > ->tx->res->json; > > is( $res, 'Embedding objects is not allowed on this endpoint.', 'Correct error message is returned' ); >diff --git a/t/db_dependent/api/v1/record_sources.t b/t/db_dependent/api/v1/record_sources.t >index 73433f6c2c3..3634b97a7aa 100755 >--- a/t/db_dependent/api/v1/record_sources.t >+++ b/t/db_dependent/api/v1/record_sources.t >@@ -66,7 +66,8 @@ subtest 'list() tests' => sub { > $nonprivilegedpatron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $nonprivilegedpatron->userid; > >- $t->get_ok("//$userid:$password@/api/v1/record_sources")->status_is(403) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources") >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); >@@ -79,12 +80,14 @@ subtest 'list() tests' => sub { > is( $response_count, 10, 'The API returns 10 sources' ); > > my $id = $source->record_source_id; >- $t->get_ok("//$userid:$password@/api/v1/record_sources?q={\"record_source_id\": $id}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources?q={\"record_source_id\": $id}") >+ ->status_is(200) > ->json_is( '' => [ $source->to_api ], 'REST3.3.2' ); > > $source->delete; > >- $t->get_ok("//$userid:$password@/api/v1/record_sources?q={\"record_source_id\": $id}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources?q={\"record_source_id\": $id}") >+ ->status_is(200) > ->json_is( '' => [] ); > > $schema->storage->txn_rollback; >@@ -118,18 +121,21 @@ subtest 'get() tests' => sub { > > my $id = $source->record_source_id; > >- $t->get_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is(403) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); > $userid = $patron->userid; > >- $t->get_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( '' => $source->to_api, 'REST3.3.2' ); > > $source->delete; > >- $t->get_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is(404) > ->json_is( '/error' => 'Record source not found' ); > > $schema->storage->txn_rollback; >@@ -163,14 +169,16 @@ subtest 'delete() tests' => sub { > > my $id = $source->record_source_id; > >- $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is(403) >+ $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); > $userid = $patron->userid; > > $source->delete(); >- $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 404, 'REST4.3' ) >+ $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is( 404, 'REST4.3' ) > ->json_is( { error => q{Record source not found}, error_code => q{not_found} } ); > > $source = $builder->build_object( { class => 'Koha::RecordSources' } ); >@@ -184,7 +192,8 @@ subtest 'delete() tests' => sub { > > $biblio->delete(); > >- $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/record_sources/$id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( q{}, 'REST3.3.4' ); > > my $deleted_source = Koha::RecordSources->search( { record_source_id => $id } ); >@@ -220,7 +229,8 @@ subtest 'add() tests' => sub { > my $userid = $nonprivilegedpatron->userid; > my $patron_id = $nonprivilegedpatron->borrowernumber; > >- $t->post_ok( "//$userid:$password@/api/v1/record_sources" => json => { name => 'test1' } )->status_is(403) >+ $t->post_ok( "//$userid:$password@/api/v1/record_sources" => json => { name => 'test1' } ) >+ ->status_is(403) > ->json_is( '/error' => 'Authorization failure. Missing required permission(s).' ); > > $patron->set_password( { password => $password, skip_validation => 1 } ); >@@ -228,7 +238,9 @@ subtest 'add() tests' => sub { > > my $source_id = > $t->post_ok( "//$userid:$password@/api/v1/record_sources" => json => { name => 'test1' } ) >- ->status_is( 201, 'REST3.2.2' )->json_is( '/name', 'test1' )->json_is( '/can_be_edited', 0 ) >+ ->status_is( 201, 'REST3.2.2' ) >+ ->json_is( '/name', 'test1' ) >+ ->json_is( '/can_be_edited', 0 ) > ->tx->res->json->{record_source_id}; > > my $created_source = Koha::RecordSources->find($source_id); >@@ -275,7 +287,8 @@ subtest 'update() tests' => sub { > my $source_with_missing_field = {}; > > $t->put_ok( "//$userid:$password@/api/v1/record_sources/$source_id" => json => $source_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $source_with_updated_field = { >@@ -283,7 +296,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/record_sources/$source_id" => json => $source_with_updated_field ) >- ->status_is(200)->json_is( '/name' => $source_with_updated_field->{name} ); >+ ->status_is(200) >+ ->json_is( '/name' => $source_with_updated_field->{name} ); > > # Authorized attempt to write invalid data > my $source_with_invalid_field = { >@@ -292,7 +306,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/record_sources/$source_id" => json => $source_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: potato.", >diff --git a/t/db_dependent/api/v1/return_claims.t b/t/db_dependent/api/v1/return_claims.t >index 4f56df3348d..8d73440e674 100755 >--- a/t/db_dependent/api/v1/return_claims.t >+++ b/t/db_dependent/api/v1/return_claims.t >@@ -291,13 +291,15 @@ subtest 'delete() tests' => sub { > ); > > # Test deleting a return claim >- $t->delete_ok( "//$userid:$password@/api/v1/return_claims/" . $claim->id )->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok( "//$userid:$password@/api/v1/return_claims/" . $claim->id ) >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > my $THE_claim = Koha::Checkouts::ReturnClaims->find( $claim->id ); > isnt( $THE_claim, "Return claim was deleted" ); > >- $t->delete_ok( "//$userid:$password@/api/v1/return_claims/" . $claim->id )->status_is(404) >+ $t->delete_ok( "//$userid:$password@/api/v1/return_claims/" . $claim->id ) >+ ->status_is(404) > ->json_is( '/error' => 'Claim not found' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/search_filters.t b/t/db_dependent/api/v1/search_filters.t >index a9146e486d9..fc0ea1e35c2 100755 >--- a/t/db_dependent/api/v1/search_filters.t >+++ b/t/db_dependent/api/v1/search_filters.t >@@ -103,8 +103,11 @@ subtest 'list() tests' => sub { > ); > > # Make sure we are returned with the correct amount of macros >- $t->get_ok("//$userid:$password@/api/v1/search_filters")->status_is( 200, 'REST3.2.2' ) >- ->json_has('/0/search_filter_id')->json_has('/1/search_filter_id')->json_has('/2/search_filter_id') >+ $t->get_ok("//$userid:$password@/api/v1/search_filters") >+ ->status_is( 200, 'REST3.2.2' ) >+ ->json_has('/0/search_filter_id') >+ ->json_has('/1/search_filter_id') >+ ->json_has('/2/search_filter_id') > ->json_has('/3/search_filter_id'); > > $schema->storage->txn_rollback; >@@ -131,12 +134,14 @@ subtest 'get() tests' => sub { > my $search_filter_3 = $builder->build_object( { class => 'Koha::SearchFilters' } ); > > $t->get_ok( "//$userid:$password@/api/v1/search_filters/" . $search_filter_1->id ) >- ->status_is( 200, 'Filter retrieved correctly' )->json_is( $search_filter_1->to_api ); >+ ->status_is( 200, 'Filter retrieved correctly' ) >+ ->json_is( $search_filter_1->to_api ); > > my $non_existent_code = $search_filter_1->id; > $search_filter_1->delete; > >- $t->get_ok( "//$userid:$password@/api/v1/search_filters/" . $non_existent_code )->status_is(404) >+ $t->get_ok( "//$userid:$password@/api/v1/search_filters/" . $non_existent_code ) >+ ->status_is(404) > ->json_is( '/error' => 'Search filter not found' ); > > $patron->flags(4)->store; >@@ -196,7 +201,8 @@ subtest 'add() tests' => sub { > $search_filter_with_invalid_field->{'coffee_filter'} = 'Chemex'; > > $t->post_ok( "//$auth_userid:$password@/api/v1/search_filters" => json => $search_filter_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: coffee_filter.", >@@ -207,7 +213,8 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > $t->post_ok( "//$auth_userid:$password@/api/v1/search_filters" => json => $search_filter_values ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '/search_filter_id', 'We generated a new id' ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '/search_filter_id', 'We generated a new id' ) > ->json_is( '/name' => $search_filter_values->{name}, 'The name matches what we supplied' ) > ->json_is( '/query' => $search_filter_values->{query}, 'The query matches what we supplied' ) > ->json_is( '/limits' => $search_filter_values->{limits}, 'The limits match what we supplied' ) >@@ -221,7 +228,8 @@ subtest 'add() tests' => sub { > # Authorized attempt to create with existing id > $search_filter_values->{search_filter_id} = $search_filter_id; > >- $t->post_ok( "//$auth_userid:$password@/api/v1/search_filters" => json => $search_filter_values )->status_is(400) >+ $t->post_ok( "//$auth_userid:$password@/api/v1/search_filters" => json => $search_filter_values ) >+ ->status_is(400) > ->json_is( > '/errors' => [ > { >diff --git a/t/db_dependent/api/v1/sip2_accounts.t b/t/db_dependent/api/v1/sip2_accounts.t >index c25e55480d9..42fd24c69a8 100755 >--- a/t/db_dependent/api/v1/sip2_accounts.t >+++ b/t/db_dependent/api/v1/sip2_accounts.t >@@ -87,12 +87,14 @@ subtest 'list() tests' => sub { > > # Filtering works, single account with queried sip_account_id > $t->get_ok( "//$userid:$password@/api/v1/sip2/accounts?sip_account_id=" . $another_account->sip_account_id ) >- ->status_is(200)->json_is( [ $another_account->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $another_account->to_api ] ); > > # Attempt to search by login_id like 'ko' > $account->delete; > $another_account->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/sip2/accounts?q=[{"me.login_id":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/sip2/accounts?q=[{"me.login_id":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $account_to_search = $builder->build_object( >@@ -105,11 +107,13 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for login_id like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/sip2/accounts?q=[{"me.login_id":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/sip2/accounts?q=[{"me.login_id":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $account_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/sip2/accounts?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/accounts?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -146,7 +150,8 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This account exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/sip2/accounts/" . $account->sip_account_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/sip2/accounts/" . $account->sip_account_id ) >+ ->status_is(200) > ->json_is( $account->to_api ); > > # Unauthorized access >@@ -157,7 +162,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $account_to_delete->sip_account_id; > $account_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/sip2/accounts/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/accounts/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Account not found' ); > > $schema->storage->txn_rollback; >@@ -205,7 +211,8 @@ subtest 'add() tests' => sub { > sip_institution_id => $account->{sip_institution_id}, > }; > >- $t->post_ok( "//$userid:$password@/api/v1/sip2/accounts" => json => $account_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/sip2/accounts" => json => $account_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -217,12 +224,15 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $sip_account_id = >- $t->post_ok( "//$userid:$password@/api/v1/sip2/accounts" => json => $account )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$userid:$password@/api/v1/sip2/accounts" => json => $account ) >+ ->status_is( 201, 'REST3.2.1' ) > ->header_like( > Location => qr|^/api/v1/sip2/accounts/\d*|, > 'REST3.4.1' >- )->json_is( '/login_id' => $account->{login_id} ) >- ->json_is( '/sip_institution_id' => $account->{sip_institution_id} )->tx->res->json->{sip_account_id}; >+ ) >+ ->json_is( '/login_id' => $account->{login_id} ) >+ ->json_is( '/sip_institution_id' => $account->{sip_institution_id} ) >+ ->tx->res->json->{sip_account_id}; > > # Authorized attempt to create with null id > $account->{sip_account_id} = undef; >@@ -283,7 +293,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/sip2/accounts/$sip_account_id" => json => $account_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/login_id" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/login_id" } ] ); > > # Full object update on PUT > my $account_with_updated_field = { >@@ -292,7 +303,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/sip2/accounts/$sip_account_id" => json => $account_with_updated_field ) >- ->status_is(200)->json_is( '/login_id' => 'new koha' ); >+ ->status_is(200) >+ ->json_is( '/login_id' => 'new koha' ); > > # Authorized attempt to write invalid data > my $account_with_invalid_field = { >@@ -302,7 +314,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/sip2/accounts/$sip_account_id" => json => $account_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -360,7 +373,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/sip2/accounts/$sip_account_id")->status_is(403); > > # Delete existing account >- $t->delete_ok("//$userid:$password@/api/v1/sip2/accounts/$sip_account_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/sip2/accounts/$sip_account_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent account >diff --git a/t/db_dependent/api/v1/sip2_institutions.t b/t/db_dependent/api/v1/sip2_institutions.t >index 63e2c51ad87..e9ed9fc14ea 100755 >--- a/t/db_dependent/api/v1/sip2_institutions.t >+++ b/t/db_dependent/api/v1/sip2_institutions.t >@@ -86,13 +86,15 @@ subtest 'list() tests' => sub { > ); > > # Filtering works, single institution with queried implementation >- $t->get_ok("//$userid:$password@/api/v1/sip2/institutions?implementation=ILS")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/institutions?implementation=ILS") >+ ->status_is(200) > ->json_is( [ $another_institution->to_api ] ); > > # Attempt to search by name like 'ko' > $institution->delete; > $another_institution->delete; >- $t->get_ok(qq~//$userid:$password@/api/v1/sip2/institutions?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/sip2/institutions?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [] ); > > my $institution_to_search = $builder->build_object( >@@ -105,11 +107,13 @@ subtest 'list() tests' => sub { > ); > > # Search works, searching for name like 'ko' >- $t->get_ok(qq~//$userid:$password@/api/v1/sip2/institutions?q=[{"me.name":{"like":"%ko%"}}]~)->status_is(200) >+ $t->get_ok(qq~//$userid:$password@/api/v1/sip2/institutions?q=[{"me.name":{"like":"%ko%"}}]~) >+ ->status_is(200) > ->json_is( [ $institution_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/sip2/institutions?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/institutions?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -146,7 +150,8 @@ subtest 'get() tests' => sub { > my $unauth_userid = $patron->userid; > > # This institution exists, should get returned >- $t->get_ok( "//$userid:$password@/api/v1/sip2/institutions/" . $institution->sip_institution_id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/sip2/institutions/" . $institution->sip_institution_id ) >+ ->status_is(200) > ->json_is( $institution->to_api ); > > # Unauthorized access >@@ -158,7 +163,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $institution_to_delete->sip_institution_id; > $institution_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/sip2/institutions/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/institutions/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Institution not found' ); > > $schema->storage->txn_rollback; >@@ -210,7 +216,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/sip2/institutions" => json => $institution_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -222,16 +229,21 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $sip_institution_id = > $t->post_ok( "//$userid:$password@/api/v1/sip2/institutions" => json => $institution ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/sip2/institutions/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $institution->{name} )->json_is( '/implementation' => $institution->{implementation} ) >- ->json_is( '/retries' => $institution->{retries} )->json_is( '/timeout' => $institution->{timeout} ) >+ ) >+ ->json_is( '/name' => $institution->{name} ) >+ ->json_is( '/implementation' => $institution->{implementation} ) >+ ->json_is( '/retries' => $institution->{retries} ) >+ ->json_is( '/timeout' => $institution->{timeout} ) > ->tx->res->json->{sip_institution_id}; > > # Authorized attempt to create with null id > $institution->{sip_institution_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/sip2/institutions" => json => $institution )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/sip2/institutions" => json => $institution ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id >@@ -290,7 +302,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/sip2/institutions/$sip_institution_id" => json => $institution_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $institution_with_updated_field = { >@@ -302,7 +315,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/sip2/institutions/$sip_institution_id" => json => $institution_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'New institution name' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'New institution name' ); > > # Authorized attempt to write invalid data > my $institution_with_invalid_field = { >@@ -315,7 +329,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/sip2/institutions/$sip_institution_id" => json => $institution_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -375,7 +390,8 @@ subtest 'delete() tests' => sub { > $t->delete_ok("//$unauth_userid:$password@/api/v1/sip2/institutions/$sip_institution_id")->status_is(403); > > # Delete existing institution >- $t->delete_ok("//$userid:$password@/api/v1/sip2/institutions/$sip_institution_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/sip2/institutions/$sip_institution_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent institution >diff --git a/t/db_dependent/api/v1/sip2_system_preference_overrides.t b/t/db_dependent/api/v1/sip2_system_preference_overrides.t >index eaec6cf8451..a6ae0d56e71 100755 >--- a/t/db_dependent/api/v1/sip2_system_preference_overrides.t >+++ b/t/db_dependent/api/v1/sip2_system_preference_overrides.t >@@ -68,7 +68,8 @@ subtest 'list() tests' => sub { > my $sys_pref_override = $builder->build_object( { class => 'Koha::SIP2::SystemPreferenceOverrides' } ); > > # One system preference override created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides") >+ ->status_is(200) > ->json_is( [ $sys_pref_override->to_api ] ); > > my $another_system_preference_override = $builder->build_object( >@@ -90,7 +91,8 @@ subtest 'list() tests' => sub { > $sys_pref_override->delete; > $another_system_preference_override->delete; > $t->get_ok(qq~//$userid:$password@/api/v1/sip2/system_preference_overrides?q=[{"me.variable":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [] ); >+ ->status_is(200) >+ ->json_is( [] ); > > my $system_preference_override_to_search = $builder->build_object( > { >@@ -103,10 +105,12 @@ subtest 'list() tests' => sub { > > # Search works, searching for name like 'ko' > $t->get_ok(qq~//$userid:$password@/api/v1/sip2/system_preference_overrides?q=[{"me.variable":{"like":"%ko%"}}]~) >- ->status_is(200)->json_is( [ $system_preference_override_to_search->to_api ] ); >+ ->status_is(200) >+ ->json_is( [ $system_preference_override_to_search->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides?blah=blah")->status_is(400) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides?blah=blah") >+ ->status_is(400) > ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -144,7 +148,8 @@ subtest 'get() tests' => sub { > > # This system preference override exists, should get returned > $t->get_ok( "//$userid:$password@/api/v1/sip2/system_preference_overrides/" >- . $sys_pref_override->sip_system_preference_override_id )->status_is(200) >+ . $sys_pref_override->sip_system_preference_override_id ) >+ ->status_is(200) > ->json_is( $sys_pref_override->to_api ); > > # Unauthorized access >@@ -157,7 +162,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $system_preference_override_to_delete->sip_system_preference_override_id; > $system_preference_override_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'System preference override not found' ); > > $schema->storage->txn_rollback; >@@ -218,24 +224,29 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $sip_system_preference_override_id = > $t->post_ok( "//$userid:$password@/api/v1/sip2/system_preference_overrides" => json => $sys_pref_override ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^/api/v1/sip2/system_preference_overrides/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $sys_pref_override->{name} ) >+ ) >+ ->json_is( '/name' => $sys_pref_override->{name} ) > ->json_is( '/implementation' => $sys_pref_override->{implementation} ) > ->json_is( '/retries' => $sys_pref_override->{retries} ) >- ->json_is( '/timeout' => $sys_pref_override->{timeout} )->tx->res->json->{sip_system_preference_override_id}; >+ ->json_is( '/timeout' => $sys_pref_override->{timeout} ) >+ ->tx->res->json->{sip_system_preference_override_id}; > > # Authorized attempt to create with null id > $sys_pref_override->{sip_system_preference_override_id} = undef; > $t->post_ok( "//$userid:$password@/api/v1/sip2/system_preference_overrides" => json => $sys_pref_override ) >- ->status_is(400)->json_has('/errors'); >+ ->status_is(400) >+ ->json_has('/errors'); > > # Authorized attempt to create with existing id > $sys_pref_override->{sip_system_preference_override_id} = $sip_system_preference_override_id; > > $t->post_ok( "//$userid:$password@/api/v1/sip2/system_preference_overrides" => json => $sys_pref_override ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Read-only.", >@@ -289,7 +300,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/sip2/system_preference_overrides/$sip_system_preference_override_id" => json => >- $system_preference_override_with_missing_field )->status_is(400) >+ $system_preference_override_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/value" } ] ); > > # Full object update on PUT >@@ -376,7 +388,8 @@ subtest 'delete() tests' => sub { > > # Delete existing system preference override > $t->delete_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides/$sip_system_preference_override_id") >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > # Attempt to delete non-existent system preference override > $t->delete_ok("//$userid:$password@/api/v1/sip2/system_preference_overrides/$sip_system_preference_override_id") >diff --git a/t/db_dependent/api/v1/smtp_servers.t b/t/db_dependent/api/v1/smtp_servers.t >index 1a92fff75c9..e85153e7ffc 100755 >--- a/t/db_dependent/api/v1/smtp_servers.t >+++ b/t/db_dependent/api/v1/smtp_servers.t >@@ -73,7 +73,8 @@ subtest 'list() tests' => sub { > my $another_smtp_server = $builder->build_object( { class => 'Koha::SMTP::Servers' } ); > > # Two SMTP servers created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/config/smtp_servers")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/config/smtp_servers") >+ ->status_is(200) > ->json_is( [ $smtp_server->to_api, $another_smtp_server->to_api, ] ); > > # Unauthorized access >@@ -109,7 +110,8 @@ subtest 'get() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/config/smtp_servers/" . $smtp_server->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/config/smtp_servers/" . $smtp_server->id ) >+ ->status_is(200) > ->json_is( $smtp_server->to_api ); > > $t->get_ok( "//$unauth_userid:$password@/api/v1/config/smtp_servers/" . $smtp_server->id )->status_is(403); >@@ -118,7 +120,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $smtp_server_to_delete->id; > $smtp_server_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/config/smtp_servers/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/config/smtp_servers/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'SMTP server not found' ); > > $schema->storage->txn_rollback; >@@ -168,7 +171,8 @@ subtest 'add() tests' => sub { > }; > > $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -180,21 +184,27 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $smtp_server_id = > $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_data ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/config\/smtp_servers\/\d*|, > 'REST3.4.1' >- )->json_is( '/name' => $smtp_server_data->{name} )->json_is( '/state' => $smtp_server_data->{state} ) >+ ) >+ ->json_is( '/name' => $smtp_server_data->{name} ) >+ ->json_is( '/state' => $smtp_server_data->{state} ) > ->json_is( '/postal_code' => $smtp_server_data->{postal_code} ) >- ->json_is( '/country' => $smtp_server_data->{country} )->tx->res->json->{smtp_server_id}; >+ ->json_is( '/country' => $smtp_server_data->{country} ) >+ ->tx->res->json->{smtp_server_id}; > > # Authorized attempt to create with null id > $smtp_server_data->{smtp_server_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_data ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $smtp_server_data->{smtp_server_id} = $smtp_server_id; >- $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/config/smtp_servers" => json => $smtp_server_data ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -247,14 +257,16 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id" => json => $smtp_server_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/name" } ] ); > > # Full object update on PUT > my $smtp_server_with_updated_field = { name => "Some name", }; > > $t->put_ok( > "//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id" => json => $smtp_server_with_updated_field ) >- ->status_is(200)->json_is( '/name' => 'Some name' ); >+ ->status_is(200) >+ ->json_is( '/name' => 'Some name' ); > > # Authorized attempt to write invalid data > my $smtp_server_with_invalid_field = { >@@ -264,7 +276,8 @@ subtest 'update() tests' => sub { > > $t->put_ok( > "//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id" => json => $smtp_server_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -322,7 +335,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/config/smtp_servers/$smtp_server_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/config/smtp_servers/$smtp_server_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/stockrotation_rotas.t b/t/db_dependent/api/v1/stockrotation_rotas.t >index 342978a4432..0ada4cc68c1 100755 >--- a/t/db_dependent/api/v1/stockrotation_rotas.t >+++ b/t/db_dependent/api/v1/stockrotation_rotas.t >@@ -86,14 +86,16 @@ subtest 'list() tests' => sub { > > # Filtering works, two rotas are active > my $api_filter = encode_json( { 'me.active' => Mojo::JSON->true } ); >- $t->get_ok("//$userid:$password@/api/v1/rotas?q=$api_filter")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/rotas?q=$api_filter") >+ ->status_is(200) > ->json_is( [ $active_rota->to_api, $another_active_rota->to_api ] ); > > $api_filter = encode_json( { 'me.title' => $active_rota->title } ); > $t->get_ok("//$userid:$password@/api/v1/rotas?q=$api_filter")->status_is(200)->json_is( [ $active_rota->to_api ] ); > > # Warn on unsupported query parameter >- $t->get_ok( "//$userid:$password@/api/v1/rotas?title=" . $active_rota->title )->status_is(400) >+ $t->get_ok( "//$userid:$password@/api/v1/rotas?title=" . $active_rota->title ) >+ ->status_is(400) > ->json_is( [ { path => '/query/title', message => 'Malformed query string' } ] ); > > # Unauthorized access >@@ -137,7 +139,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $rota_to_delete->id; > $rota_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/rotas/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/rotas/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Rota not found' ); > > $schema->storage->txn_rollback; >@@ -198,12 +201,16 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $rota_id = >- $t->post_ok( "//$userid:$password@/api/v1/rotas" => json => $rota )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$userid:$password@/api/v1/rotas" => json => $rota ) >+ ->status_is( 201, 'REST3.2.1' ) > ->header_like( > Location => qr|^\/api\/v1\/rotas/\d*|, > 'REST3.4.1' >- )->json_is( '/title' => $rota->{title} )->json_is( '/description' => $rota->{description} ) >- ->json_is( '/active' => $rota->{active} )->json_is( '/cyclical' => $rota->{cyclical} ) >+ ) >+ ->json_is( '/title' => $rota->{title} ) >+ ->json_is( '/description' => $rota->{description} ) >+ ->json_is( '/active' => $rota->{active} ) >+ ->json_is( '/cyclical' => $rota->{cyclical} ) > ->tx->res->json->{rota_id}; > > # Authorized attempt to create with null id >@@ -264,7 +271,8 @@ subtest 'update() tests' => sub { > cyclical => Mojo::JSON->false > }; > >- $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_missing_field )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_missing_field ) >+ ->status_is(400) > ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/active" } ] ); > > # Full object update on PUT >@@ -275,7 +283,8 @@ subtest 'update() tests' => sub { > cyclical => Mojo::JSON->false > }; > >- $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_updated_field )->status_is(200) >+ $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_updated_field ) >+ ->status_is(200) > ->json_is( '/title' => 'London' ); > > # Authorized attempt to write invalid data >@@ -286,7 +295,8 @@ subtest 'update() tests' => sub { > cyclical => Mojo::JSON->false > }; > >- $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_invalid_field )->status_is(400) >+ $t->put_ok( "//$userid:$password@/api/v1/rotas/$rota_id" => json => $rota_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -342,7 +352,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/rotas/$rota_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/rotas/$rota_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/rotas/$rota_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/rotas/$rota_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/stockrotationstage.t b/t/db_dependent/api/v1/stockrotationstage.t >index b0b761920f0..f6ea0c87e15 100755 >--- a/t/db_dependent/api/v1/stockrotationstage.t >+++ b/t/db_dependent/api/v1/stockrotationstage.t >@@ -88,20 +88,24 @@ subtest 'move() tests' => sub { > > # Invalid attempt to move a stage on a non-existent rota > $t->put_ok( "//$auth_userid:$password@/api/v1/rotas/99999999/stages/$stage1_id/position" => json => 2 ) >- ->status_is(404)->json_is( '/error' => "Rota not found" ); >+ ->status_is(404) >+ ->json_is( '/error' => "Rota not found" ); > > # Invalid attempt to move an non-existent stage > $t->put_ok( "//$auth_userid:$password@/api/v1/rotas/$rota_id/stages/999999999/position" => json => 2 ) >- ->status_is(404)->json_is( '/error' => "Stage not found" ); >+ ->status_is(404) >+ ->json_is( '/error' => "Stage not found" ); > > # Invalid attempt to move stage to current position > my $curr_position = $stage1->{position}; > $t->put_ok( "//$auth_userid:$password@/api/v1/rotas/$rota_id/stages/$stage1_id/position" => json => $curr_position ) >- ->status_is(400)->json_is( '/error' => "Bad request - new position invalid" ); >+ ->status_is(400) >+ ->json_is( '/error' => "Bad request - new position invalid" ); > > # Invalid attempt to move stage to invalid position > $t->put_ok( "//$auth_userid:$password@/api/v1/rotas/$rota_id/stages/$stage1_id/position" => json => 99999999 ) >- ->status_is(400)->json_is( '/error' => "Bad request - new position invalid" ); >+ ->status_is(400) >+ ->json_is( '/error' => "Bad request - new position invalid" ); > > # Valid, authorised move > $t->put_ok( "//$auth_userid:$password@/api/v1/rotas/$rota_id/stages/$stage1_id/position" => json => 2 ) >diff --git a/t/db_dependent/api/v1/suggestions.t b/t/db_dependent/api/v1/suggestions.t >index f80b24425e3..40721b6c0d0 100755 >--- a/t/db_dependent/api/v1/suggestions.t >+++ b/t/db_dependent/api/v1/suggestions.t >@@ -63,7 +63,8 @@ subtest 'list() tests' => sub { > > ## Authorized user tests > # No suggestions by patron, so empty array should be returned >- $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}") >+ ->status_is(200) > ->json_is( [] ); > > my $suggestion_1 = $builder->build_object( >@@ -74,7 +75,8 @@ subtest 'list() tests' => sub { > ); > > # One suggestion created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}") >+ ->status_is(200) > ->json_is( [ $suggestion_1->to_api ] ); > > my $suggestion_2 = $builder->build_object( >@@ -85,7 +87,8 @@ subtest 'list() tests' => sub { > ); > > # Two SMTP servers created, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/suggestions?q={\"suggested_by\":\"$patron_id\"}") >+ ->status_is(200) > ->json_is( [ $suggestion_1->to_api, $suggestion_2->to_api, ] ); > > # Unauthorized access >@@ -128,7 +131,8 @@ subtest 'get() tests' => sub { > } > ); > >- $t->get_ok( "//$userid:$password@/api/v1/suggestions/" . $suggestion->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/suggestions/" . $suggestion->id ) >+ ->status_is(200) > ->json_is( $suggestion->to_api ); > > my $authorised_value = Koha::AuthorisedValue->new( >@@ -139,7 +143,8 @@ subtest 'get() tests' => sub { > )->store; > $suggestion->STATUS('FREDERIC')->store->discard_changes; > >- $t->get_ok( "//$userid:$password@/api/v1/suggestions/" . $suggestion->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/suggestions/" . $suggestion->id ) >+ ->status_is(200) > ->json_is( $suggestion->to_api ); > > $t->get_ok( "//$unauth_userid:$password@/api/v1/suggestions/" . $suggestion->id )->status_is(403); >@@ -148,7 +153,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $suggestion_to_delete->id; > $suggestion_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/suggestions/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/suggestions/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Suggestion not found' ); > > $schema->storage->txn_rollback; >@@ -198,7 +204,8 @@ subtest 'add() tests' => sub { > # Authorized attempt to write invalid data > my $suggestion_with_invalid_field = { blah => 'blah' }; > >- $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -211,10 +218,11 @@ subtest 'add() tests' => sub { > # Authorized attempt to write > my $generated_suggestion = > $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/suggestions\/\d*|, > 'REST3.4.1' >- )->tx->res->json; >+ )->tx->res->json; > > my $suggestion_id = $generated_suggestion->{suggestion_id}; > is_deeply( >@@ -225,7 +233,8 @@ subtest 'add() tests' => sub { > > # Authorized attempt to create with null id > $suggestion_data->{suggestion_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id >@@ -266,13 +275,15 @@ subtest 'add() tests' => sub { > $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) > ->status_is( 201, 'Second pending suggestion' ); > >- $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) >+ ->status_is(400) > ->json_is( '/error_code' => 'max_pending_reached' ); > > $t->post_ok( "//$userid:$password@/api/v1/suggestions" => { 'x-koha-override' => 'max_pending' } => json => > $suggestion_data )->status_is( 201, 'max_pending override does the job' ); > >- $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) >+ ->status_is(400) > ->json_is( '/error_code' => 'max_total_reached' ); > > $t->post_ok( >@@ -324,7 +335,8 @@ subtest 'update() tests' => sub { > my $suggestion_with_updated_field = { reason => "Some reason", }; > > $t->put_ok( "//$userid:$password@/api/v1/suggestions/$suggestion_id" => json => $suggestion_with_updated_field ) >- ->status_is(200)->json_is( '/reason' => 'Some reason' ); >+ ->status_is(200) >+ ->json_is( '/reason' => 'Some reason' ); > > # Authorized attempt to write invalid data > my $suggestion_with_invalid_field = { >@@ -333,7 +345,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/suggestions/$suggestion_id" => json => $suggestion_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -389,7 +402,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/suggestions/$suggestion_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/suggestions/$suggestion_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/suggestions/$suggestion_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( q{}, 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/suggestions/$suggestion_id")->status_is(404); >@@ -448,10 +462,11 @@ subtest 'Permissions tests' => sub { > # Authorized attempt to write > my $generated_suggestion = > $t->post_ok( "//$userid:$password@/api/v1/suggestions" => json => $suggestion_data ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/suggestions\/\d*|, > 'REST3.4.1' >- )->tx->res->json; >+ )->tx->res->json; > > my $suggestion_id = $generated_suggestion->{suggestion_id}; > is_deeply( >@@ -473,7 +488,8 @@ subtest 'Permissions tests' => sub { > } > ); > >- $t->delete_ok("//$userid:$password@/api/v1/suggestions/$suggestion_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/suggestions/$suggestion_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( q{}, 'REST3.3.4' ); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/api/v1/ticket_updates.t b/t/db_dependent/api/v1/ticket_updates.t >index f1cbd075df5..f93fc6df1f3 100755 >--- a/t/db_dependent/api/v1/ticket_updates.t >+++ b/t/db_dependent/api/v1/ticket_updates.t >@@ -77,7 +77,8 @@ subtest 'list_updates() tests' => sub { > ); > > # One ticket update added, should get returned >- $t->get_ok("//$userid:$password@/api/v1/tickets/$ticket_id/updates")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/tickets/$ticket_id/updates") >+ ->status_is(200) > ->json_is( [ $update->to_api ] ); > > my $update_2 = $builder->build_object( >@@ -94,7 +95,8 @@ subtest 'list_updates() tests' => sub { > ); > > # Two ticket updates added, they should both be returned >- $t->get_ok("//$userid:$password@/api/v1/tickets/$ticket_id/updates")->status_is(200) >+ $t->get_ok("//$userid:$password@/api/v1/tickets/$ticket_id/updates") >+ ->status_is(200) > ->json_is( [ $update->to_api, $update_2->to_api, $update_3->to_api, ] ); > > # Warn on unsupported query parameter >@@ -163,11 +165,16 @@ subtest 'add_update() tests' => sub { > # Authorized attempt to write > my $update_id = > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/message' => $update->{message} )->json_is( '/public' => $update->{public} ) >- ->json_is( '/status' => undef )->json_is( '/assignee_id' => undef )->json_is( '/user_id' => $librarian->id ) >+ ) >+ ->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) >+ ->json_is( '/user_id' => $librarian->id ) > ->tx->res->json->{update_id}; > > # Check that notice trigger didn't fire for non-public update >@@ -179,12 +186,14 @@ subtest 'add_update() tests' => sub { > > # Authorized attempt to create with null id > $update->{update_id} = undef; >- $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >+ ->status_is(400) > ->json_has('/errors'); > > # Authorized attempt to create with existing id > $update->{update_id} = $update_id; >- $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -199,7 +208,8 @@ subtest 'add_update() tests' => sub { > my $update_with_missing_field = { message => "Another ticket update" }; > > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update_with_missing_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Missing property.", >@@ -212,11 +222,16 @@ subtest 'add_update() tests' => sub { > $update->{public} = Mojo::JSON->true; > $update_id = > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/message' => $update->{message} )->json_is( '/public' => $update->{public} ) >- ->json_is( '/status' => undef )->json_is( '/assignee_id' => undef )->json_is( '/user_id' => $librarian->id ) >+ ) >+ ->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) >+ ->json_is( '/user_id' => $librarian->id ) > ->tx->res->json->{update_id}; > > $notices = Koha::Notice::Messages->search( { borrowernumber => $patron->id } ); >@@ -235,11 +250,16 @@ subtest 'add_update() tests' => sub { > $update->{state} = 'resolved'; > $update_id = > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/message' => $update->{message} )->json_is( '/public' => $update->{public} ) >- ->json_is( '/status' => undef )->json_is( '/assignee_id' => undef )->json_is( '/user_id' => $librarian->id ) >+ ) >+ ->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) >+ ->json_is( '/user_id' => $librarian->id ) > ->tx->res->json->{update_id}; > > $notices = Koha::Notice::Messages->search( { borrowernumber => $patron->id } ); >@@ -268,12 +288,17 @@ subtest 'add_update() tests' => sub { > $update->{status} = 'TEST'; > $update_id = > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/message' => $update->{message} )->json_is( '/public' => $update->{public} ) >- ->json_is( '/status' => $update->{status} )->json_is( '/assignee_id' => undef ) >- ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; >+ ) >+ ->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => $update->{status} ) >+ ->json_is( '/assignee_id' => undef ) >+ ->json_is( '/user_id' => $librarian->id ) >+ ->tx->res->json->{update_id}; > > $ticket = $ticket->get_from_storage; > is( >@@ -287,12 +312,17 @@ subtest 'add_update() tests' => sub { > $update->{assignee_id} = $librarian->id; > $update_id = > $t->post_ok( "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => $update ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/message' => $update->{message} )->json_is( '/public' => $update->{public} ) >- ->json_is( '/status' => $update->{status} )->json_is( '/assignee_id' => $update->{assignee_id} ) >- ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; >+ ) >+ ->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => $update->{status} ) >+ ->json_is( '/assignee_id' => $update->{assignee_id} ) >+ ->json_is( '/user_id' => $librarian->id ) >+ ->tx->res->json->{update_id}; > > $ticket = $ticket->get_from_storage; > is( >diff --git a/t/db_dependent/api/v1/tickets.t b/t/db_dependent/api/v1/tickets.t >index f56e731d0c9..9de5f9126f0 100755 >--- a/t/db_dependent/api/v1/tickets.t >+++ b/t/db_dependent/api/v1/tickets.t >@@ -132,7 +132,8 @@ subtest 'get() tests' => sub { > my $non_existent_id = $ticket_to_delete->id; > $ticket_to_delete->delete; > >- $t->get_ok("//$userid:$password@/api/v1/tickets/$non_existent_id")->status_is(404) >+ $t->get_ok("//$userid:$password@/api/v1/tickets/$non_existent_id") >+ ->status_is(404) > ->json_is( '/error' => 'Ticket not found' ); > > $schema->storage->txn_rollback; >@@ -184,7 +185,8 @@ subtest 'add() tests' => sub { > body => "Test ticket details", > }; > >- $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket_with_invalid_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket_with_invalid_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -196,12 +198,16 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > my $ticket_id = >- $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket )->status_is( 201, 'REST3.2.1' ) >+ $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket ) >+ ->status_is( 201, 'REST3.2.1' ) > ->header_like( > Location => qr|^\/api\/v1\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/biblio_id' => $ticket->{biblio_id} )->json_is( '/title' => $ticket->{title} ) >- ->json_is( '/body' => $ticket->{body} )->json_is( '/reporter_id' => $librarian->id ) >+ ) >+ ->json_is( '/biblio_id' => $ticket->{biblio_id} ) >+ ->json_is( '/title' => $ticket->{title} ) >+ ->json_is( '/body' => $ticket->{body} ) >+ ->json_is( '/reporter_id' => $librarian->id ) > ->tx->res->json->{ticket_id}; > > # Authorized attempt to create with null id >@@ -226,7 +232,8 @@ subtest 'add() tests' => sub { > body => "Test ticket details", > }; > >- $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket_with_missing_field )->status_is(400) >+ $t->post_ok( "//$userid:$password@/api/v1/tickets" => json => $ticket_with_missing_field ) >+ ->status_is(400) > ->json_is( > "/errors" => [ > { >@@ -246,11 +253,15 @@ subtest 'add() tests' => sub { > > $ticket_id = > $t->post_ok( "//$useridp:$password@/api/v1/public/tickets" => json => $ticket ) >- ->status_is( 201, 'REST3.2.1' )->header_like( >+ ->status_is( 201, 'REST3.2.1' ) >+ ->header_like( > Location => qr|^\/api\/v1\/public\/tickets/\d*|, > 'REST3.4.1' >- )->json_is( '/biblio_id' => $ticket->{biblio_id} )->json_is( '/title' => $ticket->{title} ) >- ->json_is( '/body' => $ticket->{body} )->json_is( '/reporter_id' => $patron->id ) >+ ) >+ ->json_is( '/biblio_id' => $ticket->{biblio_id} ) >+ ->json_is( '/title' => $ticket->{title} ) >+ ->json_is( '/body' => $ticket->{body} ) >+ ->json_is( '/reporter_id' => $patron->id ) > ->tx->res->json->{ticket_id}; > > }; >@@ -299,7 +310,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/tickets/$ticket_id" => json => $ticket_with_missing_field ) >- ->status_is(400)->json_is( "/errors" => [ { message => "Missing property.", path => "/body/title" } ] ); >+ ->status_is(400) >+ ->json_is( "/errors" => [ { message => "Missing property.", path => "/body/title" } ] ); > > # Full object update on PUT > my $ticket_with_updated_field = { >@@ -309,12 +321,15 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/tickets/$ticket_id" => json => $ticket_with_updated_field ) >- ->status_is(200)->json_is( '/title' => 'Test ticket update' ); >+ ->status_is(200) >+ ->json_is( '/title' => 'Test ticket update' ); > > # Set the assignee on PUT > $ticket_with_updated_field->{assignee_id} = $librarian->id; > $t->put_ok( "//$userid:$password@/api/v1/tickets/$ticket_id" => json => $ticket_with_updated_field ) >- ->status_is(200)->json_is( '/title' => 'Test ticket update' )->json_is( '/assignee_id' => $librarian->id ); >+ ->status_is(200) >+ ->json_is( '/title' => 'Test ticket update' ) >+ ->json_is( '/assignee_id' => $librarian->id ); > > my $updates = $ticket->updates; > is( $updates->count, 1, "Ticket update added for assignee change" ); >@@ -328,7 +343,8 @@ subtest 'update() tests' => sub { > }; > > $t->put_ok( "//$userid:$password@/api/v1/tickets/$ticket_id" => json => $ticket_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: blah.", >@@ -384,7 +400,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/tickets/$ticket_id")->status_is(403); > >- $t->delete_ok("//$userid:$password@/api/v1/tickets/$ticket_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$userid:$password@/api/v1/tickets/$ticket_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$userid:$password@/api/v1/tickets/$ticket_id")->status_is(404); >diff --git a/t/db_dependent/api/v1/transfer_limits.t b/t/db_dependent/api/v1/transfer_limits.t >index e1c65102f6d..d5e15e50fb8 100755 >--- a/t/db_dependent/api/v1/transfer_limits.t >+++ b/t/db_dependent/api/v1/transfer_limits.t >@@ -56,7 +56,8 @@ subtest 'list() tests' => sub { > > my $limit = $builder->build_object( { class => 'Koha::Item::Transfer::Limits' } ); > >- $t->get_ok("//$userid:$password@/api/v1/transfer_limits")->status_is( 200, 'REST3.2.2' ) >+ $t->get_ok("//$userid:$password@/api/v1/transfer_limits") >+ ->status_is( 200, 'REST3.2.2' ) > ->json_is( [ $limit->to_api ] ); > > $schema->storage->txn_rollback; >@@ -99,7 +100,8 @@ subtest 'add() tests' => sub { > my $limit_with_invalid_field = { 'invalid' => 'invalid' }; > > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: invalid.", >@@ -110,11 +112,13 @@ subtest 'add() tests' => sub { > > # Authorized attempt to write > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' ) >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '' => $limit_hashref, 'REST3.3.1' ) > ->header_is( 'Location' => '/api/v1/transfer_limits/' . $t->tx->res->json->{limit_id}, 'REST3.4.1' ); > > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref ) >- ->status_is( 409, 'Conflict creating the resource' )->json_is( >+ ->status_is( 409, 'Conflict creating the resource' ) >+ ->json_is( > { > error => > qq{Exception 'Koha::Exceptions::TransferLimit::Duplicate' thrown 'A transfer limit with the given parameters already exists!'\n} >@@ -154,7 +158,8 @@ subtest 'delete() tests' => sub { > # Unauthorized attempt to delete > $t->delete_ok("//$unauth_userid:$password@/api/v1/transfer_limits/$limit_id")->status_is(403); > >- $t->delete_ok("//$auth_userid:$password@/api/v1/transfer_limits/$limit_id")->status_is( 204, 'REST3.2.4' ) >+ $t->delete_ok("//$auth_userid:$password@/api/v1/transfer_limits/$limit_id") >+ ->status_is( 204, 'REST3.2.4' ) > ->content_is( '', 'REST3.3.4' ); > > $t->delete_ok("//$auth_userid:$password@/api/v1/transfer_limits/$limit_id")->status_is(404); >@@ -205,7 +210,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > my $limit_with_invalid_field = { 'invalid' => 'invalid' }; > > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_with_invalid_field ) >- ->status_is(400)->json_is( >+ ->status_is(400) >+ ->json_is( > "/errors" => [ > { > message => "Properties not allowed: invalid.", >@@ -216,24 +222,28 @@ subtest 'batch_add() and batch_delete() tests' => sub { > > # Create all combinations of to/from libraries > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => >- { item_type => 'X', collection_code => 'Y' } )->status_is(400) >+ { item_type => 'X', collection_code => 'Y' } ) >+ ->status_is(400) > ->json_is( '/error' => "You can only pass 'item_type' or 'collection_code' at a time" ); > > t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'ccode' ); > > # Create all combinations of to/from libraries > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => { item_type => 'X' } ) >- ->status_is(409)->json_is( '/error' => "You passed 'item_type' but configuration expects 'collection_code'" ); >+ ->status_is(409) >+ ->json_is( '/error' => "You passed 'item_type' but configuration expects 'collection_code'" ); > > t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' ); > > # Create all combinations of to/from libraries > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => { collection_code => 'X' } ) >- ->status_is(409)->json_is( '/error' => "You passed 'collection_code' but configuration expects 'item_type'" ); >+ ->status_is(409) >+ ->json_is( '/error' => "You passed 'collection_code' but configuration expects 'item_type'" ); > > # Create all combinations of to/from libraries > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' ); >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '' => $limit_hashref, 'REST3.3.1' ); > > my $limits = Koha::Item::Transfer::Limits->search; > >@@ -242,7 +252,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > > # Delete all combinations of to/from libraries > $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > $limits = Koha::Item::Transfer::Limits->search; > >@@ -251,7 +262,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > # Create all combinations of 'to' libraries > $limit_hashref->{to_library_id} = $library->id; > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' ); >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '' => $limit_hashref, 'REST3.3.1' ); > > $limits = Koha::Item::Transfer::Limits->search; > >@@ -259,7 +271,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > > # Delete all combinations of 'to' libraries > $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > $limits = Koha::Item::Transfer::Limits->search; > >@@ -271,7 +284,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > delete $limit_hashref->{to_library_id}; > $limit_hashref->{from_library_id} = $library->id; > $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' ); >+ ->status_is( 201, 'REST3.2.1' ) >+ ->json_has( '' => $limit_hashref, 'REST3.3.1' ); > > $limits = Koha::Item::Transfer::Limits->search; > >@@ -280,7 +294,8 @@ subtest 'batch_add() and batch_delete() tests' => sub { > > # Delete all combinations of 'from' libraries > $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref ) >- ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' ); >+ ->status_is( 204, 'REST3.2.4' ) >+ ->content_is( '', 'REST3.3.4' ); > > $limits = Koha::Item::Transfer::Limits->search; > >diff --git a/t/db_dependent/mojo/csrf.t b/t/db_dependent/mojo/csrf.t >index 9fc953c95fe..4716c3fe13e 100755 >--- a/t/db_dependent/mojo/csrf.t >+++ b/t/db_dependent/mojo/csrf.t >@@ -19,14 +19,16 @@ subtest 'CSRF - Intranet' => sub { > subtest 'Without a CSRF token' => sub { > plan tests => 3; > >- $t->post_ok('/cgi-bin/koha/mainpage.pl')->status_is(403) >+ $t->post_ok('/cgi-bin/koha/mainpage.pl') >+ ->status_is(403) > ->content_like( qr/Wrong CSRF token/, 'Body contains "Wrong CSRF token"' ); > }; > > subtest 'With a wrong CSRF token' => sub { > plan tests => 3; > >- $t->post_ok( '/cgi-bin/koha/mainpage.pl', form => { csrf_token => 'BAD', op => 'cud-login' } )->status_is(403) >+ $t->post_ok( '/cgi-bin/koha/mainpage.pl', form => { csrf_token => 'BAD', op => 'cud-login' } ) >+ ->status_is(403) > ->content_like( qr/Wrong CSRF token/, 'Body contains "Wrong CSRF token"' ); > }; > >@@ -38,7 +40,8 @@ subtest 'CSRF - Intranet' => sub { > my $csrf_token = $t->tx->res->dom('input[name="csrf_token"]')->map( attr => 'value' )->first; > > $t->post_ok( '/cgi-bin/koha/mainpage.pl', form => { csrf_token => $csrf_token, op => 'cud-login' } ) >- ->status_is(200)->content_like( qr/Please log in again/, 'Login failed but CSRF test passed' ); >+ ->status_is(200) >+ ->content_like( qr/Please log in again/, 'Login failed but CSRF test passed' ); > }; > > subtest 'GETting what should be POSTed should fail' => sub { >@@ -71,14 +74,16 @@ subtest 'CSRF - OPAC' => sub { > subtest 'Without a CSRF token' => sub { > plan tests => 3; > >- $t->post_ok('/cgi-bin/koha/opac-user.pl')->status_is(403) >+ $t->post_ok('/cgi-bin/koha/opac-user.pl') >+ ->status_is(403) > ->content_like( qr/Wrong CSRF token/, 'Body contains "Wrong CSRF token"' ); > }; > > subtest 'With a wrong CSRF token' => sub { > plan tests => 3; > >- $t->post_ok( '/cgi-bin/koha/opac-user.pl', form => { csrf_token => 'BAD', op => 'cud-login' } )->status_is(403) >+ $t->post_ok( '/cgi-bin/koha/opac-user.pl', form => { csrf_token => 'BAD', op => 'cud-login' } ) >+ ->status_is(403) > ->content_like( qr/Wrong CSRF token/, 'Body contains "Wrong CSRF token"' ); > }; > >@@ -90,7 +95,8 @@ subtest 'CSRF - OPAC' => sub { > my $csrf_token = $t->tx->res->dom('input[name="csrf_token"]')->map( attr => 'value' )->first; > > $t->post_ok( '/cgi-bin/koha/opac-user.pl', form => { csrf_token => $csrf_token, op => 'cud-login' } ) >- ->status_is(200)->content_like( qr/Log in to your account/, 'Login failed but CSRF test passed' ); >+ ->status_is(200) >+ ->content_like( qr/Log in to your account/, 'Login failed but CSRF test passed' ); > }; > > subtest 'GETting what should be POSTed should fail' => sub { >diff --git a/t/db_dependent/mojo/rest-auth.t b/t/db_dependent/mojo/rest-auth.t >index 4b9d5b60f56..27d957df4d3 100755 >--- a/t/db_dependent/mojo/rest-auth.t >+++ b/t/db_dependent/mojo/rest-auth.t >@@ -29,10 +29,13 @@ sub rest_auth_subtest { > > my $t = Test::Mojo->new($app); > >- $t->post_ok('/api/v1/oauth/token')->status_is(400)->json_is( '/errors/0/message', 'Missing property.' ) >- ->json_is( '/errors/0/path', '/grant_type' ); >+ $t->post_ok('/api/v1/oauth/token') >+ ->status_is(400) >+ ->json_is( '/errors/0/message', 'Missing property.' ) >+ ->json_is( '/errors/0/path', '/grant_type' ); > >- $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'client_credentials' } )->status_is(403) >+ $t->post_ok( '/api/v1/oauth/token', form => { grant_type => 'client_credentials' } ) >+ ->status_is(403) > ->json_is( '/error', 'unauthorized_client' ); > > my $patron = $builder->build_object( >@@ -50,7 +53,10 @@ sub rest_auth_subtest { > $t->post_ok( > '/api/v1/oauth/token', > form => { grant_type => 'client_credentials', client_id => $client_id, client_secret => $client_secret } >- )->status_is(200)->json_is( '/expires_in' => 3600 )->json_is( '/token_type' => 'Bearer' ) >+ ) >+ ->status_is(200) >+ ->json_is( '/expires_in' => 3600 ) >+ ->json_is( '/token_type' => 'Bearer' ) > ->json_has('/access_token'); > > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t >index 8938fee2275..5cfb15a16ae 100755 >--- a/t/db_dependent/selenium/regressions.t >+++ b/t/db_dependent/selenium/regressions.t >@@ -108,8 +108,8 @@ subtest 'OPAC - borrowernumber, branchcode and categorycode as html attributes' > $elt->get_attribute( 'data-branchcode', 1 ), $patron->library->branchcode, > "Since bug 20921 span.loggedinusername should contain data-branchcode" > >- # No idea why we need the second param of get_attribute(). As >- # data-branchcode is still there after page finished loading. >+ # No idea why we need the second param of get_attribute(). As >+ # data-branchcode is still there after page finished loading. > ); > is( > $elt->get_attribute( 'data-borrowernumber', 1 ), $patron->borrowernumber, >diff --git a/t/lib/QA/TemplateFilters.pm b/t/lib/QA/TemplateFilters.pm >index fa8b3c45e93..95a52df10a1 100644 >--- a/t/lib/QA/TemplateFilters.pm >+++ b/t/lib/QA/TemplateFilters.pm >@@ -172,14 +172,14 @@ sub process_tt_block { > ? $pre_chomp =~ m|-| > ? q|- | > : $pre_chomp =~ m|~| ? q|~ | >- : q| | >+ : q| | > : q| |; > $post_chomp = > $post_chomp > ? $post_chomp =~ m|-| > ? q| -| > : $post_chomp =~ m|~| ? q| ~| >- : q| | >+ : q| | > : q| |; > > if ( $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*\|.*$} >diff --git a/tags/review.pl b/tags/review.pl >index a9d222b060c..858483d780c 100755 >--- a/tags/review.pl >+++ b/tags/review.pl >@@ -110,7 +110,7 @@ if ( $op eq 'cud-approve' ) { > $template->param( > test_term => $tag, > ( >- $check >= 1 ? 'verdict_ok' >+ $check >= 1 ? 'verdict_ok' > : $check <= -1 ? 'verdict_rej' > : 'verdict_indeterminate' > ) => 1, >diff --git a/tools/stockrotation.pl b/tools/stockrotation.pl >index 8e5f71ae2dc..76c91df22b3 100755 >--- a/tools/stockrotation.pl >+++ b/tools/stockrotation.pl >@@ -473,7 +473,9 @@ sub process_rota { > > if ($rota) { > >- $rota->title( $sub_rota->{title} )->cyclical( $sub_rota->{cyclical} )->description( $sub_rota->{description} ) >+ $rota->title( $sub_rota->{title} ) >+ ->cyclical( $sub_rota->{cyclical} ) >+ ->description( $sub_rota->{description} ) > ->store; > > } else { >diff --git a/xt/find-license-problems.t b/xt/find-license-problems.t >index 7d8c2f36818..835acf237cc 100755 >--- a/xt/find-license-problems.t >+++ b/xt/find-license-problems.t >@@ -35,7 +35,7 @@ my @files = map { > || $name =~ m{xt/find-license-problems|xt/fix-old-fsf-address|misc/translator/po2json} > || $name =~ m[t/mock_templates/intranet-tmpl/prog] > || !-f $name ) >- ? $_ >+ ? $_ > : () > } `git ls-tree -r HEAD --name-only`; # only files part of git > >-- >2.52.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 41076
:
191896
| 192028