Skip to content

Commit

Permalink
Renaming method to better match what it does.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 25, 2011
1 parent dffcf04 commit 50a0a51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Network/CakeRequest.php
Expand Up @@ -733,7 +733,7 @@ public function data($name) {
* @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);
Expand All @@ -746,9 +746,9 @@ public function input($callback = null) {
/**
* 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);
Expand Down
Expand Up @@ -256,7 +256,7 @@ public function testAutoAjaxLayout() {
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));
Expand All @@ -270,7 +270,7 @@ public function testStartupCallback() {
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));
Expand All @@ -287,9 +287,9 @@ public function testStartupCustomTypeProcess() {
}
$_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);
Expand Down
12 changes: 6 additions & 6 deletions lib/Cake/Test/Case/Network/CakeRequestTest.php
Expand Up @@ -1518,8 +1518,8 @@ public function testHere() {
* @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();
Expand All @@ -1532,8 +1532,8 @@ public function testInput() {
* @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');
Expand All @@ -1553,8 +1553,8 @@ public function testInputDecodeExtraParams() {
</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'));
Expand Down

0 comments on commit 50a0a51

Please sign in to comment.