Bugzilla – Attachment 154032 Details for
Bug 34223
ILL status filter does not load immediately after selecting a backend filter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34223: Add unit test for existing_statuses
Bug-34223-Add-unit-test-for-existingstatuses.patch (text/plain), 4.02 KB, created by
Pedro Amorim
on 2023-07-28 09:46:05 UTC
(
hide
)
Description:
Bug 34223: Add unit test for existing_statuses
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-07-28 09:46:05 UTC
Size:
4.02 KB
patch
obsolete
>From c7721477088c5a747550f33604de168639195af6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 27 Jul 2023 13:20:13 +0100 >Subject: [PATCH] Bug 34223: Add unit test for existing_statuses > >This patch adds a unit test for the 'existing_statuses' method. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > t/db_dependent/Koha/Illbackend.t | 111 +++++++++++++++++++++++++++++++ > 1 file changed, 111 insertions(+) > create mode 100644 t/db_dependent/Koha/Illbackend.t > >diff --git a/t/db_dependent/Koha/Illbackend.t b/t/db_dependent/Koha/Illbackend.t >new file mode 100644 >index 0000000000..d0ae26a4ea >--- /dev/null >+++ b/t/db_dependent/Koha/Illbackend.t >@@ -0,0 +1,111 @@ >+#!/usr/bin/perl >+ >+# Copyright 2023 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+ >+use Koha::Illbackend; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+my $builder = t::lib::TestBuilder->new; >+my $schema = Koha::Database->new->schema; >+ >+subtest 'existing_statuses() tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ Koha::Illrequests->search->delete; >+ >+ my $alias = $builder->build_object( >+ { >+ class => 'Koha::AuthorisedValues', >+ value => { >+ category => 'ILL_STATUS_ALIAS', >+ authorised_value => 'BOB', >+ lib => "Bob is the best status" >+ } >+ } >+ ); >+ >+ my $req = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ status => 'REQ', >+ status_alias => undef, >+ biblio_id => undef, >+ backend => 'FreeForm' >+ } >+ } >+ ); >+ my $chk = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ status => 'CHK', >+ status_alias => undef, >+ biblio_id => undef, >+ backend => 'FreeForm' >+ } >+ } >+ ); >+ my $bob = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ status => 'REQ', >+ status_alias => 'BOB', >+ biblio_id => undef, >+ backend => 'FreeForm' >+ } >+ } >+ ); >+ my $req2 = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ status => 'REQ', >+ status_alias => undef, >+ biblio_id => undef, >+ backend => 'FreeForm' >+ } >+ } >+ ); >+ >+ my $backend_module = Koha::Illbackend->new; >+ >+ my $existing_statuses = $backend_module->existing_statuses('FreeForm'); >+ >+ is( @{$existing_statuses}, 3, "Return 3 unique existing statuses" ); >+ >+ # FIXME: Add tests to check content and order of return >+ my $expected_statuses = [ >+ { code => 'CHK', str => 'Checked out' }, >+ { code => 'REQ', str => 'Requested' }, >+ { code => 'BOB', str => 'Bob is the best status' } >+ ]; >+ >+ is_deeply( $existing_statuses, $expected_statuses, 'Deep match on return' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
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 34223
:
153289
|
153953
|
153956
|
153957
|
153961
|
153962
|
153963
|
153968
|
153973
|
153978
|
153979
|
153980
|
153981
|
153989
|
153990
|
154026
|
154027
|
154028
|
154029
|
154030
|
154031
|
154032
|
154033
|
154068
|
154069
|
154070
|
154071
|
155280
|
155493