mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Renaming method to better match what it does.
This commit is contained in:
parent
dffcf048d9
commit
50a0a51f53
3 changed files with 13 additions and 13 deletions
|
@ -733,7 +733,7 @@ class CakeRequest implements ArrayAccess {
|
|||
* @return The decoded/processed request data.
|
||||
*/
|
||||
public function input($callback = null) {
|
||||
$input = $this->_readStdin();
|
||||
$input = $this->_readInput();
|
||||
$args = func_get_args();
|
||||
if (!empty($args)) {
|
||||
$callback = array_shift($args);
|
||||
|
@ -746,9 +746,9 @@ class CakeRequest implements ArrayAccess {
|
|||
/**
|
||||
* Read data from php://input, mocked in tests.
|
||||
*
|
||||
* @return string contents of stdin
|
||||
* @return string contents of php://input
|
||||
*/
|
||||
protected function _readStdin() {
|
||||
protected function _readInput() {
|
||||
if (empty($this->_input)) {
|
||||
$fh = fopen('php://input', 'r');
|
||||
$content = stream_get_contents($fh);
|
||||
|
|
|
@ -256,7 +256,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
public function testStartupCallback() {
|
||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||
$_SERVER['CONTENT_TYPE'] = 'application/xml';
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$this->RequestHandler->startup($this->Controller);
|
||||
$this->assertTrue(is_array($this->Controller->data));
|
||||
$this->assertFalse(is_object($this->Controller->data));
|
||||
|
@ -270,7 +270,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
public function testStartupCallbackCharset() {
|
||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||
$_SERVER['CONTENT_TYPE'] = 'application/xml; charset=UTF-8';
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$this->RequestHandler->startup($this->Controller);
|
||||
$this->assertTrue(is_array($this->Controller->data));
|
||||
$this->assertFalse(is_object($this->Controller->data));
|
||||
|
@ -287,9 +287,9 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
}
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['CONTENT_TYPE'] = 'text/csv';
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$this->Controller->request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$this->Controller->request->expects($this->once())
|
||||
->method('_readStdin')
|
||||
->method('_readInput')
|
||||
->will($this->returnValue('"A","csv","string"'));
|
||||
$this->RequestHandler->addInputType('csv', array('str_getcsv'));
|
||||
$this->RequestHandler->startup($this->Controller);
|
||||
|
|
|
@ -1518,8 +1518,8 @@ class CakeRequestTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInput() {
|
||||
$request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$request->expects($this->once())->method('_readStdin')
|
||||
$request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$request->expects($this->once())->method('_readInput')
|
||||
->will($this->returnValue('I came from stdin'));
|
||||
|
||||
$result = $request->input();
|
||||
|
@ -1532,8 +1532,8 @@ class CakeRequestTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInputDecode() {
|
||||
$request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$request->expects($this->once())->method('_readStdin')
|
||||
$request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$request->expects($this->once())->method('_readInput')
|
||||
->will($this->returnValue('{"name":"value"}'));
|
||||
|
||||
$result = $request->input('json_decode');
|
||||
|
@ -1553,8 +1553,8 @@ class CakeRequestTest extends CakeTestCase {
|
|||
</post>
|
||||
XML;
|
||||
|
||||
$request = $this->getMock('CakeRequest', array('_readStdin'));
|
||||
$request->expects($this->once())->method('_readStdin')
|
||||
$request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
$request->expects($this->once())->method('_readInput')
|
||||
->will($this->returnValue($xml));
|
||||
|
||||
$result = $request->input('Xml::build', array('return' => 'domdocument'));
|
||||
|
|
Loading…
Reference in a new issue