function let(EventDispatcherInterface $dispatcher, Deducer $deducer, LifecycleEventArgs $event, EntityManagerInterface $em, ClassMetadataFactory $factory, ClassMetadataInfo $metadata, UnitOfWork $uow, $entity) { $event->getEntity()->willReturn($entity); $event->getEntityManager()->willReturn($em); $em->getUnitOfWork()->willReturn($uow); $em->getMetadataFactory()->willReturn($factory); $factory->getMetadataFor(Argument::any())->willReturn($metadata); $metadata->getName()->willReturn('App\\Entity\\Model'); $deducer->deduce('App\\Entity\\Model', 'post_persist')->willReturn('app.entity.model.post_persist'); $deducer->deduce('App\\Entity\\Model', 'pre_update')->willReturn('app.entity.model.pre_update'); $deducer->deduce('App\\Entity\\Model', 'post_persist_terminate')->willReturn('app.entity.model.post_persist_terminate'); $this->beConstructedWith($dispatcher, $deducer, []); }
/** * @param string $class * @param string $name * @param DoctrineEvent $event */ private function notify($class, $name, DoctrineEvent $event) { $name = $this->deducer->deduce($class, $name); $this->dispatcher->dispatch($name, $event); }