fea6b79acd
This is the first step to make each Symfony Component and Bridge self-contained.
56 lines
1.3 KiB
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());
|
|
}
|
|
}
|