|
Lines 45-51
can_ok(
Link Here
|
| 45 |
GetBranchesInCategory |
45 |
GetBranchesInCategory |
| 46 |
ModBranchCategoryInfo |
46 |
ModBranchCategoryInfo |
| 47 |
mybranch |
47 |
mybranch |
| 48 |
GetBranchesCount) |
48 |
) |
| 49 |
); |
49 |
); |
| 50 |
|
50 |
|
| 51 |
|
51 |
|
|
Lines 59-65
$dbh->do('DELETE FROM branchcategories');
Link Here
|
| 59 |
|
59 |
|
| 60 |
# Start test |
60 |
# Start test |
| 61 |
|
61 |
|
| 62 |
my $count = GetBranchesCount(); |
62 |
my $count = Koha::Libraries->search->count; |
| 63 |
like( $count, '/^\d+$/', "the count is a number" ); |
63 |
like( $count, '/^\d+$/', "the count is a number" ); |
| 64 |
|
64 |
|
| 65 |
#add 2 branches |
65 |
#add 2 branches |
|
Lines 111-120
is( ModBranch($b2), undef, 'the field add is missing' );
Link Here
|
| 111 |
|
111 |
|
| 112 |
$b2->{add} = 1; |
112 |
$b2->{add} = 1; |
| 113 |
ModBranch($b2); |
113 |
ModBranch($b2); |
| 114 |
is( GetBranchesCount(), $count + 2, "two branches added" ); |
114 |
is( Koha::Libraries->search->count, $count + 2, "two branches added" ); |
| 115 |
|
115 |
|
| 116 |
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" ); |
116 |
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" ); |
| 117 |
is( GetBranchesCount(), $count + 1, "branch BRB deleted" ); |
117 |
is( Koha::Libraries->search->count, $count + 1, "branch BRB deleted" ); |
| 118 |
|
118 |
|
| 119 |
#Test GetBranchName |
119 |
#Test GetBranchName |
| 120 |
is( GetBranchName( $b1->{branchcode} ), |
120 |
is( GetBranchName( $b1->{branchcode} ), |
|
Lines 129-135
is_deeply( $branchdetail, $b1, 'branchdetail is right' );
Link Here
|
| 129 |
#Test Getbranches |
129 |
#Test Getbranches |
| 130 |
my $branches = GetBranches(); |
130 |
my $branches = GetBranches(); |
| 131 |
is( scalar( keys %$branches ), |
131 |
is( scalar( keys %$branches ), |
| 132 |
GetBranchesCount(), "GetBranches returns the right number of branches" ); |
132 |
Koha::Libraries->search->count, "GetBranches returns the right number of branches" ); |
| 133 |
|
133 |
|
| 134 |
#Test ModBranch |
134 |
#Test ModBranch |
| 135 |
|
135 |
|
|
Lines 156-162
$b1 = {
Link Here
|
| 156 |
}; |
156 |
}; |
| 157 |
|
157 |
|
| 158 |
ModBranch($b1); |
158 |
ModBranch($b1); |
| 159 |
is( GetBranchesCount(), $count + 1, |
159 |
is( Koha::Libraries->search->count, $count + 1, |
| 160 |
"A branch has been modified, no new branch added" ); |
160 |
"A branch has been modified, no new branch added" ); |
| 161 |
$branchdetail = GetBranchDetail( $b1->{branchcode} ); |
161 |
$branchdetail = GetBranchDetail( $b1->{branchcode} ); |
| 162 |
$b1->{issuing} = undef; |
162 |
$b1->{issuing} = undef; |
|
Lines 211-217
is( Koha::LibraryCategories->search->count, $count_cat + 2, "Category CAT 2 dele
Link Here
|
| 211 |
|
211 |
|
| 212 |
$b2->{CAT1} = 1; |
212 |
$b2->{CAT1} = 1; |
| 213 |
ModBranch($b2); |
213 |
ModBranch($b2); |
| 214 |
is( GetBranchesCount(), $count + 2, 'BRB added' ); |
214 |
is( Koha::Libraries->search->count, $count + 2, 'BRB added' ); |
| 215 |
|
215 |
|
| 216 |
#Test GetBranchInfo |
216 |
#Test GetBranchInfo |
| 217 |
my $b1info = GetBranchInfo( $b1->{branchcode} ); |
217 |
my $b1info = GetBranchInfo( $b1->{branchcode} ); |
|
Lines 297-303
is_deeply( $brCat1, \@b, 'CAT1 has branch BRB and BRC' );
Link Here
|
| 297 |
|
297 |
|
| 298 |
#Test GetBranchesLoop |
298 |
#Test GetBranchesLoop |
| 299 |
my $loop = GetBranchesLoop; |
299 |
my $loop = GetBranchesLoop; |
| 300 |
is( scalar(@$loop), GetBranchesCount(), 'There is the right number of branches' ); |
300 |
is( scalar(@$loop), Koha::Libraries->search->count, 'There is the right number of branches' ); |
| 301 |
|
301 |
|
| 302 |
# End transaction |
302 |
# End transaction |
| 303 |
$dbh->rollback; |
303 |
$dbh->rollback; |
| 304 |
- |
|
|