Bugzilla – Attachment 172094 Details for
Bug 30888
Add a table for deletedauthorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30888: Unit tests
Bug-30888-Unit-tests.patch (text/plain), 3.57 KB, created by
Marcel de Rooy
on 2024-09-27 07:49:47 UTC
(
hide
)
Description:
Bug 30888: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-09-27 07:49:47 UTC
Size:
3.57 KB
patch
obsolete
>From 6b950da9d9fcf17cee7f5d78615640442525615e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 17 Apr 2024 15:06:00 +0000 >Subject: [PATCH] Bug 30888: Unit tests >Content-Type: text/plain; charset=utf-8 > >Extending DelAuthority test in AuthoritiesMarc.t. >Adding Koha/Authority.t for new method move_to_deleted. > >Test plan: >Run both tests. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/AuthoritiesMarc.t | 5 ++- > t/db_dependent/Koha/Authority.t | 59 ++++++++++++++++++++++++++++++++ > 2 files changed, 63 insertions(+), 1 deletion(-) > create mode 100755 t/db_dependent/Koha/Authority.t > >diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t >index 55435d281b..9dda769320 100755 >--- a/t/db_dependent/AuthoritiesMarc.t >+++ b/t/db_dependent/AuthoritiesMarc.t >@@ -336,7 +336,7 @@ subtest 'ModAuthority() tests' => sub { > > subtest 'DelAuthority() tests' => sub { > >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > >@@ -364,5 +364,8 @@ subtest 'DelAuthority() tests' => sub { > undef, > 'skip_merge passed, merge not called'; > >+ # Check if last delete got moved to deletedauth_header >+ isnt( Koha::Database->new->schema->resultset('DeletedauthHeader')->find($auth_id), undef, 'Moved to deleted' ); >+ > $schema->storage->txn_rollback; > }; >diff --git a/t/db_dependent/Koha/Authority.t b/t/db_dependent/Koha/Authority.t >new file mode 100755 >index 0000000000..db79a92165 >--- /dev/null >+++ b/t/db_dependent/Koha/Authority.t >@@ -0,0 +1,59 @@ >+#!/usr/bin/perl >+ >+# Copyright 2024 Rijksmuseum, 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 C4::AuthoritiesMarc; >+use Koha::Authorities; >+use Koha::Database; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+my $builder = t::lib::TestBuilder->new; >+my $schema = Koha::Database->new->schema; >+ >+subtest 'move_to_deleted' => sub { >+ plan tests => 3; >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); # TODO UNIMARC? >+ >+ my $record = MARC::Record->new; >+ $record->append_fields( MARC::Field->new( '100', '1', '2', a => 'Name' ) ); >+ my $type = $builder->build( { source => 'AuthType', value => { auth_tag_to_report => '100' } } ); >+ my $authid = C4::AuthoritiesMarc::AddAuthority( >+ $record, undef, >+ $type->{authtypecode} >+ ); >+ my $authority = Koha::Authorities->find($authid); >+ >+ # Trivial test to see if 'move' really copies.. >+ my $count = $schema->resultset('DeletedauthHeader')->count; >+ my $rec = $authority->move_to_deleted; >+ is( $schema->resultset('DeletedauthHeader')->count, $count + 1, 'count one higher' ); >+ >+ # Check leader position 05 in marc and marcxml >+ is( substr( $rec->marc, 5, 1 ), 'd', 'Leader in marc blob correct' ); >+ like( $rec->marcxml, qr/<leader>\d{5}d/, 'Leader in marcxml checked also' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.39.5
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 30888
:
165040
|
165041
|
165042
|
165043
|
171850
|
171851
|
172090
|
172091
|
172092
|
172093
|
172094
|
172095
|
172096
|
172097
|
172098
|
172099
|
172549
|
172550
|
172551
|
172552
|
172553