Bug 26384: Fix executable flags
[koha.git] / t / Koha / Plugins / Tab.t
blob94b7097f238e14f7739bcd211355522c7c68faca
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
18 use Modern::Perl;
20 use Test::More tests => 1;
21 use Test::Exception;
23 use Koha::Plugins::Tab;
25 subtest 'new() tests' => sub {
26 plan tests => 7;
28 throws_ok { Koha::Plugins::Tab->new( { title => 'A title' } ); }
29 'Koha::Exceptions::MissingParameter',
30 'Exception is thrown on missing content';
32 is(
33 "$@",
34 "Mandatory parameter 'content' missing",
35 'Exception message is correct'
38 throws_ok { Koha::Plugins::Tab->new( { content => 'Some content' } ); }
39 'Koha::Exceptions::MissingParameter',
40 'Exception is thrown on missing title';
42 is(
43 "$@",
44 "Mandatory parameter 'title' missing",
45 'Exception message is correct'
48 my $tab = Koha::Plugins::Tab->new(
50 title => 'A title',
51 content => 'Some content'
55 is( $tab->title, 'A title', 'title accessor is correct' );
56 is( $tab->content, 'Some content', 'content accessor is correct' );
58 my $id = 'calculated-id';
59 $tab->id($id);
61 is( $tab->id, $id, 'The id can be calculated and set on runtime' );