Tests/CustomFieldTestHelper.php : refactoring : code indentation

This commit is contained in:
Marc Ducobu 2015-09-30 14:03:28 +02:00
parent b11a356fd3
commit eb4da0a71d

View File

@ -47,40 +47,36 @@ class CustomFieldTestHelper
public static function getCrawlerForField(CustomField $field, KernelTestCase $testCase, KernelInterface $kernel, $locale = 'en') public static function getCrawlerForField(CustomField $field, KernelTestCase $testCase, KernelInterface $kernel, $locale = 'en')
{ {
//check a kernel is accessible //check a kernel is accessible
$customFieldsGroup = $testCase->getMock('Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'); $customFieldsGroup = $testCase->getMock('Chill\CustomFieldsBundle\Entity\CustomFieldsGroup');
$customFieldsGroup->expects($testCase->once()) $customFieldsGroup->expects($testCase->once())
->method('getCustomFields') ->method('getCustomFields')
->will($testCase->returnValue(array($field))) ->will($testCase->returnValue(array($field)));
;
$request = $testCase->getMock('Symfony\Component\HttpFoundation\Request'); $request = $testCase->getMock('Symfony\Component\HttpFoundation\Request');
$request->expects($testCase->any()) $request->expects($testCase->any())
->method('getLocale') ->method('getLocale')
->will($testCase->returnValue($locale)) ->will($testCase->returnValue($locale));
;
$kernel->getContainer()->get('request_stack')->push($request); $kernel->getContainer()->get('request_stack')->push($request);
$builder = $kernel->getContainer()->get('form.factory')->createBuilder(); $builder = $kernel->getContainer()->get('form.factory')->createBuilder();
$form = $builder->add('tested', 'custom_field', $form = $builder->add('tested', 'custom_field',
array('group' => $customFieldsGroup)) array('group' => $customFieldsGroup))
->getForm() ->getForm();
;
$kernel->getContainer()->get('twig.loader') $kernel->getContainer()->get('twig.loader')
->addPath(__DIR__.'/Fixtures/App/app/Resources/views/', ->addPath(__DIR__.'/Fixtures/App/app/Resources/views/', $namespace = 'test');
$namespace = 'test');
$content = $kernel $content = $kernel
->getContainer()->get('templating') ->getContainer()->get('templating')
->render('@test/CustomField/simple_form_render.html.twig', array( ->render('@test/CustomField/simple_form_render.html.twig', array(
'form' => $form->createView(), 'form' => $form->createView(),
'inputKeys' => array('tested') 'inputKeys' => array('tested')
)); ));
$crawler = new Crawler(); $crawler = new Crawler();
$crawler->addHtmlContent($content); $crawler->addHtmlContent($content);
return $crawler; return $crawler;
} }
} }