X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=t%2Fdb_dependent%2FKoha%2FLibraries.t;h=48a258dc7a6779bd133b6e3fffdc444930b27e18;hb=a7c202de1c97438a32b86a309a449e7c427f77d3;hp=b66fa89d63b99af7504c330eeade848af3e7c5d9;hpb=7293802becd3741a1f042f233ff614792c9e480f;p=koha-ffzg.git diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t index b66fa89d63..48a258dc7a 100755 --- a/t/db_dependent/Koha/Libraries.t +++ b/t/db_dependent/Koha/Libraries.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 11; +use Test::More tests => 12; use C4::Biblio; use C4::Context; @@ -119,6 +119,36 @@ subtest '->get_effective_marcorgcode' => sub { $schema->storage->txn_rollback; }; +subtest '->from_email_address' => sub { + + plan tests => 3; + + $schema->storage->txn_begin; + + my $library_1 = $builder->build_object( + { + class => 'Koha::Libraries', + value => { + branchemail => 'from@mybranc.com', + } + } + ); + + t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'admin@mylibrary.com' ); + + is( $library_1->from_email_address, $library_1->branchemail, + 'If defined, use branches branchemail address'); + + $library_1->branchemail(undef)->store(); + is( $library_1->from_email_address, 'admin@mylibrary.com', + 'Fallback to KohaAdminEmailAddress email address when branchemail is undefined'); + + t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', '' ); + is( $library_1->from_email_address, undef, + 'Return undef when branchemail and KohaAdminEmailAddress are both undefined'); + $schema->storage->txn_rollback; +}; + subtest '->inbound_email_address' => sub { plan tests => 5;