Skip to content

Commit 1870e18

Browse files
committed
removed test
1 parent 9d3fdeb commit 1870e18

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

Tests/View/ViewHandlerTest.php

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use FOS\RestBundle\View\ViewHandler;
1717
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
1818
use FOS\Rest\Util\Codes;
19-
use Symfony\Component\DependencyInjection\Container;
2019
use Symfony\Component\HttpFoundation\Request;
2120
use Symfony\Component\HttpFoundation\Response;
2221
use Symfony\Component\Form\FormView;
@@ -289,58 +288,6 @@ function ($method) use ($serializer) {
289288
->will($this->returnValueMap($map));
290289
}
291290

292-
public function testShouldReturnErrorResponseWhenDataContainsFormAndFormIsNotValid()
293-
{
294-
$container = new Container();
295-
296-
$serializer = $this->getMock('JMS\Serializer\Serializer', array(), array(), '', false);
297-
$serializer
298-
->expects($this->once())
299-
->method('serialize')
300-
->will(
301-
$this->returnCallback(
302-
function ($data) {
303-
return serialize($data);
304-
}
305-
)
306-
);
307-
308-
$container->set('fos_rest.serializer', $serializer);
309-
$container->set('fos_rest.view.exception_wrapper_handler', new ExceptionWrapperHandler());
310-
$container->setParameter('fos_rest.serializer.exclusion_strategy.groups', 'foo');
311-
$container->setParameter('fos_rest.serializer.exclusion_strategy.version', '1.0');
312-
$container->setParameter('fos_rest.serializer.serialize_null', false);
313-
314-
//test
315-
$viewHandler = new ViewHandler(null, $expectedFailedValidationCode = Codes::HTTP_I_AM_A_TEAPOT);
316-
$viewHandler->setContainer($container);
317-
318-
$form = $this->getMock(
319-
'Symfony\\Component\\Form\\Form',
320-
array('createView', 'getData', 'isValid', 'isBound'),
321-
array(),
322-
'',
323-
false
324-
);
325-
$form
326-
->expects($this->any())
327-
->method('isValid')
328-
->will($this->returnValue(false));
329-
$form
330-
->expects($this->any())
331-
->method('isBound')
332-
->will($this->returnValue(true));
333-
334-
$view = new View($form);
335-
$response = $viewHandler->createResponse($view, new Request, 'json');
336-
337-
$data = unserialize($response->getContent());
338-
$this->assertInstanceOf('FOS\\RestBundle\\Util\\ExceptionWrapper', $data);
339-
$this->assertEquals('Validation Failed', $this->readAttribute($data, 'message'));
340-
$this->assertInstanceOf('Symfony\\Component\\Form\\Form', $this->readAttribute($data, 'errors'));
341-
$this->assertEquals($expectedFailedValidationCode, $this->readAttribute($data, 'code'));
342-
}
343-
344291
public static function createResponseWithoutLocationDataProvider()
345292
{
346293
return array(

0 commit comments

Comments
 (0)