Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HttpKernel] fixed the inline renderer when passing objects as attrib…
…utes (closes #7124)
- Loading branch information
Showing
8 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...ndle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\DependencyInjection\ContainerAware; | ||
|
||
class FragmentController extends ContainerAware | ||
{ | ||
public function indexAction() | ||
{ | ||
$actions = $this->container->get('templating')->get('actions'); | ||
|
||
return new Response($actions->render($actions->controller('TestBundle:Fragment:inlined', array( | ||
'options' => array( | ||
'bar' => new Bar(), | ||
'eleven' => 11, | ||
), | ||
)))); | ||
} | ||
|
||
public function inlinedAction($options, $_format) | ||
{ | ||
return new Response($options['bar']->getBar().' '.$_format); | ||
} | ||
} | ||
|
||
class Bar | ||
{ | ||
private $bar = 'bar'; | ||
|
||
public function getBar() | ||
{ | ||
return $this->bar; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; | ||
|
||
/** | ||
* @group functional | ||
*/ | ||
class FragmentTest extends WebTestCase | ||
{ | ||
/** | ||
* @dataProvider getConfigs | ||
*/ | ||
public function testFragment($insulate) | ||
{ | ||
$client = $this->createClient(array('test_case' => 'Fragment', 'root_config' => 'config.yml')); | ||
if ($insulate) { | ||
$client->insulate(); | ||
} | ||
|
||
$client->request('GET', '/fragment_home'); | ||
|
||
$this->assertEquals('bar txt', $client->getResponse()->getContent()); | ||
} | ||
|
||
public function getConfigs() | ||
{ | ||
return array( | ||
array(false), | ||
array(true), | ||
); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/bundles.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
|
||
return array( | ||
new FrameworkBundle(), | ||
new TestBundle(), | ||
); |
7 changes: 7 additions & 0 deletions
7
src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
imports: | ||
- { resource: ../config/default.yml } | ||
|
||
framework: | ||
fragments: ~ | ||
templating: | ||
engines: ['php'] |
2 changes: 2 additions & 0 deletions
2
src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Fragment/routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_fragmenttest_bundle: | ||
resource: @TestBundle/Resources/config/routing.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters