GiteaBot-examples/src/test.php
2019-11-10 15:02:44 +00:00

24 lines
610 B
PHP
Executable File

#!/usr/bin/php
<?php
// load the config, create the connection and load the repo sepcified on the cmd line args
// we will then have $client and $repo available
require 'setup.php';
//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();