|
Lines 9-17
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 => 41; |
12 |
use Test::More tests => 42; |
| 13 |
|
13 |
|
| 14 |
use C4::Context; |
14 |
use C4::Context; |
|
|
15 |
use Koha::Database; |
| 15 |
|
16 |
|
| 16 |
use t::lib::Mocks; |
17 |
use t::lib::Mocks; |
| 17 |
|
18 |
|
|
Lines 24-29
BEGIN {
Link Here
|
| 24 |
use_ok('Koha::Plugin::Test'); |
25 |
use_ok('Koha::Plugin::Test'); |
| 25 |
} |
26 |
} |
| 26 |
|
27 |
|
|
|
28 |
my $schema = Koha::Database->new->schema; |
| 29 |
|
| 27 |
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' ); |
30 |
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' ); |
| 28 |
$mock_plugin->mock( 'test_template', sub { |
31 |
$mock_plugin->mock( 'test_template', sub { |
| 29 |
my ( $self, $file ) = @_; |
32 |
my ( $self, $file ) = @_; |
|
Lines 157-162
subtest 'output and output_html tests' => sub {
Link Here
|
| 157 |
like($stdout, qr{¡Hola output_html!}, 'Correct data'); |
160 |
like($stdout, qr{¡Hola output_html!}, 'Correct data'); |
| 158 |
}; |
161 |
}; |
| 159 |
|
162 |
|
|
|
163 |
subtest 'Version upgrade tests' => sub { |
| 164 |
|
| 165 |
plan tests => 1; |
| 166 |
|
| 167 |
$schema->storage->txn_begin; |
| 168 |
|
| 169 |
my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); |
| 170 |
|
| 171 |
# make sure there's no version on the DB |
| 172 |
$schema->resultset('PluginData') |
| 173 |
->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } ) |
| 174 |
->delete; |
| 175 |
|
| 176 |
$plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); |
| 177 |
my $version = $plugin->retrieve_data('__INSTALLED_VERSION__'); |
| 178 |
|
| 179 |
is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' ); |
| 180 |
|
| 181 |
$schema->storage->txn_rollback; |
| 182 |
}; |
| 183 |
|
| 184 |
|
| 160 |
subtest 'Test _version_compare' => sub { |
185 |
subtest 'Test _version_compare' => sub { |
| 161 |
|
186 |
|
| 162 |
plan tests => 6; |
187 |
plan tests => 6; |
| 163 |
- |
|
|