Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Jul 16, 2020
1 parent e923290 commit aa0e990
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
28 changes: 28 additions & 0 deletions tests/emails-tests/12-missing-to.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Return-Path: [email protected]
Received: from 192.168.1.3 (LHLO mail.glpi-project.org) (192.168.1.3)
by mail.glpi-project.org with LMTP; Tue, 2 Apr 2019 14:43:12 +0200
(CEST)
Received: from mail.glpi-project.org (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 6F3457E80D1E
for <[email protected]>; Tue, 2 Apr 2019 14:43:12 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 645C77E80D1C
for <[email protected]>; Tue, 2 Apr 2019 14:43:12 +0200 (CEST)
Received: from mail.glpi-project.org ([127.0.0.1])
by localhost (mail.glpi-project.org [127.0.0.1]) (amavisd-new, port 10026)
with ESMTP id POJTfrC8TVrL for <[email protected]>;
Tue, 2 Apr 2019 14:43:12 +0200 (CEST)
Received: from mail.glpi-project.org (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 55AF37E80C20
for <[email protected]>; Tue, 2 Apr 2019 14:43:12 +0200 (CEST)
Date: Tue, 2 Apr 2019 14:43:12 +0200 (CEST)
From: Tech Ni Cian <[email protected]>
Cci: GLPI debug <[email protected]>
Message-ID: <2078889367.1658939.1554208992329.JavaMail.zimbra@glpi-project.org>
Subject: A message without to header
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This message was sent to multiple mailboxes using cci header.

5 changes: 3 additions & 2 deletions tests/imap/MailCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function testCollect() {
$this->doConnect();
$this->collector->maxfetch_emails = 1000; // Be sure to fetch all mails from test suite
$msg = $this->collector->collect($this->mailgate_id);
$this->variable($msg)->isIdenticalTo('Number of messages: available=12, retrieved=12, refused=2, errors=1, blacklisted=0');
$this->variable($msg)->isIdenticalTo('Number of messages: available=13, retrieved=13, refused=2, errors=1, blacklisted=0');
$rejecteds = iterator_to_array($DB->request(['FROM' => \NotImportedEmail::getTable()]));

$this->array($rejecteds)->hasSize(2);
Expand Down Expand Up @@ -286,7 +286,7 @@ public function testCollect() {
]
]);

$this->integer(count($iterator))->isIdenticalTo(4);
$this->integer(count($iterator))->isIdenticalTo(5);
$names = [];
while ($data = $iterator->next()) {
$names[] = $data['name'];
Expand All @@ -297,6 +297,7 @@ public function testCollect() {
'Re: [GLPI #0001155] New ticket database issue',
'Ticket with observer',
'Re: [GLPI #0038927] Update - Issues with new Windows 10 machine',
'A message without to header',
];
$this->array($names)->isIdenticalTo($expected_names);

Expand Down

0 comments on commit aa0e990

Please sign in to comment.