Author: Kévin Dunglas (dunglas@gmail.com)
Beispiel #1
0
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  */
 public function testRetrieveItemNotFound()
 {
     $collectionDataProvider = $this->prophesize(CollectionDataProviderInterface::class);
     $itemDataProvider = $this->prophesize(ItemDataProviderInterface::class);
     $itemDataProvider->getItem('Foo', 22, 'get')->willReturn(null)->shouldBeCalled();
     $request = new Request([], [], ['id' => 22, '_api_resource_class' => 'Foo', '_api_item_operation_name' => 'get', '_api_format' => 'json', '_api_mime_type' => 'application/json']);
     $request->setMethod(Request::METHOD_GET);
     $event = $this->prophesize(GetResponseEvent::class);
     $event->getRequest()->willReturn($request)->shouldBeCalled();
     $listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal());
     $listener->onKernelRequest($event->reveal());
 }