Bugzilla – Attachment 71640 Details for
Bug 20204
FrameworkPlugin.t should not depend on CPL branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20204: Add TestBuilder to replace CPL branch
Bug-20204-Add-TestBuilder-to-replace-CPL-branch.patch (text/plain), 2.48 KB, created by
Marcel de Rooy
on 2018-02-15 08:25:36 UTC
(
hide
)
Description:
Bug 20204: Add TestBuilder to replace CPL branch
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-02-15 08:25:36 UTC
Size:
2.48 KB
patch
obsolete
>From 5f4ae67b02d50fdcc5a2bc8b530bfa4d23b1427f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 15 Feb 2018 09:08:59 +0100 >Subject: [PATCH] Bug 20204: Add TestBuilder to replace CPL branch >Content-Type: text/plain; charset=utf-8 > >Remove CPL; without this branch, the test crashes. >Rearrange modules at the start. >Add Koha::Database calls. >Move a few global my vars to our level. >Remove intermediate rollbacks. > >Test plan: >[1] Run prove t/db_dependent/FrameworkPlugin.t > Ignore noise from unimarc plugins :) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/FrameworkPlugin.t | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/FrameworkPlugin.t b/t/db_dependent/FrameworkPlugin.t >index c85eb9f..345499d 100644 >--- a/t/db_dependent/FrameworkPlugin.t >+++ b/t/db_dependent/FrameworkPlugin.t >@@ -1,46 +1,45 @@ > use Modern::Perl; > >-use C4::Auth; >-use C4::Output; >-use Koha::FrameworkPlugin; >- > use CGI; > use File::Temp qw/tempfile/; > use Getopt::Long; > use Test::MockModule; > use Test::More tests => 5; > >-my @includes; >+use t::lib::TestBuilder; >+ >+use C4::Auth; >+use C4::Output; >+use Koha::Database; >+use Koha::FrameworkPlugin; >+ >+our @includes; > GetOptions( 'include=s{,}' => \@includes ); #not used by default ! > >-my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+our $dbh = C4::Context->dbh; >+our $builder = t::lib::TestBuilder->new; > > subtest 'Test01 -- Simple tests for new and name' => sub { > plan tests => 7; > test01(); >- $dbh->rollback; > }; > subtest 'Test02 -- test build with old styler and marc21_leader' => sub { > plan tests => 5; > test02(); >- $dbh->rollback; > }; > subtest 'Test03 -- tests with bad plugins' => sub { > test03(); >- $dbh->rollback; > }; > subtest 'Test04 -- tests with new style plugin' => sub { > plan tests => 5; > test04(); >- $dbh->rollback; > }; > subtest 'Test05 -- tests with build and launch for default plugins' => sub { > test05( \@includes ); >- $dbh->rollback; > }; >-$dbh->rollback; >+$schema->storage->txn_rollback; > > sub test01 { > #empty plugin >@@ -179,7 +178,8 @@ unimarc_field_4XX.pl |; > } > > sub mock_userenv { >- return { branch => 'CPL', flags => 1, id => 1 }; >+ my $branch = $builder->build({ source => 'Branch' }); >+ return { branch => $branch->{branchcode}, flags => 1, id => 1 }; > } > > sub all_perms { >-- >2.1.4
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 20204
: 71640