vpr_backand/Tests/test.php
2025-08-28 09:28:59 +02:00

128 lines
4.1 KiB
PHP

<?php
define('API', 'restAPI.php'); // NICHT VERAENDERN!!!
$url = "http://localhost/VPR_Backend/" . API;
// $filepath = "c:\\xampp\\htdocs\\2022_BEE_PBAT3H19AB\\taskit\\";
/**
* Options for get all projetcs
*/
$defaults = array(
CURLOPT_URL => $url . '/project',
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt', // set same file as cookie jar
CURLOPT_CUSTOMREQUEST => "GET"
);
/**
* Options for get all tasks
*/
// $defaults = array(
// CURLOPT_URL => $url . '/task',
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt', // set same file as cookie jar
// CURLOPT_CUSTOMREQUEST => "GET"
// );
/**
* Options for get tasks filtered
*/
// $defaults = array(
// CURLOPT_URL => $url . '/task/getFilteredTasks?dueDate=1%20DAY',
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt', // set same file as cookie jar
// CURLOPT_CUSTOMREQUEST => "GET"
// );
/**
* Options for insert new task
*/
// $params = json_encode(array(
// "projectId" => '72f7cc6e-3717-11eb-add7-2c4d544f8fe0'
// , 'title' => 'Neuer Task 5'
// , 'expense' => '0,25'
// , 'dueDate' => '15.03.2022'
// , 'priorityId' => 1));
// $defaults = array(
// CURLOPT_URL => $url . '/task',
// CURLOPT_CUSTOMREQUEST => "POST",
// // CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// // CURLOPT_COOKIEJAR => $filepath . 'cookie.txt', // set same file as cookie jar
// CURLOPT_POSTFIELDS => $params
// );
/**
* Options for Update Task OHNE Login
*/
// $params = json_encode(array("done" => '0'));
// $defaults = array(
// CURLOPT_URL => $url . '/task/1b2d4564-3718-11eb-add7-2c4d544f8fe0',
// CURLOPT_CUSTOMREQUEST => "PUT",
// CURLOPT_POSTFIELDS => $params
// );
/**
* Options for Delete Task OHNE Login
*/
// $defaults = array(
// CURLOPT_URL => $url . '/task/01b169aa-3718-11eb-add7-2c4d544f8fe0',
// CURLOPT_CUSTOMREQUEST => "DELETE"
// );
/**
* Options for Delete Task MIT Login
*/
// $defaults = array(
// CURLOPT_URL => $url . '/task/cbdb169f-e0da-11e7-a056-2c4d544f8fe0',
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt', // set same file as cookie jar
// CURLOPT_CUSTOMREQUEST => "DELETE"
// );
/**
* Options for loginUser
*/
// $defaults = array(
// CURLOPT_URL => $url . '/user/loginUser?username=fiona&pw=12345',
// CURLOPT_CUSTOMREQUEST => "GET",
// CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt' // set same file as cookie jar
// );
/**
* Options for isLogin
*/
// $defaults = array(
// CURLOPT_URL => $url . '/user/isLogin',
// CURLOPT_CUSTOMREQUEST => "GET",
// CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt' // set same file as cookie jar
// );
/**
* Options for logout
*/
// $defaults = array(
// CURLOPT_URL => $url . '/user/logout',
// CURLOPT_CUSTOMREQUEST => "GET",
// CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
// CURLOPT_COOKIEFILE => $filepath . 'cookie.txt', // set cookie file to given file
// CURLOPT_COOKIEJAR => $filepath . 'cookie.txt' // set same file as cookie jar
// );
// session_write_close();
$ch = curl_init();
curl_setopt_array($ch, ($defaults));
curl_exec($ch);
if(curl_error($ch)) {
print(curl_error($ch));
}
curl_close($ch);
// session_start();
?>