From d4c351563e75993d0def07ded4e085464c681e5e Mon Sep 17 00:00:00 2001 From: Mark van Driel Date: Mon, 19 Aug 2019 14:52:46 +0200 Subject: [PATCH] Test to prove issue with empty body for json --- .../Component/RequestHandlerComponentTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 17b50cbea..bc0e49cf2 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -399,6 +399,20 @@ class RequestHandlerComponentTest extends CakeTestCase { $this->assertFalse(is_object($this->Controller->data)); } +/** + * testStartupCallbackJson method + * + * @return void + */ + public function testStartupCallbackJson() { + $_SERVER['REQUEST_METHOD'] = 'PUT'; + $_SERVER['CONTENT_TYPE'] = 'application/json'; + $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)); + } + /** * testStartupCallback with charset. *