Bugzilla – Attachment 75925 Details for
Bug 20727
Replace usage of File::Spec->tmpdir with C4::Context->temporary_directory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20727: (QA follow-up) Fix Upload.t and Plugins.t
Bug-20727-QA-follow-up-Fix-Uploadt-and-Pluginst.patch (text/plain), 2.87 KB, created by
Jonathan Druart
on 2018-06-08 15:36:43 UTC
(
hide
)
Description:
Bug 20727: (QA follow-up) Fix Upload.t and Plugins.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-08 15:36:43 UTC
Size:
2.87 KB
patch
obsolete
>From 7aed01de16d40721a617ed3ca6cdc502c18b7975 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 30 May 2018 16:39:25 +0200 >Subject: [PATCH] Bug 20727: (QA follow-up) Fix Upload.t and Plugins.t > >Trivial changes. >Adding C4::Context->temporary_directory to subsequent tmpdir call in Plugins. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/UploadedFile.pm | 5 +++-- > t/db_dependent/Plugins.t | 5 ++--- > t/db_dependent/Upload.t | 6 +++--- > 3 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/Koha/UploadedFile.pm b/Koha/UploadedFile.pm >index cee92653d8..20fc608c68 100644 >--- a/Koha/UploadedFile.pm >+++ b/Koha/UploadedFile.pm >@@ -102,8 +102,9 @@ Returns the fully qualified path name for an uploaded file. > sub full_path { > my ( $self ) = @_; > my $path = File::Spec->catfile( >- $self->permanent? >- $self->permanent_directory: $self->temporary_directory, >+ $self->permanent >+ ? $self->permanent_directory >+ : C4::Context->temporary_directory, > $self->dir, > $self->hashvalue. '_'. $self->filename, > ); >diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t >index 24150593ba..f82d3b25be 100755 >--- a/t/db_dependent/Plugins.t >+++ b/t/db_dependent/Plugins.t >@@ -12,7 +12,6 @@ use Module::Load::Conditional qw(can_load); > use Test::MockModule; > > use C4::Context; >-use Koha::UploadedFile; > > use t::lib::Mocks; > >@@ -63,8 +62,8 @@ is( $plugin->get_plugin_http_path(), '/plugin/Koha/Plugin/Test', 'Test $plugin-> > # test absolute path change in get_template with Koha::Plugin::Test > # using the mock set before > # we also add tmpdir as an approved template dir >-t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context::temporary_directory ] ); >-my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1 ); >+t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context->temporary_directory ] ); >+my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1, DIR => C4::Context->temporary_directory ); > print $fh 'I am [% filename %]'; > close $fh; > my $classname = ref($plugin); >diff --git a/t/db_dependent/Upload.t b/t/db_dependent/Upload.t >index ccb879a7d6..729bb86248 100644 >--- a/t/db_dependent/Upload.t >+++ b/t/db_dependent/Upload.t >@@ -48,11 +48,11 @@ our $uploads = [ > ], > ]; > >-# Redirect upload dir structure and mock File::Spec and CGI >+# Redirect upload dir structure and mock C4::Context and CGI > my $tempdir = tempdir( CLEANUP => 1 ); > t::lib::Mocks::mock_config('upload_path', $tempdir); >-my $specmod = Test::MockModule->new( 'File::Spec' ); >-$specmod->mock( 'tmpdir' => sub { return $tempdir; } ); >+my $specmod = Test::MockModule->new( 'C4::Context' ); >+$specmod->mock( 'temporary_directory' => sub { return $tempdir; } ); > my $cgimod = Test::MockModule->new( 'CGI' ); > $cgimod->mock( 'new' => \&newCGI ); > >-- >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 20727
:
75200
|
75626
|
75667
|
75668
|
75669
|
75670
|
75833
|
75834
|
75835
|
75923
|
75924
| 75925 |
75926
|
75927
|
75928