Lines 772-778
subtest 'Return same values as DBIx::Class' => sub {
Link Here
|
772 |
|
772 |
|
773 |
subtest 'Koha::Objects->update' => sub { |
773 |
subtest 'Koha::Objects->update' => sub { |
774 |
|
774 |
|
775 |
plan tests => 4; |
775 |
plan tests => 6; |
776 |
|
776 |
|
777 |
my ( $r_us, $e_us, $r_them, $e_them ); |
777 |
my ( $r_us, $e_us, $r_them, $e_them ); |
778 |
|
778 |
|
Lines 853-858
subtest 'Return same values as DBIx::Class' => sub {
Link Here
|
853 |
|
853 |
|
854 |
ok( $r_us == 2 && $r_them == 2, '->update should return the number of updated cities' ); |
854 |
ok( $r_us == 2 && $r_them == 2, '->update should return the number of updated cities' ); |
855 |
ok(!defined($e_us) && !defined($e_them)); |
855 |
ok(!defined($e_us) && !defined($e_them)); |
|
|
856 |
|
857 |
throws_ok |
858 |
{ Koha::Cities->update({ city_country => 'Castalia' }); } |
859 |
'Koha::Exceptions::Object::NotInstantiated', |
860 |
'Exception thrown if not instantiated class'; |
861 |
|
862 |
is( "$@", 'Tried to access the \'update\' method, but Koha::Patrons is not instantiated', 'Exception stringified correctly' ); |
863 |
|
856 |
}; |
864 |
}; |
857 |
}; |
865 |
}; |
858 |
|
866 |
|
Lines 1090-1098
subtest 'empty() tests' => sub {
Link Here
|
1090 |
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' ); |
1098 |
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' ); |
1091 |
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); |
1099 |
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); |
1092 |
|
1100 |
|
1093 |
$empty = Koha::Patrons->empty; |
1101 |
throws_ok |
1094 |
is( ref($empty), 'Koha::Patrons', 'without being instantiated, ->empty still returns a Koha::Patrons iterator' ); |
1102 |
{ Koha::Patrons->empty; } |
1095 |
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); |
1103 |
'Koha::Exceptions::Object::NotInstantiated', |
|
|
1104 |
'Exception thrown if not instantiated class'; |
1105 |
|
1106 |
is( "$@", 'Tried to access the \'empty\' method, but Koha::Patrons is not instantiated', 'Exception stringified correctly' ); |
1096 |
|
1107 |
|
1097 |
$schema->storage->txn_rollback; |
1108 |
$schema->storage->txn_rollback; |
1098 |
}; |
1109 |
}; |
1099 |
- |
|
|