Lines 45-57
my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns;
Link Here
|
45 |
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' ); |
45 |
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' ); |
46 |
|
46 |
|
47 |
subtest 'find' => sub { |
47 |
subtest 'find' => sub { |
48 |
plan tests => 2; |
48 |
plan tests => 4; |
49 |
my $patron = $builder->build({source => 'Borrower'}); |
49 |
my $patron = $builder->build({source => 'Borrower'}); |
50 |
my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} ); |
50 |
my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} ); |
51 |
is( $patron_object->borrowernumber, $patron->{borrowernumber}, '->find should return the correct object' ); |
51 |
is( $patron_object->borrowernumber, $patron->{borrowernumber}, '->find should return the correct object' ); |
52 |
|
52 |
|
53 |
eval { my @patrons = Koha::Patrons->find( $patron->{borrowernumber} ); }; |
53 |
eval { my @patrons = Koha::Patrons->find( $patron->{borrowernumber} ); }; |
54 |
like( $@, qr|^Cannot use "->find" in list context|, "->find should not be called in list context to avoid side-effects" ); |
54 |
like( $@, qr|^Cannot use "->find" in list context|, "->find should not be called in list context to avoid side-effects" ); |
|
|
55 |
|
56 |
# Test sending undef to find; should not generate a warning |
57 |
warning_is { $patron = Koha::Patrons->find( undef ); } |
58 |
"", "Sending undef does not trigger a DBIx warning"; |
59 |
warning_is { $patron = Koha::Patrons->find( undef, undef ); } |
60 |
"", "Sending two undefs does not trigger a DBIx warning too"; |
55 |
}; |
61 |
}; |
56 |
|
62 |
|
57 |
subtest 'update' => sub { |
63 |
subtest 'update' => sub { |
58 |
- |
|
|