RequestHelperTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper;
  13. class RequestHelperTest extends \PHPUnit_Framework_TestCase
  14. {
  15. protected $request;
  16. public function setUp()
  17. {
  18. $this->request = new Request();
  19. $this->request->initialize(array('foobar' => 'bar'));
  20. }
  21. public function testGetParameter()
  22. {
  23. $helper = new RequestHelper($this->request);
  24. $this->assertEquals('bar', $helper->getParameter('foobar'));
  25. $this->assertEquals('foo', $helper->getParameter('bar', 'foo'));
  26. $this->assertNull($helper->getParameter('foo'));
  27. }
  28. public function testGetName()
  29. {
  30. $helper = new RequestHelper($this->request);
  31. $this->assertEquals('request', $helper->getName());
  32. }
  33. }