View | Details | Raw Unified | Return to bug 20727
Collapse All | Expand All

(-)a/Koha/UploadedFile.pm (-2 / +3 lines)
Lines 102-109 Returns the fully qualified path name for an uploaded file. Link Here
102
sub full_path {
102
sub full_path {
103
    my ( $self ) = @_;
103
    my ( $self ) = @_;
104
    my $path = File::Spec->catfile(
104
    my $path = File::Spec->catfile(
105
        $self->permanent?
105
        $self->permanent
106
            $self->permanent_directory: $self->temporary_directory,
106
            ? $self->permanent_directory
107
            : C4::Context->temporary_directory,
107
        $self->dir,
108
        $self->dir,
108
        $self->hashvalue. '_'. $self->filename,
109
        $self->hashvalue. '_'. $self->filename,
109
    );
110
    );
(-)a/t/db_dependent/Plugins.t (-3 / +2 lines)
Lines 12-18 use Module::Load::Conditional qw(can_load); Link Here
12
use Test::MockModule;
12
use Test::MockModule;
13
13
14
use C4::Context;
14
use C4::Context;
15
use Koha::UploadedFile;
16
15
17
use t::lib::Mocks;
16
use t::lib::Mocks;
18
17
Lines 63-70 is( $plugin->get_plugin_http_path(), '/plugin/Koha/Plugin/Test', 'Test $plugin-> Link Here
63
# test absolute path change in get_template with Koha::Plugin::Test
62
# test absolute path change in get_template with Koha::Plugin::Test
64
# using the mock set before
63
# using the mock set before
65
# we also add tmpdir as an approved template dir
64
# we also add tmpdir as an approved template dir
66
t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context::temporary_directory ] );
65
t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context->temporary_directory ] );
67
my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1 );
66
my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1, DIR => C4::Context->temporary_directory );
68
print $fh 'I am [% filename %]';
67
print $fh 'I am [% filename %]';
69
close $fh;
68
close $fh;
70
my $classname = ref($plugin);
69
my $classname = ref($plugin);
(-)a/t/db_dependent/Upload.t (-4 / +3 lines)
Lines 48-58 our $uploads = [ Link Here
48
    ],
48
    ],
49
];
49
];
50
50
51
# Redirect upload dir structure and mock File::Spec and CGI
51
# Redirect upload dir structure and mock C4::Context and CGI
52
my $tempdir = tempdir( CLEANUP => 1 );
52
my $tempdir = tempdir( CLEANUP => 1 );
53
t::lib::Mocks::mock_config('upload_path', $tempdir);
53
t::lib::Mocks::mock_config('upload_path', $tempdir);
54
my $specmod = Test::MockModule->new( 'File::Spec' );
54
my $specmod = Test::MockModule->new( 'C4::Context' );
55
$specmod->mock( 'tmpdir' => sub { return $tempdir; } );
55
$specmod->mock( 'temporary_directory' => sub { return $tempdir; } );
56
my $cgimod = Test::MockModule->new( 'CGI' );
56
my $cgimod = Test::MockModule->new( 'CGI' );
57
$cgimod->mock( 'new' => \&newCGI );
57
$cgimod->mock( 'new' => \&newCGI );
58
58
59
- 

Return to bug 20727