mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Fix manipulator tests
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\Model\Manipulator;
|
||||
|
||||
use Alchemy\Phrasea\Model\Manipulator\WebhookEventManipulator;
|
||||
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
|
||||
use Alchemy\Phrasea\Webhook\WebhookPublisher;
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
@@ -13,7 +14,7 @@ class WebhookEventManipulatorTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testCreate()
|
||||
{
|
||||
$manipulator = new WebhookEventManipulator(self::$DI['app']['orm.em'], self::$DI['app']['repo.webhook-delivery']);
|
||||
$manipulator = $this->createManipulator();
|
||||
$nbEvents = count(self::$DI['app']['repo.webhook-event']->findAll());
|
||||
$event = $manipulator->create(WebhookEvent::NEW_FEED_ENTRY, WebhookEvent::FEED_ENTRY_TYPE, [
|
||||
'feed_id' => self::$DI['feed_public_entry']->getFeed()->getId(), 'entry_id' => self::$DI['feed_public_entry']->getId()
|
||||
@@ -23,7 +24,7 @@ class WebhookEventManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$manipulator = new WebhookEventManipulator(self::$DI['app']['orm.em'], self::$DI['app']['repo.webhook-event']);
|
||||
$manipulator = $this->createManipulator();
|
||||
$event = $manipulator->create(WebhookEvent::NEW_FEED_ENTRY, WebhookEvent::FEED_ENTRY_TYPE, [
|
||||
'feed_id' => self::$DI['feed_public_entry']->getFeed()->getId(), 'entry_id' => self::$DI['feed_public_entry']->getId()
|
||||
]);
|
||||
@@ -34,7 +35,7 @@ class WebhookEventManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testUpdate()
|
||||
{
|
||||
$manipulator = new WebhookEventManipulator(self::$DI['app']['orm.em'], self::$DI['app']['repo.webhook-event']);
|
||||
$manipulator = $this->createManipulator();
|
||||
$event = $manipulator->create(WebhookEvent::NEW_FEED_ENTRY, WebhookEvent::FEED_ENTRY_TYPE, [
|
||||
'feed_id' => self::$DI['feed_public_entry']->getFeed()->getId(), 'entry_id' => self::$DI['feed_public_entry']->getId()
|
||||
]);
|
||||
@@ -46,11 +47,23 @@ class WebhookEventManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testProcessed()
|
||||
{
|
||||
$manipulator = new WebhookEventManipulator(self::$DI['app']['orm.em'], self::$DI['app']['repo.webhook-event']);
|
||||
$manipulator = $this->createManipulator();
|
||||
$event = $manipulator->create(WebhookEvent::NEW_FEED_ENTRY, WebhookEvent::FEED_ENTRY_TYPE, [
|
||||
'feed_id' => self::$DI['feed_public_entry']->getFeed()->getId(), 'entry_id' => self::$DI['feed_public_entry']->getId()
|
||||
]);
|
||||
$manipulator->processed($event);
|
||||
$this->assertTrue($event->isProcessed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebhookEventManipulator
|
||||
*/
|
||||
protected function createManipulator()
|
||||
{
|
||||
return new WebhookEventManipulator(
|
||||
self::$DI['app']['orm.em'],
|
||||
self::$DI['app']['repo.webhook-delivery'],
|
||||
$this->prophesize(WebhookPublisher::class)->reveal()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user