Bug 32721: Add unit tests
Unit tests to test two new functions: GetBranchSpecificJS and GetBranchSpecificCSS Test plan: 1) In the shell run prove -t t/db_dependent/Template/Plugin/Branches.t Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
6eea26c729
commit
dd3d59f1f8
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 4;
|
||||
use Test::MockModule;
|
||||
|
||||
use C4::Context;
|
||||
|
|
@ -217,3 +217,30 @@ subtest 'pickup_locations() tests' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'branch specfic js and css' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $newbranch = $builder->build({
|
||||
source => 'Branch',
|
||||
value => {
|
||||
branchcode => 'AAA',
|
||||
branchname => 'Specific Branch',
|
||||
userjs => 'console.log(\'Hello World\');',
|
||||
usercss => 'body { background-color: blue; }'
|
||||
}
|
||||
});
|
||||
|
||||
my $plugin = Koha::Template::Plugin::Branches->new();
|
||||
|
||||
my $userjs = $plugin->GetBranchSpecificJS($newbranch->{branchcode});
|
||||
is($userjs, $newbranch->{userjs},'received correct JS string from function');
|
||||
|
||||
my $usercss = $plugin->GetBranchSpecificCSS($newbranch->{branchcode});
|
||||
is($usercss, $newbranch->{usercss},'received correct CSS string from function');
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue