Bugzilla – Attachment 89558 Details for
Bug 22053
Ability to disable some plugins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22053: (QA follow-up) Fix tests
Bug-22053-QA-follow-up-Fix-tests.patch (text/plain), 3.32 KB, created by
Tomás Cohen Arazi
on 2019-05-10 15:11:17 UTC
(
hide
)
Description:
Bug 22053: (QA follow-up) Fix tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2019-05-10 15:11:17 UTC
Size:
3.32 KB
patch
obsolete
>From db4e0fdfc6f0f612fa533609dcf5c818fccb2984 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 10 May 2019 11:52:34 -0300 >Subject: [PATCH] Bug 22053: (QA follow-up) Fix tests > >This patch makes the tests enable the plugins that are required for >them. Otherwise unexpected failures can happen > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/ImportBatch.t | 3 ++- > t/db_dependent/Koha/Template/Plugin/KohaPlugins.t | 14 ++++++++++++-- > 2 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t >index f42e0d8822..bcc25ef9d1 100644 >--- a/t/db_dependent/ImportBatch.t >+++ b/t/db_dependent/ImportBatch.t >@@ -187,7 +187,8 @@ subtest "RecordsFromMarcPlugin" => sub { > close $fh; > > t::lib::Mocks::mock_config( 'enable_plugins', 1 ); >- my ( $plugin ) = Koha::Plugins->new->GetPlugins({ metadata => { name => 'MarcFieldValues' } }); >+ t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 ); >+ my ($plugin) = Koha::Plugins->new->GetPlugins({ all => 1, metadata => { name => 'MarcFieldValues' } }); > isnt( $plugin, undef, "Plugin found" ); > my $records = C4::ImportBatch::RecordsFromMarcPlugin( $name, ref $plugin, 'UTF-8' ); > is( @$records, 2, 'Two results returned' ); >diff --git a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t b/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >index b0d50e66a0..5ecc1cdb37 100755 >--- a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >+++ b/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >@@ -24,6 +24,16 @@ BEGIN { > use_ok('Koha::Plugin::Test'); > } > >+t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 ); >+t::lib::Mocks::mock_config( 'enable_plugins', 1 ); >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+# Enable all plugins >+my @plugins = Koha::Plugins->new->GetPlugins({ all => 1, class => 'Koha::Plugin::Test' }); >+map { $_->enable; } @plugins; >+ > my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' ); > $mock_plugin->mock( 'test_template', sub { > my ( $self, $file ) = @_; >@@ -36,8 +46,6 @@ use_ok( 'Koha::Template::Plugin::KohaPlugins', 'Can use Koha::Template::Plugin:: > > ok( my $plugin = Koha::Template::Plugin::KohaPlugins->new(), 'Able to instantiate template plugin' ); > >-t::lib::Mocks::mock_preference('UseKohaPlugins',1); >-t::lib::Mocks::mock_config('enable_plugins',1); > ok( index( $plugin->get_plugins_opac_js, 'Koha::Plugin::Test::opac_js' ) != -1, 'Test plugin opac_js return value is part of code returned by get_plugins_opac_js' ); > ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != -1, 'Test plugin opac_head return value is part of code returned by get_plugins_opac_head' ); > ok( index( $plugin->get_plugins_intranet_js, 'Koha::Plugin::Test::intranet_js' ) != -1, 'Test plugin intranet_js return value is part of code returned by get_plugins_intranet_js' ); >@@ -49,3 +57,5 @@ is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empt > is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' ); > is( $plugin->get_plugins_intranet_js, q{}, 'Test plugin intranet_js return value is empty' ); > is( $plugin->get_plugins_intranet_head, q{}, 'Test plugin intranet_head return value is empty' ); >+ >+$schema->storage->txn_rollback; >-- >2.21.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 22053
:
83537
|
83538
|
83539
|
83540
|
83666
|
83667
|
86961
|
86962
|
86963
|
86964
|
88783
|
88784
|
88785
|
88818
|
88819
|
88820
|
89040
|
89041
|
89042
|
89043
|
89116
|
89551
| 89558