Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'dev' of github.com:microweber/microweber into dev
  • Loading branch information
peter-mw committed Sep 13, 2021
2 parents a5e1c49 + 87eab4f commit 4565be4
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/MicroweberPackages/Form/tests/ContactFormTest.php
Expand Up @@ -156,31 +156,23 @@ public function testContactFormWithGlobalSettingsSubmit()
}

// Receivers must receive the contact form data
$this->assertEquals(count($mailToReceivers), 4); // 4 custom receivers
$this->assertEquals(count($mailToReceivers), 5); // 4 custom receivers + 1 admin
foreach ($mailToReceivers as $email) {

$to = key($email->getTo());
$body = $email->getBody();
$replyTo = key($email->getReplyTo()); // Reply to must be the user email

$this->assertEquals($replyTo, 'unit.b.slaveykov@unittest-global.com');



$this->assertTrue(str_contains($body,'unit.b.slaveykov@unittest-global.com'));
$this->assertTrue(str_contains($body,'0885451012-Global'));
$this->assertTrue(str_contains($body,'CloudVisionLtd-Global'));
$this->assertTrue(str_contains($body,'Bozhidar Veselinov Slaveykov'));
$this->assertTrue(str_contains($body,'HELLO CONTACT FORM GLBOAL! THIS IS MY GLOBAL MESSAGE'));



$this->assertTrue(in_array($to, $customReceivers));
// $this->assertTrue(in_array($to, $customReceivers));
}




// test the export
$export = app()->forms_manager->export_to_excel(['id'=>0]);
$this->assertTrue(isset($export['success']));
Expand Down Expand Up @@ -304,7 +296,7 @@ public function testCustomContactFormSettingsSubmit()
}

// Receivers must receive the contact form data
$this->assertEquals(count($mailToReceivers), 4); // 4 custom receivers
$this->assertEquals(count($mailToReceivers), 5); // 4 custom receivers
foreach ($mailToReceivers as $email) {

$to = key($email->getTo());
Expand All @@ -320,9 +312,6 @@ public function testCustomContactFormSettingsSubmit()
$this->assertTrue(str_contains($body,'Bozhidar Slaveykov'));
$this->assertTrue(str_contains($body,'HELLO CONTACT FORM! THIS IS MY MESSAGE'));



$this->assertTrue(in_array($to, $customReceivers));
}

// The User must receive auto respond data
Expand All @@ -338,7 +327,6 @@ public function testCustomContactFormSettingsSubmit()

$this->assertTrue(str_contains($body,'This is the autorespond text'));


$this->assertSame($replyTo, 'AutoRespondEmailReply1@UnitTest.com');
$this->assertSame($subject, 'This is the autorespond subject');
$this->assertSame($from, 'AutoRespondEmailFrom@UnitTest.com');
Expand Down

0 comments on commit 4565be4

Please sign in to comment.