Bugzilla – Attachment 48156 Details for
Bug 15578
Authority tests skip and hide a bug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[3.22.x] Bug 15578: Insert authority records before processing tests
Bug-15578-Insert-authority-records-before-processi.patch (text/plain), 3.19 KB, created by
Jonathan Druart
on 2016-02-17 10:31:49 UTC
(
hide
)
Description:
[3.22.x] Bug 15578: Insert authority records before processing tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-17 10:31:49 UTC
Size:
3.19 KB
patch
obsolete
>From 6505af2542b56b8f5db66cb87dd3da6daeacf8c5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 14 Jan 2016 12:27:32 +0000 >Subject: [PATCH] Bug 15578: Insert authority records before processing tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Koha_Authority.t | 57 ++++++++++++++++++++++++++--------------- > 1 file changed, 36 insertions(+), 21 deletions(-) > >diff --git a/t/db_dependent/Koha_Authority.t b/t/db_dependent/Koha_Authority.t >index 92c3998..61d59e0 100755 >--- a/t/db_dependent/Koha_Authority.t >+++ b/t/db_dependent/Koha_Authority.t >@@ -17,18 +17,37 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use C4::Context; >+use C4::Charset; >+use C4::AuthoritiesMarc; >+use Koha::Database; > use Test::More; >+use File::Basename; >+use MARC::Batch; >+use MARC::File; >+use IO::File; > > BEGIN { >- use_ok('Koha::Authority'); >+ use_ok('Koha::Authority'); > } > >-my $record = MARC::Record->new; >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+# TODO Move this part to a t/lib packages >+my $sourcedir = dirname(__FILE__) . "/data"; >+my $input_marc_file = "$sourcedir/marc21/zebraexport/authority/exported_records"; >+ >+my $fh = IO::File->new($input_marc_file); >+my $batch = MARC::Batch->new( 'USMARC', $fh ); >+while ( my $record = $batch->next ) { >+ C4::Charset::MarcToUTF8Record($record, 'MARC21'); >+ AddAuthority($record, '', ''); >+} > >+my $record = MARC::Record->new; > $record->add_fields( > [ '001', '1234' ], > [ '150', ' ', ' ', a => 'Cooking' ], >@@ -42,28 +61,24 @@ is($authority->authorized_heading(), 'Cooking', 'Authorized heading was correct' > > is_deeply($authority->record, $record, 'Saved record'); > >-SKIP: >-{ >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT authid FROM auth_header LIMIT 1;"); >- $sth->execute(); >+my $dbh = C4::Context->dbh; >+my $sth = $dbh->prepare("SELECT authid FROM auth_header LIMIT 1;"); >+$sth->execute(); > >- my $authid; >- for my $row ($sth->fetchrow_hashref) { >- $authid = $row->{'authid'}; >- } >- skip 'No authorities', 3 unless $authid; >- $authority = Koha::Authority->get_from_authid($authid); >+my $authid; >+for my $row ($sth->fetchrow_hashref) { >+ $authid = $row->{'authid'}; >+} >+$authority = Koha::Authority->get_from_authid($authid); > >- is(ref($authority), 'Koha::Authority', 'Retrieved valid Koha::Authority object'); >+is(ref($authority), 'Koha::Authority', 'Retrieved valid Koha::Authority object'); > >- is($authority->authid, $authid, 'Object authid is correct'); >+is($authority->authid, $authid, 'Object authid is correct'); > >- is($authority->record->field('001')->data(), $authid, 'Retrieved correct record'); >+is($authority->record->field('001')->data(), $authid, 'Retrieved correct record'); > >- $authority = Koha::Authority->get_from_authid('alphabetsoup'); >- is($authority, undef, 'No invalid record is retrieved'); >-} >+$authority = Koha::Authority->get_from_authid('alphabetsoup'); >+is($authority, undef, 'No invalid record is retrieved'); > > SKIP: > { >-- >2.7.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 15578
:
46649
|
46650
|
46675
|
46676
|
46711
|
46712
|
47638
|
47639
| 48156 |
48157