# Start test
-my $count = GetBranchesCount;
+my $count = GetBranchesCount();
like( $count, '/^\d+$/', "the count is a number" );
#add 2 branches
$b2->{add} = 1;
ModBranch($b2);
-is( GetBranchesCount, $count + 2, "two branches added" );
+is( GetBranchesCount(), $count + 2, "two branches added" );
#Test DelBranch
is( DelBranch( $b2->{branchcode} ), 1, "One row affected" );
-is( GetBranchesCount, $count + 1, "branch BRB deleted" );
+is( GetBranchesCount(), $count + 1, "branch BRB deleted" );
#Test GetBranchName
is( GetBranchName( $b1->{branchcode} ),
is_deeply( $branchdetail, $b1, 'branchdetail is right' );
#Test Getbranches
-my $branches = GetBranches;
+my $branches = GetBranches();
is( scalar( keys %$branches ),
- GetBranchesCount, "GetBranches returns the right number of branches" );
+ GetBranchesCount(), "GetBranches returns the right number of branches" );
#Test ModBranch
};
ModBranch($b1);
-is( GetBranchesCount, $count + 1,
+is( GetBranchesCount(), $count + 1,
"A branch has been modified, no new branch added" );
$branchdetail = GetBranchDetail( $b1->{branchcode} );
$b1->{issuing} = undef;
is_deeply( $branchdetail, $b1 , "GetBranchDetail gives the details of BRA");
#Test categories
-my $categories = GetBranchCategories;
-my $count_cat = scalar( keys $categories );
+my $categories = GetBranchCategories();
+my $count_cat = scalar( @$categories );
my $cat1 = {
add => 1,
ModBranchCategoryInfo($cat1);
ModBranchCategoryInfo($cat2);
-$categories = GetBranchCategories;
-is( scalar( keys $categories ), $count_cat + 3, "Two categories added" );
+$categories = GetBranchCategories();
+is( scalar( @$categories ), $count_cat + 3, "Two categories added" );
delete $cat1->{add};
delete $cat2->{add};
-delete %new_category{add};
+delete $new_category{add};
is_deeply($categories, [ $cat1,$cat2,\%new_category ], 'retrieve all expected library categories (bug 10515)');
#test GetBranchCategory
my $del = DelBranchCategory( $cat2->{categorycode} );
is( $del, 1, 'One row affected' );
-$categories = GetBranchCategories;
-is( scalar( keys $categories ), $count_cat + 2, "Category CAT2 deleted" );
+$categories = GetBranchCategories();
+is( scalar( @$categories ), $count_cat + 2, "Category CAT2 deleted" );
my $cat2detail = GetBranchCategory( $cat2->{categorycode} );
is( $cat2detail, undef, 'CAT2 doesnt exist' );
$b2->{CAT1} = 1;
ModBranch($b2);
-is( GetBranchesCount, $count + 2, 'BRB added' );
+is( GetBranchesCount(), $count + 2, 'BRB added' );
is(
CheckBranchCategorycode( $cat1->{categorycode} ),
$check1 + 1,
is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1' );
ModBranchCategoryInfo({add => 1,%$cat2});
-$categories = GetBranchCategories;
-is( scalar( keys $categories ), $count_cat + 3, "Two categories added" );
+$categories = GetBranchCategories();
+is( scalar( @$categories ), $count_cat + 3, "Two categories added" );
$b2 = {
branchcode => 'BRB',
branchname => 'BranchB',
#Test GetBranchesLoop
my $loop = GetBranchesLoop;
-is( scalar(@$loop), GetBranchesCount, 'There is the right number of branches' );
+is( scalar(@$loop), GetBranchesCount(), 'There is the right number of branches' );
# End transaction
$dbh->rollback;