mirror of
https://github.com/sitelease/sugar-cube-client.git
synced 2025-10-29 19:12:30 +01:00
Updated the TestRun file
+ Added several more tests
This commit is contained in:
@ -22,18 +22,89 @@ $giteaClient->setAuthToken('32e609ad39539c1d0e8544800bd49b1025ac6b49');
|
|||||||
// } else {
|
// } else {
|
||||||
// print("No Data could be retrieved"."\n");
|
// print("No Data could be retrieved"."\n");
|
||||||
// }
|
// }
|
||||||
print("Getting all repos via API \n");
|
|
||||||
$repositories = $giteaClient->repositories()->all();
|
// print("Getting all repos via API \n");
|
||||||
if ($repositories && count($repositories) > 0) {
|
// $repositories = $giteaClient->repositories()->all();
|
||||||
foreach ($repositories as $item) {
|
// if ($repositories && count($repositories) > 0) {
|
||||||
print("Name: ".$item->getName()."\n");
|
// foreach ($repositories as $item) {
|
||||||
print("Full Name: ".$item->getFullName()."\n");
|
// print("Name: ".$item->getName()."\n");
|
||||||
print("Description: ".$item->getDescription()."\n");
|
// print("Full Name: ".$item->getFullName()."\n");
|
||||||
print("\n\n");
|
// print("Description: ".$item->getDescription()."\n");
|
||||||
|
// print("\n\n");
|
||||||
|
// }
|
||||||
|
// print("Total Items: ".count($repositories)."\n");
|
||||||
|
// } else {
|
||||||
|
// print("No repos could be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("Getting all tags for the 'sl-product-catalog' repository \n\n");
|
||||||
|
// $repository = $giteaClient->repositories()->getByName("Sitelease", "sl-product-catalog");
|
||||||
|
// if ($repository) {
|
||||||
|
// $tags = $repository->tags();
|
||||||
|
// if ($tags && count($tags) > 0) {
|
||||||
|
// foreach ($tags as $tag) {
|
||||||
|
// var_dump(json_encode($tag));
|
||||||
|
// print("\n\n");
|
||||||
|
// }
|
||||||
|
// print("Total Tags: ".count($tags)."\n");
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// print("The repository could not be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("Getting all branches for the 'sl-product-catalog' repository \n\n");
|
||||||
|
// $repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
|
||||||
|
// if ($repository) {
|
||||||
|
// $branches = $repository->branches();
|
||||||
|
// if ($branches && count($branches) > 0) {
|
||||||
|
// //foreach ($branches as $branch) {
|
||||||
|
// var_dump($branches->getItem("master"));
|
||||||
|
// print("\n\n");
|
||||||
|
// //}
|
||||||
|
// print("Total Branches: ".count($branches)."\n");
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// print("The repository could not be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("Getting contents of \"composer.json\" file \n\n");
|
||||||
|
// $rawFile = $giteaClient->repositories()->getRawFile("Sitelease", "sl-theme-recipe", "composer.json");
|
||||||
|
// if ($rawFile) {
|
||||||
|
// var_dump(json_encode($rawFile));
|
||||||
|
// print("\n\n");
|
||||||
|
// } else {
|
||||||
|
// print("The raw file could not be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("Getting contents of \"composer.json\" file \n\n");
|
||||||
|
// $rawFile = $giteaClient->repositories()->getRawFile("Sitelease", "sl-theme-recipe", "composer.json");
|
||||||
|
// if ($rawFile) {
|
||||||
|
// var_dump($rawFile);
|
||||||
|
// print("\n\n");
|
||||||
|
// } else {
|
||||||
|
// print("The raw file could not be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print("Getting a repository \n\n");
|
||||||
|
// $repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
|
||||||
|
// if ($repository) {
|
||||||
|
// var_dump($repository);
|
||||||
|
// print("\n\n");
|
||||||
|
// } else {
|
||||||
|
// print("The repository could not be retrieved"."\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
print("Getting archive for the 'sl-product-catalog' repository \n\n");
|
||||||
|
$repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
|
||||||
|
if ($repository) {
|
||||||
|
$archive = $repository->archive("master");
|
||||||
|
if ($archive) {
|
||||||
|
print("Downloading Archive...\n");
|
||||||
|
file_put_contents("master.tar.gz", $archive);
|
||||||
|
print("Success!\n");
|
||||||
}
|
}
|
||||||
print("Total Items: ".count($repositories)."\n");
|
|
||||||
} else {
|
} else {
|
||||||
print("No repos could be retrieved"."\n");
|
print("The archive could not be retrieved"."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
print("Exiting script"."\n");
|
print("Exiting script"."\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user