From 50a0a51f530b6be6fee9dabe49f9c5846737672f Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 24 Sep 2011 21:56:37 -0400 Subject: [PATCH] Renaming method to better match what it does. --- lib/Cake/Network/CakeRequest.php | 6 +++--- .../Component/RequestHandlerComponentTest.php | 8 ++++---- lib/Cake/Test/Case/Network/CakeRequestTest.php | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 89f830f85..872493316 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -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); diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index f6ff3eb94..1d0303785 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -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); diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index 05c07601b..acd0ba2a2 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -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 { 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'));