1# -- 2# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/ 3# -- 4# This software comes with ABSOLUTELY NO WARRANTY. For details, see 5# the enclosed file COPYING for license information (GPL). If you 6# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt. 7# -- 8 9use strict; 10use warnings; 11use utf8; 12 13use vars (qw($Self)); 14 15use Kernel::System::EmailParser; 16 17my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home'); 18 19# test for bug#9989 20my @Array; 21open my $IN, '<', "$Home/scripts/test/sample/EmailParser/EmptyEmail.eml"; ## no critic 22while (<$IN>) { 23 push @Array, $_; 24} 25close $IN; 26 27# create local object 28my $EmailParserObject = Kernel::System::EmailParser->new( 29 Email => \@Array, 30); 31 32my @Attachments = $EmailParserObject->GetAttachments(); 33$Self->Is( 34 scalar @Attachments, 35 2, 36 "Attachments", 37); 38 39$Self->Is( 40 $Attachments[0]->{Filename}, 41 'file-1', 42 "Empty body name", 43); 44 45$Self->Is( 46 $Attachments[0]->{Filesize}, 47 '0', 48 "Empty body size", 49); 50 51$Self->Is( 52 $Attachments[1]->{Filename}, 53 'Łatwa_sprawa.txt', 54 "Empty attachment name", 55); 56 57$Self->Is( 58 $Attachments[1]->{Filesize}, 59 '0', 60 "Empty attachment size", 61); 62 631; 64