Bugzilla – Attachment 102989 Details for
Bug 25131
Web installer broken if enable_plugin is set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25131: Add C4::Context->needs_install
Bug-25131-Add-C4Context-needsinstall.patch (text/plain), 1.99 KB, created by
David Nind
on 2020-04-15 11:22:31 UTC
(
hide
)
Description:
Bug 25131: Add C4::Context->needs_install
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-04-15 11:22:31 UTC
Size:
1.99 KB
patch
obsolete
>From 90e5cc43897232b6dfc718fd812a5a2e4bdf5529 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 14 Apr 2020 16:21:37 -0300 >Subject: [PATCH] Bug 25131: Add C4::Context->needs_install > >This trivial patch adds a new convenient way to ask if Koha is >installed. It uses the same approach as C4::Auth:730 > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ t/Context.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Context.pm | 13 +++++++++++++ > t/Context.t | 15 ++++++++++++++- > 2 files changed, 27 insertions(+), 1 deletion(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index df4b5dbbc6..6f7baeaf2d 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1073,6 +1073,19 @@ sub set_remote_address { > > 1; > >+=head3 needs_install >+ >+ if ( $context->needs_install ) { ... } >+ >+This method returns a boolean representing the install status of the Koha instance. >+ >+=cut >+ >+sub needs_install { >+ my ($self) = @_; >+ return ($self->preference('Version')) ? 0 : 1; >+} >+ > __END__ > > =head1 ENVIRONMENT >diff --git a/t/Context.t b/t/Context.t >index ea26ac755e..c2dbbfddff 100755 >--- a/t/Context.t >+++ b/t/Context.t >@@ -18,11 +18,13 @@ > use Modern::Perl; > > use DBI; >-use Test::More tests => 28; >+use Test::More tests => 29; > use Test::MockModule; > use Test::Warn; > use YAML; > >+use t::lib::Mocks; >+ > BEGIN { > use_ok('C4::Context'); > } >@@ -50,6 +52,17 @@ subtest 'yaml_preference() tests' => sub { > $context->unmock( 'preference' ); > }; > >+subtest 'needs_install() tests' => sub { >+ >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference( 'Version', '3.0.0' ); >+ is( C4::Context->needs_install, 0, 'Preference is defined, no need to install' ); >+ >+ t::lib::Mocks::mock_preference( 'Version', undef ); # the behaviour when ->preference fails to fetch >+ is( C4::Context->needs_install, 1, "->preference(Version) is not defined, need to install" ); >+}; >+ > my $context = new Test::MockModule('C4::Context'); > my $userenv = {}; > >-- >2.11.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 25131
:
102941
|
102942
|
102943
|
102989
|
102990
|
102991
|
102995
|
102996
|
102997
|
103015
|
104003