Bugzilla – Attachment 104712 Details for
Bug 25457
The ViewPolicy filter should cache the MARC framework structure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25457: Regression tests
Bug-25457-Regression-tests.patch (text/plain), 3.01 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-05-11 18:49:57 UTC
(
hide
)
Description:
Bug 25457: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-05-11 18:49:57 UTC
Size:
3.01 KB
patch
obsolete
>From 247f1745c2992ad2c60f9740d8e4dadf356792f8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 11 May 2020 15:35:34 -0300 >Subject: [PATCH] Bug 25457: Regression tests > >This patch implements tests on the ViewPolicy RecordProcessor filter, to >assess it caches the calculated MARC subfield structure between calls. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Filter_MARC_ViewPolicy.t | 71 ++++++++++++++++++++++++- > 1 file changed, 70 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Filter_MARC_ViewPolicy.t b/t/db_dependent/Filter_MARC_ViewPolicy.t >index 552245a01b..61dda7ebd3 100644 >--- a/t/db_dependent/Filter_MARC_ViewPolicy.t >+++ b/t/db_dependent/Filter_MARC_ViewPolicy.t >@@ -23,7 +23,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use List::MoreUtils qw/any/; > use MARC::Record; >@@ -33,6 +33,8 @@ use C4::Biblio; > use Koha::Caches; > use Koha::Database; > >+use t::lib::TestBuilder; >+ > BEGIN { > use_ok('Koha::RecordProcessor'); > } >@@ -41,6 +43,7 @@ my $dbh = C4::Context->dbh; > > my $database = Koha::Database->new(); > my $schema = $database->schema(); >+my $builder = t::lib::TestBuilder->new; > > sub run_hiding_tests { > >@@ -205,3 +208,69 @@ subtest 'Koha::Filter::MARC::ViewPolicy intranet tests' => sub { > $schema->storage->txn_rollback(); > }; > >+subtest 'caching tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $fw_1 = $builder->build_object( { class => 'Koha::BiblioFrameworks' } ); >+ my $fw_2 = $builder->build_object( { class => 'Koha::BiblioFrameworks' } ); >+ my $mss_1 = $builder->build_object( >+ { >+ class => 'Koha::MarcSubfieldStructures', >+ value => { frameworkcode => $fw_1->frameworkcode } >+ } >+ ); >+ my $mss_2 = $builder->build_object( >+ { >+ class => 'Koha::MarcSubfieldStructures', >+ value => { frameworkcode => $fw_2->frameworkcode } >+ } >+ ); >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $record = $biblio->metadata->record; >+ >+ my $processor = Koha::RecordProcessor->new( >+ { >+ schema => 'MARC', >+ filters => ('ViewPolicy'), >+ } >+ ); >+ >+ $processor->options( >+ { >+ frameworkcode => $fw_1->frameworkcode >+ } >+ ); >+ >+ $processor->process($record); >+ >+ ok( >+ exists $processor->filters->[0]->{_cached_frameworks} >+ ->{ $fw_1->frameworkcode }, >+ 'First framework is cached' >+ ); >+ >+ $processor->options( >+ { >+ frameworkcode => $fw_2->frameworkcode >+ } >+ ); >+ >+ $processor->process($record); >+ >+ ok( >+ exists $processor->filters->[0]->{_cached_frameworks} >+ ->{ $fw_1->frameworkcode }, >+ 'First framework is cached' >+ ); >+ ok( >+ exists $processor->filters->[0]->{_cached_frameworks} >+ ->{ $fw_2->frameworkcode }, >+ 'Second framework is cached' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.26.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 25457
:
104712
|
104713
|
104836
|
104837