/** * @group ServerTests * * @see 0011760: create smd from model definition */ public function testHandleRequestForDynamicAPI() { // handle jsonkey check $jsonkey = 'myawsomejsonkey'; $_SERVER['HTTP_X_TINE20_JSONKEY'] = $jsonkey; $coreSession = Tinebase_Session::getSessionNamespace(); $coreSession->jsonKey = $jsonkey; $server = new Tinebase_Server_Json(); $request = \Zend\Http\PhpEnvironment\Request::fromString('POST /index.php?requestType=JSON HTTP/1.1' . "\r\n" . 'Host: localhost' . "\r\n" . 'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120824 Thunderbird/15.0 Lightning/1.7' . "\r\n" . 'Content-Type: application/json' . "\r\n" . 'X-Tine20-Transactionid: 18da265bc0eb66a36081bfd42689c1675ed68bab' . "\r\n" . 'X-Requested-With: XMLHttpRequest' . "\r\n" . 'Accept: */*' . "\r\n" . 'Referer: http://tine20.vagrant/' . "\r\n" . 'Accept-Encoding: gzip, deflate' . "\r\n" . 'Accept-Language: en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4' . "\r\n" . "\r\n" . '{"jsonrpc":"2.0","method":"Inventory.searchInventoryItems","params":{"filter":[], "paging":{}},"id":6}' . "\r\n"); ob_start(); $server->handle($request); $out = ob_get_clean(); //echo $out; $this->assertTrue(!empty($out), 'request should not be empty'); $this->assertNotContains('Not Authorised', $out); $this->assertNotContains('Method not found', $out); $this->assertNotContains('No Application Controller found', $out); $this->assertNotContains('"error"', $out); $this->assertNotContains('PHP Fatal error', $out); $this->assertContains('"result"', $out); }