You are here

public function InlineFragmentRendererTest::testRenderWithObjectsAsAttributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php \Symfony\Component\HttpKernel\Tests\Fragment\InlineFragmentRendererTest::testRenderWithObjectsAsAttributes()

File

vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php, line 38

Class

InlineFragmentRendererTest

Namespace

Symfony\Component\HttpKernel\Tests\Fragment

Code

public function testRenderWithObjectsAsAttributes() {
  $object = new \stdClass();
  $subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller');
  $subRequest->attributes
    ->replace(array(
    'object' => $object,
    '_format' => 'html',
    '_controller' => 'main_controller',
    '_locale' => 'en',
  ));
  $subRequest->headers
    ->set('x-forwarded-for', array(
    '127.0.0.1',
  ));
  $subRequest->server
    ->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
  $strategy = new InlineFragmentRenderer($this
    ->getKernelExpectingRequest($subRequest));
  $strategy
    ->render(new ControllerReference('main_controller', array(
    'object' => $object,
  ), array()), Request::create('/'));
}