mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 09:05:01 +00:00
Fix some tests
This commit is contained in:
@@ -18,7 +18,10 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -35,14 +38,17 @@ final class PersistNotificationOnTerminateEventSubscriberTest extends TestCase
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
||||
$em->flush()->shouldBeCalledTimes(1);
|
||||
$event = $this->prophesize(TerminateEvent::class);
|
||||
$event->isMainRequest()->willReturn(true);
|
||||
$event = new TerminateEvent(
|
||||
$this->prophesize(HttpKernelInterface::class)->reveal(),
|
||||
new Request(),
|
||||
new Response()
|
||||
);
|
||||
|
||||
$eventSubscriber = new PersistNotificationOnTerminateEventSubscriber($em->reveal(), $persister);
|
||||
|
||||
$notification = new Notification();
|
||||
$persister->persist($notification);
|
||||
|
||||
$eventSubscriber->onKernelTerminate($event->reveal());
|
||||
$eventSubscriber->onKernelTerminate($event);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user