|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
use Modern::Perl; |
| 4 |
|
| 5 |
use String::Random; |
| 6 |
use Test::More tests => 1; |
| 7 |
|
| 8 |
use Koha::Database; |
| 9 |
use Koha::Patrons; |
| 10 |
|
| 11 |
my $schema = Koha::Database->schema; |
| 12 |
|
| 13 |
subtest 'Koha::Patrons::siblings should return a Koha::Patrons object even if patron has no guarantor' => sub { |
| 14 |
plan tests => 2; |
| 15 |
$schema->txn_begin; |
| 16 |
|
| 17 |
my $random = String::Random->new; |
| 18 |
|
| 19 |
my $categorycode = $random->randpattern('CCCCCCCCCC'); |
| 20 |
my $branchcode = $random->randpattern('CCCCCCCCCC'); |
| 21 |
|
| 22 |
my $category = $schema->resultset('Category')->create( { categorycode => $categorycode } ); |
| 23 |
my $branch = $schema->resultset('Branch')->create( |
| 24 |
{ |
| 25 |
branchcode => $branchcode, |
| 26 |
branchname => 'Test branch for Koha::Patron::siblings tests', |
| 27 |
} |
| 28 |
); |
| 29 |
my $borrower = $schema->resultset('Borrower')->create( |
| 30 |
{ |
| 31 |
categorycode => $categorycode, |
| 32 |
branchcode => $branchcode, |
| 33 |
} |
| 34 |
); |
| 35 |
my $patron = Koha::Patrons->find( $borrower->borrowernumber ); |
| 36 |
|
| 37 |
my $siblings = $patron->siblings; |
| 38 |
isa_ok( $siblings, 'Koha::Patrons' ); |
| 39 |
is( $siblings->count, 0 ); |
| 40 |
|
| 41 |
$schema->txn_rollback; |
| 42 |
}; |