fix examples and move into a dir of their own

This commit is contained in:
James
2019-08-16 16:42:24 +01:00
parent 1ee076aac6
commit 6123f69996
5 changed files with 32 additions and 52 deletions

28
example/test.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
require(__DIR__.'/../bootstrap.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]);
//create a label
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();