View | Details | Raw Unified | Return to bug 17970
Collapse All | Expand All

(-)a/t/db_dependent/Letters.t (-2 / +40 lines)
Lines 18-24 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 79;
21
use Test::More tests => 80;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 47-52 use Koha::Acquisition::Order; Link Here
47
use Koha::Acquisition::Booksellers;
47
use Koha::Acquisition::Booksellers;
48
use Koha::Acquisition::Bookseller::Contacts;
48
use Koha::Acquisition::Bookseller::Contacts;
49
use Koha::Libraries;
49
use Koha::Libraries;
50
use Koha::Notice::Templates;
50
my $schema = Koha::Database->schema;
51
my $schema = Koha::Database->schema;
51
$schema->storage->txn_begin();
52
$schema->storage->txn_begin();
52
53
Lines 439-444 warning_like { Link Here
439
is($err->{'error'}, 'no_letter', "No TESTACQORDER letter was defined.");
440
is($err->{'error'}, 'no_letter', "No TESTACQORDER letter was defined.");
440
}
441
}
441
442
443
subtest 'GetPreparedLetter' => sub {
444
    plan tests => 4;
445
446
    Koha::Notice::Template->new(
447
        {
448
            module                 => 'test',
449
            code                   => 'test',
450
            branchcode             => '',
451
            message_transport_type => 'email'
452
        }
453
    )->store;
454
    my $letter;
455
    warning_like {
456
        $letter = C4::Letters::GetPreparedLetter(
457
            module      => 'test',
458
            letter_code => 'test',
459
        );
460
    }
461
    qr{^ERROR: nothing to substitute},
462
'GetPreparedLetter should warn if tables, substiture and repeat are not set';
463
    is( $letter, undef,
464
'No letter should be returned by GetPreparedLetter if something went wrong'
465
    );
466
467
    warning_like {
468
        $letter = C4::Letters::GetPreparedLetter(
469
            module      => 'test',
470
            letter_code => 'test',
471
            substitute  => {}
472
        );
473
    }
474
    qr{^ERROR: nothing to substitute},
475
'GetPreparedLetter should warn if tables, substiture and repeat are not set, even if the key is passed';
476
    is( $letter, undef,
477
'No letter should be returned by GetPreparedLetter if something went wrong'
478
    );
479
480
};
442
481
443
{
482
{
444
warning_is {
483
warning_is {
445
- 

Return to bug 17970