RequestTest.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Tests\Component\BrowserKit;
  11. use Symfony\Component\BrowserKit\Request;
  12. class RequestTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testGetUri()
  15. {
  16. $request = new Request('http://www.example.com/', 'get');
  17. $this->assertEquals('http://www.example.com/', $request->getUri(), '->getUri() returns the URI of the request');
  18. }
  19. public function testGetMethod()
  20. {
  21. $request = new Request('http://www.example.com/', 'get');
  22. $this->assertEquals('get', $request->getMethod(), '->getMethod() returns the method of the request');
  23. }
  24. public function testGetParameters()
  25. {
  26. $request = new Request('http://www.example.com/', 'get', array('foo' => 'bar'));
  27. $this->assertEquals(array('foo' => 'bar'), $request->getParameters(), '->getParameters() returns the parameters of the request');
  28. }
  29. public function testGetFiles()
  30. {
  31. $request = new Request('http://www.example.com/', 'get', array(), array('foo' => 'bar'));
  32. $this->assertEquals(array('foo' => 'bar'), $request->getFiles(), '->getFiles() returns the uploaded files of the request');
  33. }
  34. public function testGetCookies()
  35. {
  36. $request = new Request('http://www.example.com/', 'get', array(), array(), array('foo' => 'bar'));
  37. $this->assertEquals(array('foo' => 'bar'), $request->getCookies(), '->getCookies() returns the cookies of the request');
  38. }
  39. public function testGetServer()
  40. {
  41. $request = new Request('http://www.example.com/', 'get', array(), array(), array(), array('foo' => 'bar'));
  42. $this->assertEquals(array('foo' => 'bar'), $request->getServer(), '->getServer() returns the server parameters of the request');
  43. }
  44. }