Fix for when packets contain binary messages with SOH chars. Added testing for packet parsing
This commit is contained in:
@@ -115,4 +115,55 @@ class PacketTest extends TestCase
|
||||
|
||||
$this->assertTrue($messages);
|
||||
}
|
||||
|
||||
public function test_packet_parse()
|
||||
{
|
||||
// This packet has an incorrect zone in the Origin
|
||||
$f = new File(__DIR__.'/data/test_binary_content.pkt');
|
||||
$pkt = Packet::open($f,NULL,FALSE);
|
||||
|
||||
$this->assertEquals(1,$pkt->count());
|
||||
|
||||
$messages = FALSE;
|
||||
foreach ($pkt as $msg) {
|
||||
$messages = TRUE;
|
||||
|
||||
$this->assertNotTrue($msg->isNetmail());
|
||||
$this->assertSame('21:1/126 eec6e958',$msg->msgid);
|
||||
$this->assertSame('5a525cc1c393292dc65160a852d4d615',md5($msg->message));
|
||||
$this->assertSame('a3193edcc68521d4ed07da6db2aeb0b6',md5($msg->message_src));
|
||||
$this->assertCount(3,$msg->rogue_path);
|
||||
$this->assertCount(161,$msg->rogue_seen);
|
||||
$this->assertContains('1/995 2/100 116 1202 3/100 105 107 108 109 110 111 112 113 117 119',$msg->seenby);
|
||||
$this->assertContains('1/126 100 3/100',$msg->path);
|
||||
$this->assertCount(10,$msg->seenby);
|
||||
$this->assertCount(0,$msg->unknown);
|
||||
}
|
||||
|
||||
$this->assertTrue($messages);
|
||||
|
||||
// This packet has an incorrect zone in the Origin
|
||||
$f = new File(__DIR__.'/data/test_msgid_origin.pkt');
|
||||
$pkt = Packet::open($f,NULL,FALSE);
|
||||
|
||||
$this->assertEquals(1,$pkt->count());
|
||||
|
||||
$messages = FALSE;
|
||||
foreach ($pkt as $msg) {
|
||||
$messages = TRUE;
|
||||
|
||||
$this->assertNotTrue($msg->isNetmail());
|
||||
$this->assertSame('10:999/1 612aecda',$msg->msgid);
|
||||
$this->assertSame('61078e680cda04c8b5eba0f712582e70',md5($msg->message));
|
||||
$this->assertSame('b9d65d4f7319ded282f3f1986276ae79',md5($msg->message_src));
|
||||
$this->assertCount(1,$msg->pathaddress);
|
||||
$this->assertCount(2,$msg->rogue_seen);
|
||||
$this->assertContains('1/1 999/1 999',$msg->seenby);
|
||||
$this->assertContains('999/1',$msg->path);
|
||||
$this->assertCount(1,$msg->seenby);
|
||||
$this->assertCount(0,$msg->unknown);
|
||||
}
|
||||
|
||||
$this->assertTrue($messages);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user