kekrozsak/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php

56 lines
1.3 KiB
PHP

<?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\Templating\Helper;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper;
class RequestHelperTest extends \PHPUnit_Framework_TestCase
{
protected $request;
protected function setUp()
{
$this->request = new Request();
$this->request->initialize(array('foobar' => 'bar'));
}
protected function tearDown()
{
$this->request = null;
}
public function testGetParameter()
{
$helper = new RequestHelper($this->request);
$this->assertEquals('bar', $helper->getParameter('foobar'));
$this->assertEquals('foo', $helper->getParameter('bar', 'foo'));
$this->assertNull($helper->getParameter('foo'));
}
public function testGetLocale()
{
$helper = new RequestHelper($this->request);
$this->assertEquals('en', $helper->getLocale());
}
public function testGetName()
{
$helper = new RequestHelper($this->request);
$this->assertEquals('request', $helper->getName());
}
}