created mocks for testing
This commit is contained in:
@@ -21,17 +21,19 @@ abstract class WebService
|
||||
/**
|
||||
* Treat the current request and output the result. This is the only
|
||||
* method that should be called on the webservice directly !
|
||||
* @param bool $sendSession needed for testing
|
||||
*/
|
||||
public function run()
|
||||
public function run($sendSession = true)
|
||||
{
|
||||
Logger::start(array('version' => $this->version));
|
||||
|
||||
$renderer = new Renderer();
|
||||
$rendererClass = Configuration::get('renderer.class', __NAMESPACE__ . '\Renderer');
|
||||
$renderer = new $rendererClass;
|
||||
|
||||
$data = array();
|
||||
|
||||
try {
|
||||
$result = $this->call();
|
||||
$result = $this->call($sendSession);
|
||||
$data["result"][$this->func] = $result;
|
||||
|
||||
// Logger::log(print_r($result, true));
|
||||
@@ -61,13 +63,16 @@ abstract class WebService
|
||||
* Determines which method to call based on GET or POST parameters and
|
||||
* call it before returning the result.
|
||||
*
|
||||
* @param bool $sendSession used for testing
|
||||
* @return array
|
||||
* @throws UsageException
|
||||
*/
|
||||
private function call()
|
||||
private function call($sendSession = true)
|
||||
{
|
||||
session_save_path(Configuration::get('session.save_path'));
|
||||
session_start();
|
||||
if ($sendSession) {
|
||||
session_save_path(Configuration::get('session.save_path'));
|
||||
session_start();
|
||||
}
|
||||
|
||||
$params = empty($_GET) ? $_POST : $_GET;
|
||||
if (empty($params)) {
|
||||
|
||||
Reference in New Issue
Block a user