Lines 21-27
use Modern::Perl;
Link Here
|
21 |
use C4::Context; |
21 |
use C4::Context; |
22 |
use Data::Dumper; |
22 |
use Data::Dumper; |
23 |
|
23 |
|
24 |
use Test::More tests => 30; |
24 |
use Test::More tests => 26; |
25 |
|
25 |
|
26 |
use C4::Branch; |
26 |
use C4::Branch; |
27 |
use Koha::Libraries; |
27 |
use Koha::Libraries; |
Lines 34-40
BEGIN {
Link Here
|
34 |
} |
34 |
} |
35 |
can_ok( |
35 |
can_ok( |
36 |
'C4::Branch', qw( |
36 |
'C4::Branch', qw( |
37 |
GetBranchCategory |
|
|
38 |
GetBranchName |
37 |
GetBranchName |
39 |
GetBranch |
38 |
GetBranch |
40 |
GetBranches |
39 |
GetBranches |
Lines 209-233
delete $cat2->{add};
Link Here
|
209 |
delete $new_category{add}; |
208 |
delete $new_category{add}; |
210 |
is_deeply($categories, [ $cat1,$cat2,\%new_category ], 'retrieve all expected library categories (bug 10515)'); |
209 |
is_deeply($categories, [ $cat1,$cat2,\%new_category ], 'retrieve all expected library categories (bug 10515)'); |
211 |
|
210 |
|
212 |
#test GetBranchCategory |
|
|
213 |
my $cat1detail = GetBranchCategory( $cat1->{categorycode} ); |
214 |
delete $cat1->{add}; |
215 |
is_deeply( $cat1detail, $cat1, 'CAT1 details are right' ); |
216 |
my $category = GetBranchCategory('LIBCATCODE'); |
217 |
is_deeply($category, \%new_category, 'fetched newly added library category'); |
218 |
|
219 |
my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete; |
211 |
my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete; |
220 |
is( $del, 1, 'One row affected' ); |
212 |
is( $del, 1, 'One row affected' ); |
221 |
|
213 |
|
222 |
$categories = GetBranchCategories(); |
214 |
$categories = GetBranchCategories(); |
223 |
is( scalar( @$categories ), $count_cat + 2, "Category CAT2 deleted" ); |
215 |
is( scalar( @$categories ), $count_cat + 2, "Category CAT2 deleted" ); |
224 |
|
216 |
|
225 |
my $cat2detail = GetBranchCategory( $cat2->{categorycode} ); |
|
|
226 |
is( $cat2detail, undef, 'CAT2 doesnt exist' ); |
227 |
|
228 |
$category = GetBranchCategory(); |
229 |
is($category, undef, 'retrieve library category only if code is supplied (bug 10515)'); |
230 |
|
231 |
$b2->{CAT1} = 1; |
217 |
$b2->{CAT1} = 1; |
232 |
ModBranch($b2); |
218 |
ModBranch($b2); |
233 |
is( GetBranchesCount(), $count + 2, 'BRB added' ); |
219 |
is( GetBranchesCount(), $count + 2, 'BRB added' ); |
234 |
- |
|
|