add exception management, correct mistakes in error management in Image.php and add function to simplify parameters using in tests
This commit is contained in:
parent
e01936a73e
commit
fe0eb3a9e2
4 changed files with 338 additions and 289 deletions
|
@ -89,10 +89,16 @@ class AppTest{
|
|||
}
|
||||
|
||||
public function getPostParam($name){
|
||||
|
||||
|
||||
return $this->postParams[$name];
|
||||
|
||||
}
|
||||
|
||||
public function setPostParam($name, $value){
|
||||
|
||||
$this->postParams[$name] = $value;
|
||||
|
||||
}
|
||||
|
||||
public function setOutput($key, $out){
|
||||
|
||||
|
|
|
@ -14,55 +14,39 @@ $opt['minDisk'] = 1;
|
|||
$opt['protected'] = false;
|
||||
$opt['minRam'] = 10;
|
||||
|
||||
//$new_image = $image->createImage($opt);
|
||||
//$App->setPostParam('id', 'sdfihlus154dfhj');
|
||||
$err = $image->action("createImage");
|
||||
|
||||
|
||||
//Liste des images
|
||||
$image->action("listImage");
|
||||
//$images = $image->listImage();
|
||||
$im = $App->show();
|
||||
$images = json_decode($im, true)["Images"];
|
||||
if(isset($images)){
|
||||
echo "Images présentes :";
|
||||
$images = json_decode($im, true)["Images"];
|
||||
$recup;
|
||||
|
||||
echo "Images présentes :";
|
||||
echo "</br>";
|
||||
foreach($images as $i){
|
||||
$recup = $i;
|
||||
echo $recup['name'];
|
||||
echo "</br>";
|
||||
foreach($images as $i){
|
||||
echo $i['name'];
|
||||
echo "</br>";
|
||||
}
|
||||
echo "</br>";
|
||||
|
||||
if(isset($list)){
|
||||
foreach ($list as $l) {
|
||||
echo $l;
|
||||
echo "</br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo "Aucune image présente\n";
|
||||
}
|
||||
//echo $recup['id'];
|
||||
}
|
||||
echo "</br>";
|
||||
echo "Erreur capturée: ";
|
||||
echo "</br>";
|
||||
|
||||
/*
|
||||
//$App->setPostParam('id', $recup['id']);
|
||||
$App->setPostParam('id', 'sdfihlus154dfhj');
|
||||
$err = $image->action("detailsImage");
|
||||
$temp = $App->show();
|
||||
$ret = json_decode($temp, true)["Images"];
|
||||
echo $ret['id'];
|
||||
*/
|
||||
//$App->getPostParam("id");
|
||||
|
||||
|
||||
|
||||
// Détails Image
|
||||
//$details = $image->imageDetails($id_image);
|
||||
|
||||
//$image->deleteImage('123456');
|
||||
|
||||
//$image->desactivateImage($id_image);
|
||||
//$image->reactivateImage($id_image);
|
||||
|
||||
//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
|
||||
//$image->uploadImage($id_image, $file_name);
|
||||
|
||||
//$image->downloadImage($id_image);
|
||||
|
||||
/*
|
||||
$opt_update = Array();
|
||||
$opt_update['name'] = "Test";
|
||||
$opt_update['tags'] = null;
|
||||
|
||||
$update = $image->updateImage($id_image, $opt_update);
|
||||
echo $update->name;
|
||||
*/
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue