2021-08-29 13:58:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature;
|
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
2021-08-29 13:58:12 +00:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
2022-11-13 13:29:55 +00:00
|
|
|
use App\Classes\File;
|
2024-05-20 11:31:21 +00:00
|
|
|
use App\Classes\FTN\Packet;
|
|
|
|
use App\Models\{Address,Domain,Echomail,System,Zone};
|
2021-08-29 13:58:12 +00:00
|
|
|
|
|
|
|
class PacketTest extends TestCase
|
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
//private System $so;
|
2021-08-29 13:58:12 +00:00
|
|
|
private Domain $do;
|
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
private function init_fidonet(): void
|
2021-08-29 13:58:12 +00:00
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$do = new Domain;
|
|
|
|
$do->active = TRUE;
|
|
|
|
$do->name = 'fidonet';
|
|
|
|
$do->flatten = TRUE;
|
|
|
|
$do->save();
|
|
|
|
|
|
|
|
$zo = new Zone;
|
|
|
|
$zo->zone_id = 1;
|
|
|
|
$zo->active = TRUE;
|
|
|
|
$zo->system_id = 2;
|
|
|
|
$zo->default = TRUE;
|
|
|
|
$do->zones()->save($zo);
|
|
|
|
|
|
|
|
$zo = new Zone;
|
|
|
|
$zo->zone_id = 2;
|
|
|
|
$zo->active = TRUE;
|
|
|
|
$zo->system_id = 3;
|
|
|
|
$zo->default = TRUE;
|
|
|
|
$do->zones()->save($zo);
|
|
|
|
|
|
|
|
$zo = new Zone;
|
|
|
|
$zo->zone_id = 3;
|
|
|
|
$zo->active = TRUE;
|
|
|
|
$zo->system_id = 1;
|
|
|
|
$zo->default = TRUE;
|
|
|
|
$do->zones()->save($zo);
|
|
|
|
|
|
|
|
Address::createFTN('3:633/280@fidonet',System::findOrFail(1));
|
|
|
|
Address::createFTN('3:633/2744@fidonet',System::findOrFail(2));
|
|
|
|
|
|
|
|
$this->do = $do;
|
2021-08-29 13:58:12 +00:00
|
|
|
}
|
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
private function init_fsxnet(): void
|
2023-11-22 03:36:06 +00:00
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$do = new Domain;
|
|
|
|
$do->active = TRUE;
|
|
|
|
$do->name = 'fsxnet';
|
|
|
|
$do->flatten = TRUE;
|
|
|
|
$do->save();
|
|
|
|
|
|
|
|
$zo = new Zone;
|
|
|
|
$zo->zone_id = 21;
|
|
|
|
$zo->active = TRUE;
|
|
|
|
$zo->system_id = 1;
|
|
|
|
$zo->default = TRUE;
|
|
|
|
$do->zones()->save($zo);
|
|
|
|
|
|
|
|
Address::createFTN('21:3/100@fsxnet',System::findOrFail(2));
|
|
|
|
Address::createFTN('21:3/2744@fsxnet',System::findOrFail(3));
|
|
|
|
Address::createFTN('21:3/184@fsxnet',System::findOrFail(4));
|
|
|
|
|
|
|
|
$this->do = $do;
|
2023-11-22 03:36:06 +00:00
|
|
|
}
|
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
private function init_private(): void
|
|
|
|
{
|
|
|
|
$do = new Domain;
|
|
|
|
$do->active = TRUE;
|
|
|
|
$do->name = 'private';
|
|
|
|
$do->flatten = TRUE;
|
|
|
|
$do->save();
|
|
|
|
|
|
|
|
$zo = new Zone;
|
|
|
|
$zo->zone_id = 10;
|
|
|
|
$zo->active = TRUE;
|
|
|
|
$zo->system_id = 1;
|
|
|
|
$zo->default = TRUE;
|
|
|
|
$do->zones()->save($zo);
|
|
|
|
|
|
|
|
Address::createFTN('10:1/1@private',System::findOrFail(3));
|
|
|
|
Address::createFTN('10:1/2@private',System::findOrFail(4));
|
|
|
|
|
|
|
|
$this->do = $do;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function mail_file(string $file)
|
2021-08-29 13:58:12 +00:00
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$fs = Storage::disk(config('fido.local_disk'));
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
return new File($fs->path(sprintf('%s/%s',config('fido.dir'),$file)));
|
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
public function test_packet_1()
|
|
|
|
{
|
|
|
|
$this->init_fidonet();
|
|
|
|
|
|
|
|
$f = $this->mail_file('mail/018A-1702393055-78754407.pkt');
|
|
|
|
|
|
|
|
foreach ($f as $packet) {
|
2024-11-25 02:46:16 +00:00
|
|
|
$pkt = Packet::process($packet,$x=$f->itemName(),$f->itemSize());
|
2023-12-13 12:00:47 +00:00
|
|
|
|
|
|
|
$this->assertInstanceOf(Packet\FSC39::class,$pkt);
|
|
|
|
$this->assertEquals('ABCDEFGH',$pkt->password);
|
|
|
|
$this->assertEquals(1,count($pkt));
|
|
|
|
$this->assertEquals('3634/27 12 154/10 221/6 218/840 770/1 633/280',$pkt->messages[0]->path[0]);
|
|
|
|
$this->assertEquals('1/120 18/0 116/116 120/616 123/0 10 25 126 160 180 200 525 755 3001',$pkt->messages[0]->seenby[0]);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals(' * Origin: *The Gate BBS*Shelby, NC USA*thegateb.synchro.net* (1:3634/27)',$pkt->messages[0]->origin);
|
|
|
|
$this->assertEquals('1:3634/27.0@fidonet',$pkt->messages[0]->fftn->ftn);
|
|
|
|
$this->assertEquals('3:633/2744.0@fidonet',$pkt->tftn->ftn);
|
|
|
|
$this->assertEquals('Gate Keeper',$pkt->messages[0]->from);
|
|
|
|
$this->assertEquals('Meitsi',$pkt->messages[0]->to);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('Status of HAM radio in FidoNet',$pkt->messages[0]->subject);
|
|
|
|
$this->assertEquals('275.fidonet_ham@1:3634/27 29ddab74',$pkt->messages[0]->msgid);
|
|
|
|
$this->assertEquals('1:229/428 012c0322',$pkt->messages[0]->replyid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals('93a956cbde8b1215f4cf67e514116487',md5($pkt->messages[0]->content));
|
|
|
|
$this->assertEquals('93a956cbde8b1215f4cf67e514116487',$pkt->messages[0]->msg_crc);
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_packet_2()
|
|
|
|
{
|
|
|
|
$this->init_fidonet();
|
|
|
|
|
|
|
|
$f = $this->mail_file('mail/018A-1701955391-71c7a400.pkt');
|
|
|
|
|
|
|
|
foreach ($f as $packet) {
|
2024-11-25 02:46:16 +00:00
|
|
|
$pkt = Packet::process($packet,$x=$f->itemName(),$f->itemSize());
|
2023-12-13 12:00:47 +00:00
|
|
|
|
|
|
|
$this->assertInstanceOf(Packet\FSC39::class,$pkt);
|
|
|
|
$this->assertEquals('ABCDEFGH',$pkt->password);
|
|
|
|
$this->assertEquals(43,count($pkt));
|
|
|
|
$this->assertEquals('229/664 426 633/280',$pkt->messages[0]->path[0]);
|
|
|
|
$this->assertEquals('15/0 106/201 128/260 129/305 153/7715 218/700 221/6 226/30 227/114',$pkt->messages[0]->seenby[0]);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals(' * Origin: Northern Realms (1:229/664)',$pkt->messages[0]->origin);
|
|
|
|
$this->assertEquals('1:229/664.0@fidonet',$pkt->messages[0]->fftn->ftn);
|
|
|
|
$this->assertEquals('3:633/2744.0@fidonet',$pkt->tftn->ftn);
|
|
|
|
$this->assertEquals('Northern Realms',$pkt->messages[0]->from);
|
|
|
|
$this->assertEquals('All',$pkt->messages[0]->to);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('NYPost Daily Horoscope',$pkt->messages[0]->subject);
|
|
|
|
$this->assertEquals('1:229/664 56db6f89',$pkt->messages[0]->msgid);
|
|
|
|
$this->assertEquals('',$pkt->messages[0]->replyid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals('ad761cfc02d87383056cc29e026b3d57',md5($pkt->messages[0]->content));
|
|
|
|
$this->assertEquals('ad761cfc02d87383056cc29e026b3d57',$pkt->messages[0]->msg_crc);
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_packet_3()
|
|
|
|
{
|
|
|
|
$this->init_fsxnet();
|
|
|
|
|
|
|
|
$f = $this->mail_file('mail/0B39-1701919239-65713a06.pkt');
|
|
|
|
|
|
|
|
foreach ($f as $packet) {
|
2024-11-25 02:46:16 +00:00
|
|
|
$pkt = Packet::process($packet,$x=$f->itemName(),$f->itemSize());
|
2023-12-13 12:00:47 +00:00
|
|
|
|
|
|
|
$this->assertInstanceOf(Packet\FSC48::class,$pkt);
|
|
|
|
$this->assertEquals('ABCDEFG#',$pkt->password);
|
|
|
|
$this->assertEquals(4,count($pkt));
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$pkt->messages[0]);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('3/165 100 184',$pkt->messages[0]->path[0]);
|
|
|
|
$this->assertEquals('1/100 179 2/100 116 3/100 105 107 108 109 110 111 113 119 120 126 127',$pkt->messages[0]->seenby[0]);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals(' * Origin: www.theunderground.us Telnet 10023 SSH 7771 (21:3/165)',$pkt->messages[0]->origin);
|
|
|
|
$this->assertEquals('21:3/165.0@fsxnet',$pkt->messages[0]->fftn->ftn);
|
|
|
|
$this->assertEquals('21:3/2744.0@fsxnet',$pkt->tftn->ftn);
|
|
|
|
$this->assertEquals('ibbslastcall',$pkt->messages[0]->from);
|
|
|
|
$this->assertEquals('All',$pkt->messages[0]->to);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('ibbslastcall-data',$pkt->messages[0]->subject);
|
|
|
|
$this->assertEquals('21:3/165 6b42fe09',$pkt->messages[0]->msgid);
|
|
|
|
$this->assertEquals('',$pkt->messages[0]->replyid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals('413eb972809e1ce8ac5f5cf7b545fc10',md5($pkt->messages[0]->content));
|
|
|
|
$this->assertEquals('413eb972809e1ce8ac5f5cf7b545fc10',$pkt->messages[0]->msg_crc);
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_nomsgid_origin()
|
|
|
|
{
|
|
|
|
$this->init_private();
|
|
|
|
|
2024-05-20 11:31:21 +00:00
|
|
|
// @note this pkt is from/to a sender not defined
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_nomsgid_origin.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2023-09-14 22:09:42 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertInstanceOf(Packet\FSC39::class,$pkt);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertEquals(1,$pkt->count());
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($pkt as $msg) {
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
|
|
|
$this->assertEquals('PVT_TEST',$msg->set->get('set_echoarea'));
|
2022-11-13 13:29:55 +00:00
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('1/1 999/1',$pkt->messages[0]->path[0]);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals(' * Origin: Daytona BBS (Netherlands) (10:3/151)',$pkt->messages[0]->origin);
|
|
|
|
$this->assertEquals('10:3/151.0@private',$pkt->messages[0]->set->get('set_fftn'));
|
|
|
|
$this->assertEquals('10:999/999.0@private',$pkt->tftn_t);
|
|
|
|
$this->assertEquals('Hub Robot',$pkt->messages[0]->from);
|
|
|
|
$this->assertEquals('Henk Hilgersum',$pkt->messages[0]->to);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('LEMEIN',$pkt->messages[0]->subject);
|
|
|
|
$this->assertEquals('',$pkt->messages[0]->msgid);
|
|
|
|
$this->assertEquals('',$pkt->messages[0]->replyid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals('a5933ea2bbcddf955d6940e1dad5cc1b',md5($pkt->messages[0]->content));
|
|
|
|
$this->assertEquals('a5933ea2bbcddf955d6940e1dad5cc1b',$pkt->messages[0]->msg_crc);
|
2022-11-13 13:29:55 +00:00
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
}
|
|
|
|
|
2023-09-20 10:29:23 +00:00
|
|
|
/*
|
|
|
|
* @todo We are not correctly setup to parse messages without an origin line
|
2021-08-29 13:58:12 +00:00
|
|
|
public function test_nomsgid_noorigin()
|
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->init_private();
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-09-20 10:29:23 +00:00
|
|
|
// This packet has no Origin Line
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_nomsgid_noorigin.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2023-09-20 10:29:23 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize(),$this->do);
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertInstanceOf(Packet\FSC39::class,$pkt);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertEquals(1,$pkt->count());
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($pkt as $msg) {
|
2023-12-13 12:00:47 +00:00
|
|
|
dump($msg);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
2023-09-15 12:57:32 +00:00
|
|
|
$this->assertNotFalse($msg->path->search('1/1 999/1'));
|
2023-09-20 10:29:23 +00:00
|
|
|
$this->assertNotFalse($msg->seenby->search('1/1 4 3/0 999/1 999'));
|
2022-11-13 13:29:55 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
}
|
2023-09-20 10:29:23 +00:00
|
|
|
*/
|
2021-08-29 13:58:12 +00:00
|
|
|
|
|
|
|
public function test_msgid_origin()
|
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->init_private();
|
2021-08-29 13:58:12 +00:00
|
|
|
|
|
|
|
// This packet has an incorrect zone in the Origin
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_msgid_origin.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2024-11-25 02:46:16 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertInstanceOf(Packet\FSC39::class,$pkt);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertEquals(1,$pkt->count());
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($pkt as $msg) {
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
|
|
|
$this->assertEquals('PVT_TEST',$msg->set->get('set_echoarea'));
|
2023-09-20 10:29:23 +00:00
|
|
|
$this->assertNotFalse($msg->seenby->search('1/1 999/1 999'));
|
2022-11-13 13:29:55 +00:00
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('999/1',$pkt->messages[0]->path[0]);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals(' * Origin: Alterant MailHUB at your service (10:999/1)',$pkt->messages[0]->origin);
|
|
|
|
$this->assertEquals('10:999/1.0@private',$pkt->messages[0]->set->get('set_fftn'));
|
|
|
|
$this->assertEquals('10:999/999.0@private',$pkt->tftn_t);
|
|
|
|
$this->assertEquals('Hub Robot',$pkt->messages[0]->from);
|
|
|
|
$this->assertEquals('deon',$pkt->messages[0]->to);
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->assertEquals('Hub Robot Report',$pkt->messages[0]->subject);
|
|
|
|
$this->assertEquals('10:999/1 612aecda',$pkt->messages[0]->msgid);
|
|
|
|
$this->assertEquals('',$pkt->messages[0]->replyid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertEquals('354e42649bc4e6aea5f0833ce5ad43c5',md5($pkt->messages[0]->content));
|
|
|
|
$this->assertEquals('354e42649bc4e6aea5f0833ce5ad43c5',$pkt->messages[0]->msg_crc);
|
2022-11-13 13:29:55 +00:00
|
|
|
}
|
2021-08-29 13:58:12 +00:00
|
|
|
}
|
2021-11-28 03:02:50 +00:00
|
|
|
|
2023-12-13 12:00:47 +00:00
|
|
|
public function test_soh_char_soa()
|
2021-11-28 03:02:50 +00:00
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->init_fsxnet();
|
2023-09-20 10:29:23 +00:00
|
|
|
|
2021-11-28 13:12:37 +00:00
|
|
|
// This packet has a SOH<char>SOH sequence
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_binary_content-2.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2024-11-25 02:46:16 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2022-11-13 13:29:55 +00:00
|
|
|
|
|
|
|
$this->assertEquals(1,$pkt->count());
|
|
|
|
|
|
|
|
$messages = FALSE;
|
|
|
|
foreach ($pkt as $msg) {
|
|
|
|
$messages = TRUE;
|
|
|
|
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$pkt->messages[0]);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertSame('21:1/151 6189F64C',$msg->msgid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertSame('1fe499b444ba7e391fbb4f1bc8a18ac1',md5($msg->content));
|
|
|
|
$this->assertSame('1fe499b444ba7e391fbb4f1bc8a18ac1',$msg->msg_crc);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertContains('3/2744 4/100 106 5/100',$msg->seenby);
|
|
|
|
$this->assertContains('1/151 100 3/100',$msg->path);
|
|
|
|
$this->assertCount(11,$msg->seenby);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->assertTrue($messages);
|
2021-11-28 13:12:37 +00:00
|
|
|
}
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function test_soh_message()
|
|
|
|
{
|
|
|
|
$this->init_fsxnet();
|
2021-11-28 13:12:37 +00:00
|
|
|
|
|
|
|
// This packet has SOH in the message content
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_binary_content.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2023-09-14 22:09:42 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2022-11-13 13:29:55 +00:00
|
|
|
|
|
|
|
$this->assertEquals(1,$pkt->count());
|
|
|
|
|
|
|
|
$messages = FALSE;
|
|
|
|
foreach ($pkt as $msg) {
|
|
|
|
$messages = TRUE;
|
|
|
|
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertSame('21:1/126 eec6e958',$msg->msgid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertSame('a354ed6afcb436081e123e12dc0c8764',md5($msg->content));
|
|
|
|
$this->assertSame('a354ed6afcb436081e123e12dc0c8764',$msg->msg_crc);
|
2022-11-13 13:29:55 +00:00
|
|
|
$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->assertTrue($messages);
|
2021-11-28 03:02:50 +00:00
|
|
|
}
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function test_bad_zone()
|
|
|
|
{
|
|
|
|
$this->init_private();
|
2021-11-28 03:02:50 +00:00
|
|
|
|
|
|
|
// This packet has an incorrect zone in the Origin
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_msgid_origin.pkt');
|
2022-11-13 13:29:55 +00:00
|
|
|
foreach ($f as $packet) {
|
2023-09-14 22:09:42 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2022-11-13 13:29:55 +00:00
|
|
|
|
|
|
|
$this->assertEquals(1,$pkt->count());
|
|
|
|
|
|
|
|
$messages = FALSE;
|
|
|
|
foreach ($pkt as $msg) {
|
|
|
|
$messages = TRUE;
|
|
|
|
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertSame('10:999/1 612aecda',$msg->msgid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertSame('354e42649bc4e6aea5f0833ce5ad43c5',md5($msg->content));
|
|
|
|
$this->assertSame('354e42649bc4e6aea5f0833ce5ad43c5',$msg->msg_crc);
|
2022-11-13 13:29:55 +00:00
|
|
|
$this->assertContains('1/1 999/1 999',$msg->seenby);
|
|
|
|
$this->assertContains('999/1',$msg->path);
|
|
|
|
$this->assertCount(1,$msg->seenby);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->assertTrue($messages);
|
2021-11-28 03:02:50 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-04 12:06:29 +00:00
|
|
|
|
|
|
|
public function test_soh_in_origin()
|
|
|
|
{
|
2023-12-13 12:00:47 +00:00
|
|
|
$this->init_fidonet();
|
2023-09-15 12:57:32 +00:00
|
|
|
|
2023-08-04 12:06:29 +00:00
|
|
|
// This packet has a SOH<char>SOH sequence
|
2023-12-13 12:00:47 +00:00
|
|
|
$f = $this->mail_file('mail/test_msg_with_soh_in_origin.pkt');
|
2023-08-04 12:06:29 +00:00
|
|
|
foreach ($f as $packet) {
|
2023-09-14 22:09:42 +00:00
|
|
|
$pkt = Packet::process($packet,$f->itemName(),$f->itemSize());
|
2023-08-04 12:06:29 +00:00
|
|
|
|
|
|
|
$this->assertEquals(9,$pkt->count());
|
|
|
|
|
|
|
|
$messages = FALSE;
|
|
|
|
$c = 0;
|
|
|
|
foreach ($pkt as $msg) {
|
|
|
|
$c++;
|
|
|
|
$messages = TRUE;
|
|
|
|
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertInstanceOf(Echomail::class,$msg);
|
2023-08-04 12:06:29 +00:00
|
|
|
|
|
|
|
switch ($c) {
|
|
|
|
case 1:
|
|
|
|
$this->assertSame('3:712/886 220da89f',$msg->msgid);
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertSame('49caf318b7bebedc652f31622d014430',md5($msg->content));
|
|
|
|
$this->assertSame('49caf318b7bebedc652f31622d014430',$msg->msg_crc);
|
2023-08-04 12:06:29 +00:00
|
|
|
$this->assertContains('633/0 267 280 281 408 410 412 509 509 640/1384 712/114 550 620 848',$msg->seenby);
|
|
|
|
$this->assertContains('712/886 848 633/280',$msg->path);
|
|
|
|
$this->assertCount(2,$msg->seenby);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2024-05-20 11:31:21 +00:00
|
|
|
$this->assertNull($msg->msgid);
|
|
|
|
$this->assertSame('514205c1670312887a68272b21df593c',md5($msg->content));
|
|
|
|
$this->assertSame('514205c1670312887a68272b21df593c',$msg->msg_crc);
|
2023-08-04 12:06:29 +00:00
|
|
|
$this->assertContains('633/267 280 281 384 408 410 412 418 420 509 509 712/848 770/1 100 330',$msg->seenby);
|
|
|
|
$this->assertContains('772/210 770/1 633/280',$msg->path);
|
|
|
|
$this->assertCount(2,$msg->seenby);
|
|
|
|
|
|
|
|
default:
|
|
|
|
continue 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->assertTrue($messages);
|
|
|
|
}
|
|
|
|
}
|
2023-12-13 12:00:47 +00:00
|
|
|
}
|