Spaces:
No application file
No application file
File size: 1,592 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 46 47 48 49 50 |
<?php
declare(strict_types=1);
namespace Mautic\CampaignBundle\Tests\Executioner\Dispatcher;
use Mautic\CampaignBundle\CampaignEvents;
use Mautic\CampaignBundle\Entity\LeadEventLog;
use Mautic\CampaignBundle\Event\ConditionEvent;
use Mautic\CampaignBundle\EventCollector\Accessor\Event\ConditionAccessor;
use Mautic\CampaignBundle\Executioner\Dispatcher\ConditionDispatcher;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class ConditionDispatcherTest extends \PHPUnit\Framework\TestCase
{
/**
* @var MockObject|EventDispatcherInterface
*/
private MockObject $dispatcher;
/**
* @var MockObject|ConditionAccessor
*/
private MockObject $config;
protected function setUp(): void
{
parent::setUp();
$this->dispatcher = $this->createMock(EventDispatcherInterface::class);
$this->config = $this->createMock(ConditionAccessor::class);
}
public function testConditionEventIsDispatched(): void
{
$this->config->expects($this->once())
->method('getEventName')
->willReturn('something');
$this->dispatcher->expects($this->exactly(2))
->method('dispatch')
->withConsecutive(
[$this->isInstanceOf(ConditionEvent::class), 'something'],
[$this->isInstanceOf(ConditionEvent::class), CampaignEvents::ON_EVENT_CONDITION_EVALUATION]
);
(new ConditionDispatcher($this->dispatcher))->dispatchEvent($this->config, new LeadEventLog());
}
}
|