public function testExecute() { // test func $this->setToken(); $this->object->allow('min'); $this->assertEquals(min($this->args), $this->object->execute()); // test static method $sr = new ServerRequest(array('NonConstructorTest', 'staticTic')); $sr->allow('NonConstructorTest::staticTic'); $this->assertEquals('toc', $sr->execute()); $num = mt_rand(); $add = mt_rand(); $sr = new ServerRequest(array('ConstructorTest', 'getNum'), array($num, $add)); $sr->allow('ConstructorTest::getNum'); $this->assertEquals($num + $add, $sr->execute()); }
$serverRequest->allow('Geo_Names::FindCitiesByName'); $serverRequest->allow('Geo_Map::LoadMapData'); $serverRequest->allow('Geo_Map::StoreMapData', 'ChangeArticle'); $serverRequest->allow('MediaList::doData'); $serverRequest->allow('ImageList::doData'); $serverRequest->allow('MediaList::doDelete'); $serverRequest->allow('ImageList::doDelete'); $serverRequest->allow('Article::setOnFrontPage','Publish'); $serverRequest->allow('Article::setOnSectionPage','Publish'); $serverRequest->allow('Article::setIsPublic','Publish'); $serverRequest->allow('Article::setKeywords'); $serverRequest->allow('Article::setIsLocked'); $serverRequest->allow('ArticleData::setProperty'); // execute echo json_encode($serverRequest->execute()); } catch (Exception $e) { echo json_encode(array( 'error_code' => $e->getCode(), 'error_message' => getGS('Error') . ': ' . $e->getMessage(), )); } exit; /** * Connection check function * @return bool */ function ping() {