This commit is contained in:
James 2019-09-19 08:25:56 +01:00
parent bf3315547f
commit 68edd0f3ea
2 changed files with 57 additions and 1 deletions

54
src/Listener.php Normal file
View File

@ -0,0 +1,54 @@
<?php
namespace JHodges\GiteaBitPHPUnit;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestListener;
class Listener implements TestListener{
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{
printf("Error while running test '%s'.\n", $test->getName());
}
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
printf("Test '%s' failed.\n", $test->getName());
}
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
printf("Test '%s' is incomplete.\n", $test->getName());
}
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
printf("Test '%s' is deemed risky.\n", $test->getName());
}
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
printf("Test '%s' has been skipped.\n", $test->getName());
}
public function startTest(PHPUnit_Framework_Test $test)
{
printf("Test '%s' started.\n", $test->getName());
}
public function endTest(PHPUnit_Framework_Test $test, $time)
{
printf("Test '%s' ended.\n", $test->getName());
}
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
printf("TestSuite '%s' started.\n", $suite->getName());
}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
printf("TestSuite '%s' ended.\n", $suite->getName());
}
}

View File

@ -1,6 +1,8 @@
<?php <?php
namespace JHodges\GiteaBotPHPUnit; namespace JHodges\GiteaBotPHPUnit;
use \JHodges\GiteaBot\Client;
final class Poster{ final class Poster{
function __construct($testdox,$xml){ function __construct($testdox,$xml){
@ -17,7 +19,7 @@ final class Poster{
function post($url, $user, $pass, $repoUser, $repo){ function post($url, $user, $pass, $repoUser, $repo){
//open connection and repo //open connection and repo
$client=new Client($config['url'],$config['user'],$config['pass'],$debug); $client=new Client($url, $user, $pass, $repoUser, $repo);
$repo=$client->getRepo($repoUser, $repo); $repo=$client->getRepo($repoUser, $repo);
//create a test issue //create a test issue