This commit is contained in:
Bob
2019-08-25 11:04:55 +01:00
commit 41ff24e0ab
10 changed files with 286 additions and 0 deletions

32
src/test.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
require(__DIR__.'/../vendor/autoload.php');
$config=require(__DIR__.'/config.php');
//pass cmd line args
if($argc<3){
die(basename(__FILE__)." <USER> <REPO> [debug]\n");
}
$debug = ($argc==4 && $argv[3]=='debug');
//open connection and repo
$client=new Client($config['url'],$config['user'],$config['pass'],$debug);
$repo=$client->getRepo($argv[1],$argv[2]);
//get the test label or create if not exist
if(!$label=$repo->getLabelByName('Test')){
$label=$repo->createLabel(['name'=>'Test','color'=>'#336699']);
}
//create a test issue
$issue=$repo->createIssue([
'title'=>'Test',
'body'=>'Just testing'
]);
$issue->addLabel($label);
$issue->addComment('Test comment');
$issue->save();
//change the issue body
$issue->body.=' (Edited!)';
$issue->save();