Bugzilla – Attachment 154376 Details for
Bug 34519
Add a template plugin for ExtendedAttributeTypes to fetch searchable patron attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34519: Unit tests
Bug-34519-Unit-tests.patch (text/plain), 3.00 KB, created by
Nick Clemens (kidclamp)
on 2023-08-11 14:37:52 UTC
(
hide
)
Description:
Bug 34519: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-08-11 14:37:52 UTC
Size:
3.00 KB
patch
obsolete
>From ee4aaba978247a78cdbc63c9b5ae775d5ac81d65 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 11 Aug 2023 14:37:07 +0000 >Subject: [PATCH] Bug 34519: Unit tests > >--- > .../Template/Plugin/ExtendedAttributeTypes.t | 76 +++++++++++++++++++ > 1 file changed, 76 insertions(+) > create mode 100644 t/db_dependent/Koha/Template/Plugin/ExtendedAttributeTypes.t > >diff --git a/t/db_dependent/Koha/Template/Plugin/ExtendedAttributeTypes.t b/t/db_dependent/Koha/Template/Plugin/ExtendedAttributeTypes.t >new file mode 100644 >index 0000000000..df1deae3a6 >--- /dev/null >+++ b/t/db_dependent/Koha/Template/Plugin/ExtendedAttributeTypes.t >@@ -0,0 +1,76 @@ >+#!/usr/bin/perl >+ >+# 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 => 5; >+ >+use C4::Context; >+use Koha::Database; >+use Koha::Patron::Attribute::Types; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+BEGIN { >+ use_ok('Koha::Template::Plugin::ExtendedAttributeTypes'); >+} >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+ >+my $plugin = Koha::Template::Plugin::ExtendedAttributeTypes->new(); >+ok( $plugin, "initialized ExtendedAttributeTypes plugin" ); >+ >+my $typeA = $builder->build_object( >+ { >+ class => 'Koha::Patron::Attribute::Types', >+ value => { >+ staff_searchable => 0, >+ description => "Desc type A", >+ } >+ } >+); >+my $typeB = $builder->build_object( >+ { >+ class => 'Koha::Patron::Attribute::Types', >+ value => { >+ staff_searchable => 1, >+ description => "Desc type B", >+ } >+ } >+); >+ >+my $all_plugin = $plugin->all(); >+my $all_objects = Koha::Patron::Attribute::Types->search(); >+ >+is_deeply( $all_plugin->unblessed, $all_objects->unblessed, "all method returns all the types correctly"); >+ >+my $all_plugin_codes = $plugin->codes(); >+my $all_object_codes = Koha::Patron::Attribute::Types->search()->get_column('code'); >+ >+is_deeply( $all_plugin_codes, $all_object_codes, "codes method returns the codes as expected"); >+ >+my $searchable_plugin_codes = $plugin->codes({ staff_searchable => 1 }); >+my $searchable_object_codes = Koha::Patron::Attribute::Types->search({ staff_searchable => 1 })->get_column('code'); >+ >+is_deeply( $searchable_plugin_codes, $searchable_object_codes, "searching plugin method works as expected"); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >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 34519
:
154375
|
154376
|
154384
|
154641
|
154646
|
154647
|
154648
|
154649
|
157649
|
157650
|
157651
|
157652
|
158423
|
158424
|
158425
|
158426