renamed Request::fromGlobals() to Request::createFromGlobals() (for consistency with the existing create() method)

This commit is contained in:
Fabien Potencier 2011-01-27 21:20:08 +01:00
parent 224e66f77b
commit 98c1056fbf
2 changed files with 12 additions and 12 deletions

View File

@ -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.
*

View File

@ -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');