Permalink
Browse files

Renaming method to better match what it does.

  • Loading branch information...
1 parent dffcf04 commit 50a0a51f530b6be6fee9dabe49f9c5846737672f @markstory markstory committed Sep 25, 2011
@@ -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);
@@ -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);
@@ -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));
@@ -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));
@@ -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);
@@ -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();
@@ -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');
@@ -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'));

0 comments on commit 50a0a51

Please sign in to comment.