Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 13; |
20 |
use Test::More tests => 16; |
21 |
use Test::Warn; |
21 |
use Test::Warn; |
22 |
|
22 |
|
23 |
use Koha::Database; |
23 |
use Koha::Database; |
Lines 46-56
ok( ref($ret) eq 'Koha::Borrower', "Set returns object on success" );
Link Here
|
46 |
is( $object2->surname(), "Test Borrower Surname 3", "Set sets first field correctly" ); |
46 |
is( $object2->surname(), "Test Borrower Surname 3", "Set sets first field correctly" ); |
47 |
is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" ); |
47 |
is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" ); |
48 |
|
48 |
|
49 |
$ret = $object->set({ surname => "Test Borrower Surname 4", bork => "bork" }); |
49 |
warning_is { $ret = $object->set({ surname => "Test Borrower Surname 4", bork => "bork" }) } "No property bork!", "Expected 'No property bork!' caught"; |
50 |
is( $object2->surname(), "Test Borrower Surname 3", "Bad Set does not set field" ); |
50 |
is( $object2->surname(), "Test Borrower Surname 3", "Bad Set does not set field" ); |
51 |
is( $ret, 0, "Set returns 0 when passed a bad property" ); |
51 |
is( $ret, 0, "Set returns 0 when passed a bad property" ); |
52 |
|
52 |
|
53 |
ok( ! defined $object->bork(), 'Bad getter returns undef' ); |
53 |
warning_is { $ret = $object->bork() } 'No method bork!', "Expected 'No method bork!' caught for getter."; |
54 |
ok( ! defined $object->bork('bork'), 'Bad setter returns undef' ); |
54 |
ok( ! defined $ret, 'Bad getter returns undef' ); |
|
|
55 |
warning_is { $ret = $object->bork('bork') } 'No method bork!', "Expected 'No method bork!' caught for setter."; |
56 |
ok( ! defined $ret, 'Bad setter returns undef' ); |
55 |
|
57 |
|
56 |
1; |
58 |
1; |
57 |
- |
|
|