public function testInvalidBodyIsDecodedAsArray()
 {
     $event = $this->getResponseEvent('');
     $listener = new DecodeJsonBodyRequestListener(new ContentTypeMatcher());
     $event->getRequest()->attributes->set('_rest', array('decode_request' => true));
     $listener->onKernelRequest($event);
     $this->assertEquals(array(), $event->getRequest()->request->all());
 }
 public function testRequestBodyIsNotDecodedWhenContentTypeIsSetButEmpty()
 {
     $event = $this->getResponseEvent(json_encode(['test' => true]));
     $listener = new DecodeJsonBodyRequestListener(new ContentTypeMatcher());
     $event->getRequest()->attributes->set('_rest', array('decode_request' => true));
     $event->getRequest()->request->replace(array('beacon' => true));
     $event->getRequest()->headers->set('Content-Type', '', true);
     $listener->onKernelRequest($event);
     $this->assertEquals(array('beacon' => true), $event->getRequest()->request->all());
 }