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

(-)a/installer/data/mysql/atomicupdate/bug_22053_enable-all-plugins.perl (-2 / +2 lines)
Lines 3-9 if( CheckVersion( $DBversion ) ) { Link Here
3
3
4
    use Koha::Plugins;
4
    use Koha::Plugins;
5
5
6
    my @plugins = Koha::Plugins->new()->GetPlugins({ all => 1 });
6
    my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins({ all => 1 });
7
    foreach my $plugin ( @plugins ) {
7
    foreach my $plugin ( @plugins ) {
8
        $plugin->enable;
8
        $plugin->enable;
9
    }
9
    }
Lines 11-14 if( CheckVersion( $DBversion ) ) { Link Here
11
    # Always end with this (adjust the bug info)
11
    # Always end with this (adjust the bug info)
12
    SetVersion( $DBversion );
12
    SetVersion( $DBversion );
13
    print "Upgrade to $DBversion done (Bug 22053 - enable all plugins)\n";
13
    print "Upgrade to $DBversion done (Bug 22053 - enable all plugins)\n";
14
}
14
}
(-)a/t/db_dependent/Plugins.t (-2 / +15 lines)
Lines 9-15 use File::Temp qw( tempdir tempfile ); Link Here
9
use FindBin qw($Bin);
9
use FindBin qw($Bin);
10
use Module::Load::Conditional qw(can_load);
10
use Module::Load::Conditional qw(can_load);
11
use Test::MockModule;
11
use Test::MockModule;
12
use Test::More tests => 46;
12
use Test::More tests => 47;
13
13
14
use C4::Context;
14
use C4::Context;
15
use Koha::Database;
15
use Koha::Database;
Lines 209-211 subtest 'Test _version_compare' => sub { Link Here
209
    is( Koha::Plugins::Base::_version_compare( '1',        '1.0.0' ),    0, "1 is equal to 1.0.0" );
209
    is( Koha::Plugins::Base::_version_compare( '1',        '1.0.0' ),    0, "1 is equal to 1.0.0" );
210
    is( Koha::Plugins::Base::_version_compare( '1.0',      '1.0.0' ),    0, "1.0 is equal to 1.0.0" );
210
    is( Koha::Plugins::Base::_version_compare( '1.0',      '1.0.0' ),    0, "1.0 is equal to 1.0.0" );
211
};
211
};
212
- 
212
213
subtest 'new() tests' => sub {
214
215
    plan tests => 2;
216
217
    t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context->temporary_directory ] );
218
    t::lib::Mocks::mock_config( 'enable_plugins', 0 );
219
220
    my $result = Koha::Plugins->new();
221
    is( $result, undef, 'calling new() on disabled plugins returns undef' );
222
223
    $result = Koha::Plugins->new({ enable_plugins => 1 });
224
    is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
225
};

Return to bug 22053