Skip to content

Instantly share code, notes, and snippets.

@johnwards
Created March 2, 2011 16:04
Show Gist options
  • Save johnwards/851159 to your computer and use it in GitHub Desktop.
Save johnwards/851159 to your computer and use it in GitHub Desktop.
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Component\Form\Renderer;
use Symfony\Component\Form\Renderer\DefaultRenderer;
use Symfony\Component\Form\Renderer\Theme\ThemeInterface;
use Symfony\Component\Form\Renderer\Plugin\PluginInterface;
class DefaultRendererTest extends \PHPUnit_Framework_TestCase
{
public function testSetGetVar()
{
$theme = $this->getMock('Symfony\Component\Form\Renderer\Theme\ThemeInterface');
$plugin = $this->getMock('Symfony\Component\Form\Renderer\Plugin\PluginInterface');
$plugin->expects($this->once())
->method('setUp')
->will($this->returnCallback(function($r){
$r->setVar('testing', "fooBar");
}));
$renderer = new DefaultRenderer($theme, null);
$renderer->addPlugin($plugin);
$this->assertEquals('fooBar',$renderer->getVar('testing'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment