|
Lines 26-32
use String::Random;
Link Here
|
| 26 |
use_ok( 'Koha::Template::Plugin::Koha' ); |
26 |
use_ok( 'Koha::Template::Plugin::Koha' ); |
| 27 |
ok( my $cache = Koha::Template::Plugin::Koha->new() ); |
27 |
ok( my $cache = Koha::Template::Plugin::Koha->new() ); |
| 28 |
|
28 |
|
| 29 |
subtest "Koha::Template::Plugin::Koha::version tests" => sub { |
29 |
subtest "Koha::Template::Plugin::Koha::Version tests" => sub { |
| 30 |
|
30 |
|
| 31 |
plan tests => 2; |
31 |
plan tests => 2; |
| 32 |
|
32 |
|
|
Lines 38-44
subtest "Koha::Template::Plugin::Koha::version tests" => sub {
Link Here
|
| 38 |
|
38 |
|
| 39 |
# Mock Koha::version() |
39 |
# Mock Koha::version() |
| 40 |
my $koha = new Test::MockModule('Koha'); |
40 |
my $koha = new Test::MockModule('Koha'); |
| 41 |
$koha->mock( 'Version', sub { |
41 |
$koha->mock( 'version', sub { |
| 42 |
return "$major.$minor.$maintenance.$development"; |
42 |
return "$major.$minor.$maintenance.$development"; |
| 43 |
}); |
43 |
}); |
| 44 |
|
44 |
|
|
Lines 49-55
subtest "Koha::Template::Plugin::Koha::version tests" => sub {
Link Here
|
| 49 |
$maintenance = $rnd->randregex('\d\d'); |
49 |
$maintenance = $rnd->randregex('\d\d'); |
| 50 |
$development = $rnd->randregex('\d\d\d'); |
50 |
$development = $rnd->randregex('\d\d\d'); |
| 51 |
my $version = "$major.$minor.$maintenance.$development"; |
51 |
my $version = "$major.$minor.$maintenance.$development"; |
| 52 |
my $res = Koha::Template::Plugin::Koha::version( $version ); |
52 |
my $res = Koha::Template::Plugin::Koha::Version( $version ); |
| 53 |
is_deeply( $res, { |
53 |
is_deeply( $res, { |
| 54 |
major => $major, |
54 |
major => $major, |
| 55 |
release => $major . "." . $minor, |
55 |
release => $major . "." . $minor, |
|
Lines 64-70
subtest "Koha::Template::Plugin::Koha::version tests" => sub {
Link Here
|
| 64 |
$maintenance = $rnd->randregex('\d\d'); |
64 |
$maintenance = $rnd->randregex('\d\d'); |
| 65 |
$development = "000"; |
65 |
$development = "000"; |
| 66 |
$version = "$major.$minor.$maintenance.$development"; |
66 |
$version = "$major.$minor.$maintenance.$development"; |
| 67 |
$res = Koha::Template::Plugin::Koha::version( $version ); |
67 |
$res = Koha::Template::Plugin::Koha::Version( $version ); |
| 68 |
is_deeply( $res, { |
68 |
is_deeply( $res, { |
| 69 |
major => $major, |
69 |
major => $major, |
| 70 |
release => $major . "." . $minor, |
70 |
release => $major . "." . $minor, |
| 71 |
- |
|
|