|
Lines 870-876
subtest 'set_or_blank' => sub {
Link Here
|
| 870 |
|
870 |
|
| 871 |
subtest 'messages() and add_message() tests' => sub { |
871 |
subtest 'messages() and add_message() tests' => sub { |
| 872 |
|
872 |
|
| 873 |
plan tests => 6; |
873 |
plan tests => 7; |
|
|
874 |
|
| 875 |
$schema->storage->txn_begin; |
| 874 |
|
876 |
|
| 875 |
my $patron = Koha::Patron->new; |
877 |
my $patron = Koha::Patron->new; |
| 876 |
|
878 |
|
|
Lines 886-890
subtest 'messages() and add_message() tests' => sub {
Link Here
|
| 886 |
is( ref($messages[0]), 'Koha::Object::Message', 'Right type returned' ); |
888 |
is( ref($messages[0]), 'Koha::Object::Message', 'Right type returned' ); |
| 887 |
is( ref($messages[1]), 'Koha::Object::Message', 'Right type returned' ); |
889 |
is( ref($messages[1]), 'Koha::Object::Message', 'Right type returned' ); |
| 888 |
is( $messages[0]->message, 'message_1', 'Right message recorded' ); |
890 |
is( $messages[0]->message, 'message_1', 'Right message recorded' ); |
| 889 |
is( $messages[1]->message, 'message_2', 'Right message recorded' ); |
891 |
|
|
|
892 |
my $patron_id = $builder->build_object({ class => 'Koha::Patrons' })->id; |
| 893 |
# get a patron from the DB, ->new is not called, ->messages should initialize _messages as an empty arrayref |
| 894 |
$patron = Koha::Patrons->find( $patron_id ); |
| 895 |
|
| 896 |
isnt( $patron->messages, undef, '->messages initializes the array if required' ); |
| 897 |
is( scalar @{ $patron->messages }, 0, '->messages returns an empty arrayref' ); |
| 898 |
|
| 899 |
$schema->storage->txn_rollback; |
| 890 |
}; |
900 |
}; |
| 891 |
- |
|
|