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

(-)a/t/db_dependent/Plugins.t (-23 / +21 lines)
Lines 18-24 use Modern::Perl; Link Here
18
18
19
use Archive::Extract;
19
use Archive::Extract;
20
use CGI;
20
use CGI;
21
use Cwd qw(abs_path);
21
use File::Basename;
22
use File::Basename;
23
use File::Spec;
22
use File::Temp qw( tempdir tempfile );
24
use File::Temp qw( tempdir tempfile );
23
use FindBin qw($Bin);
25
use FindBin qw($Bin);
24
use Module::Load::Conditional qw(can_load);
26
use Module::Load::Conditional qw(can_load);
Lines 88-114 subtest 'Version upgrade tests' => sub { Link Here
88
    $schema->storage->txn_rollback;
90
    $schema->storage->txn_rollback;
89
};
91
};
90
92
91
subtest 'Version upgrade tests' => sub {
92
93
    plan tests => 1;
94
95
    $schema->storage->txn_begin;
96
97
    my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
98
99
    # make sure there's no version on the DB
100
    $schema->resultset('PluginData')
101
        ->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } )
102
        ->delete;
103
104
    $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
105
    my $version = $plugin->retrieve_data('__INSTALLED_VERSION__');
106
107
    is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' );
108
109
    $schema->storage->txn_rollback;
110
};
111
112
$schema->storage->txn_begin;
93
$schema->storage->txn_begin;
113
Koha::Plugins::Methods->delete;
94
Koha::Plugins::Methods->delete;
114
95
Lines 272-277 subtest 'Test _version_compare' => sub { Link Here
272
    is( Koha::Plugins::Base::_version_compare( '1.0',      '1.0.0' ),    0, "1.0 is equal to 1.0.0" );
253
    is( Koha::Plugins::Base::_version_compare( '1.0',      '1.0.0' ),    0, "1.0 is equal to 1.0.0" );
273
};
254
};
274
255
256
subtest 'bundle_path() tests' => sub {
257
258
    plan tests => 1;
259
260
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
261
262
    my @current_dir = File::Spec->splitdir(abs_path(__FILE__));
263
    # remote Plugins.t
264
    pop @current_dir;
265
    # remove db_dependent
266
    pop @current_dir;
267
268
    my $plugin = Koha::Plugin::Test->new;
269
270
    is( $plugin->bundle_path, File::Spec->catdir(@current_dir) . '/lib/Koha/Plugin/Test' );
271
272
};
273
275
subtest 'new() tests' => sub {
274
subtest 'new() tests' => sub {
276
275
277
    plan tests => 2;
276
    plan tests => 2;
Lines 286-289 subtest 'new() tests' => sub { Link Here
286
    is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
285
    is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
287
};
286
};
288
287
289
$schema->storage->txn_rollback;
288
$schema->storage->txn_rollback;
290
- 

Return to bug 22834