public function it_displays_forms(ManagerInterface $manager, ActionEventManager $eventManager, ConfigurationInterface $configuration, Request $request, Entity $object, EngineInterface $templating, FormView $formView, Response $response) { $request->isMethod('post')->willReturn(false); $manager->find('entity_class', 'id', [])->willReturn($object); $object->getId()->willReturn('id'); $configuration->getActionOptions('edit')->willReturn(['form_type' => 'form_type']); $configuration->hasAction('delete')->willReturn(false); $templating->renderResponse('PimCustomEntityBundle:CustomEntity:form.html.twig', ['form' => $formView, 'formAction' => 'pim_customentity_edit?&customEntityName=entity&id=id', 'customEntityName' => 'entity', 'baseTemplate' => 'PimCustomEntityBundle::layout.html.twig', 'indexUrl' => 'index?&ir_param1=value1', 'pre_render' => true])->willReturn($response); $this->initializeEventManager($eventManager); $this->setConfiguration($configuration); $this->execute($request)->shouldReturn($response); }
public function testObjectRemoval(ManagerInterface $manager, ActionEventManager $eventManager, ConfigurationInterface $configuration, Request $request, $options, $findOptions) { $object = new \stdClass(); $configuration->getActionOptions('delete')->willReturn($options); $this->setConfiguration($configuration); $manager->find('entity_class', 'id', $findOptions)->willReturn($object); $manager->remove($object)->shouldBeCalled(); $this->initializeEventManager($eventManager); $response = $this->execute($request, $configuration); $response->shouldHaveType('Symfony\\Component\\HttpFoundation\\Response'); $response->getStatusCode()->shouldReturn(204); }