Add errors features for tests calsses
This commit is contained in:
parent
81bc109269
commit
58a936d015
2 changed files with 19 additions and 4 deletions
|
@ -1,6 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
include_once("../core/Plugin_Api.php");
|
include_once("../core/Plugin_Api.php");
|
||||||
include_once("../core/LibOverride/genTokenOptions.php");
|
include_once("../core/LibOverride/genTokenOptions.php");
|
||||||
|
include_once("../core/ErrorManagement.php");
|
||||||
|
|
||||||
|
use OpenStack\Common\Error\BadResponseError;
|
||||||
|
use OpenStack\Common\Error\BaseError;
|
||||||
|
use OpenStack\Common\Error\NotImplementedError;
|
||||||
|
use OpenStack\Common\Error\UserInputError;
|
||||||
|
|
||||||
class AppTest{
|
class AppTest{
|
||||||
|
|
||||||
|
@ -9,6 +15,7 @@ class AppTest{
|
||||||
protected $tokenClass;
|
protected $tokenClass;
|
||||||
protected $tokenPost;
|
protected $tokenPost;
|
||||||
protected $output;
|
protected $output;
|
||||||
|
protected $errorClass;
|
||||||
|
|
||||||
public function __construct($args){
|
public function __construct($args){
|
||||||
|
|
||||||
|
@ -17,6 +24,7 @@ class AppTest{
|
||||||
$this->openstack = new OpenStack\OpenStack([]);
|
$this->openstack = new OpenStack\OpenStack([]);
|
||||||
$this->pluginsApi = plugin_api::getInstance();
|
$this->pluginsApi = plugin_api::getInstance();
|
||||||
$this->output = array();
|
$this->output = array();
|
||||||
|
$this->errorClass = new errorManagement($this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,4 +78,9 @@ class AppTest{
|
||||||
echo json_encode($this->output);
|
echo json_encode($this->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getErrorInstance(){
|
||||||
|
|
||||||
|
return $this->errorClass;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -9,8 +9,11 @@
|
||||||
*
|
*
|
||||||
* @todo Complete the functions with errors detection and finish the descriptions
|
* @todo Complete the functions with errors detection and finish the descriptions
|
||||||
*/
|
*/
|
||||||
use OpenStack\Common\Error;
|
use OpenStack\Common\Error\BadResponseError;
|
||||||
|
use OpenStack\Common\Error\BaseError;
|
||||||
|
use OpenStack\Common\Error\NotImplementedError;
|
||||||
|
use OpenStack\Common\Error\UserInputError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image Class of the back-end application
|
* Image Class of the back-end application
|
||||||
*
|
*
|
||||||
|
@ -190,8 +193,7 @@ class image {
|
||||||
$service = $this->libClass;
|
$service = $this->libClass;
|
||||||
$service->getImage($id)->delete();
|
$service->getImage($id)->delete();
|
||||||
}catch(BadResponseError $e){
|
}catch(BadResponseError $e){
|
||||||
echo "YOLO";
|
$this->app->getErrorInstance()->BadResponseHandler($e);
|
||||||
$this->app->getErrorInstance->BadResponseHandler($e);
|
|
||||||
}catch(UserInputError $e){
|
}catch(UserInputError $e){
|
||||||
$this->app->getErrorInstance->UserInputHandler($e);
|
$this->app->getErrorInstance->UserInputHandler($e);
|
||||||
}catch(BaseError $e){
|
}catch(BaseError $e){
|
||||||
|
|
Loading…
Add table
Reference in a new issue