You are here

public function HIncludeFragmentRendererTest::testRenderWithAttributesOptions in Zircon Profile 8.0

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

File

vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php, line 61

Class

HIncludeFragmentRendererTest

Namespace

Symfony\Component\HttpKernel\Tests\Fragment

Code

public function testRenderWithAttributesOptions() {

  // with id
  $strategy = new HIncludeFragmentRenderer();
  $this
    ->assertEquals('<hx:include src="/foo" id="bar">default</hx:include>', $strategy
    ->render('/foo', Request::create('/'), array(
    'default' => 'default',
    'id' => 'bar',
  ))
    ->getContent());

  // with attributes
  $strategy = new HIncludeFragmentRenderer();
  $this
    ->assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>', $strategy
    ->render('/foo', Request::create('/'), array(
    'default' => 'default',
    'attributes' => array(
      'p1' => 'v1',
      'p2' => 'v2',
    ),
  ))
    ->getContent());

  // with id & attributes
  $strategy = new HIncludeFragmentRenderer();
  $this
    ->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy
    ->render('/foo', Request::create('/'), array(
    'default' => 'default',
    'id' => 'bar',
    'attributes' => array(
      'p1' => 'v1',
      'p2' => 'v2',
    ),
  ))
    ->getContent());
}