Spaces:
No application file
No application file
File size: 1,516 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
<?php
namespace Mautic\LeadBundle\Tests\Event;
use Mautic\LeadBundle\Entity\DoNotContact;
use Mautic\LeadBundle\Entity\Lead;
use Mautic\LeadBundle\Event\ChannelSubscriptionChange;
class ChannelSubscriptionChangeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Tests that getters returns same values as the contstruct
*/
public function testGetterReturnConstruct(): void
{
$lead = new Lead();
$channel = 'email';
$oldStatus = DoNotContact::IS_CONTACTABLE;
$newStatus = DoNotContact::UNSUBSCRIBED;
$event = new ChannelSubscriptionChange($lead, $channel, $oldStatus, $newStatus);
$this->assertEquals($lead, $event->getLead());
$this->assertEquals($channel, $event->getChannel());
$this->assertEquals($oldStatus, $event->getOldStatus());
$this->assertEquals($newStatus, $event->getNewStatus());
$this->assertEquals('contactable', $event->getOldStatusVerb());
$this->assertEquals('unsubscribed', $event->getNewStatusVerb());
}
/**
* @testdox Test that the default verb is unsubscribed if not recongized
*/
public function testGetStatusVerbReturnsUnsubscribedForUnrecognized(): void
{
$lead = new Lead();
$channel = 'email';
$oldStatus = DoNotContact::IS_CONTACTABLE;
$event = new ChannelSubscriptionChange($lead, $channel, $oldStatus, 456);
$this->assertEquals('unsubscribed', $event->getNewStatusVerb());
}
}
|