From 98c1056fbfd3a3ab3cbdc6fffc1a59929671733c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 27 Jan 2011 21:20:08 +0100 Subject: [PATCH] renamed Request::fromGlobals() to Request::createFromGlobals() (for consistency with the existing create() method) --- .../Component/HttpFoundation/Request.php | 20 +++++++++---------- .../Component/HttpFoundation/RequestTest.php | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index e9269cc151..0e2c99ee86 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -70,16 +70,6 @@ class Request static protected $formats; - /** - * Creates a new request with values from PHP's super globals. - * - * @return Request A new request - */ - static public function fromGlobals() - { - return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); - } - /** * Constructor. * @@ -129,6 +119,16 @@ class Request $this->format = null; } + /** + * Creates a new request with values from PHP's super globals. + * + * @return Request A new request + */ + static public function createfromGlobals() + { + return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + } + /** * Creates a Request based on a given URI and configuration. * diff --git a/tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php b/tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php index 2777a49158..4f77b1c6b5 100644 --- a/tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php +++ b/tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php @@ -428,7 +428,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase ); } - public function testFromGlobals() + public function testCreateFromGlobals() { $_GET['foo1'] = 'bar1'; $_POST['foo2'] = 'bar2'; @@ -436,7 +436,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase $_FILES['foo4'] = array('bar4'); $_SERVER['foo5'] = 'bar5'; - $request = Request::fromGlobals(); + $request = Request::createFromGlobals(); $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET'); $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST'); $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE');