This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/RequestHelperTest.php

55 lines
1.4 KiB
PHP
Raw Normal View History

<?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;
2017-02-08 07:24:27 +00:00
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper;
2017-02-08 07:24:27 +00:00
class RequestHelperTest extends TestCase
{
protected $requestStack;
protected function setUp()
{
$this->requestStack = new RequestStack();
$request = new Request();
$request->initialize(array('foobar' => 'bar'));
$this->requestStack->push($request);
}
2011-06-11 09:27:54 +01:00
public function testGetParameter()
{
$helper = new RequestHelper($this->requestStack);
$this->assertEquals('bar', $helper->getParameter('foobar'));
$this->assertEquals('foo', $helper->getParameter('bar', 'foo'));
$this->assertNull($helper->getParameter('foo'));
2011-06-11 09:27:54 +01:00
}
public function testGetLocale()
{
$helper = new RequestHelper($this->requestStack);
$this->assertEquals('en', $helper->getLocale());
}
2011-06-11 09:27:54 +01:00
public function testGetName()
{
$helper = new RequestHelper($this->requestStack);
$this->assertEquals('request', $helper->getName());
2011-06-11 09:27:54 +01:00
}
}