JunitXmlGenerator
in package
FinalYes
A simple Junit XML generator.
Table of Contents
Properties
Methods
- addResult() : mixed
- Add a result to a test case.
- addTestCase() : mixed
- Add a test case to a test suite in the data array.
- addTestSuite() : mixed
- Add a test suite to the data array.
- generate() : mixed
- Generate the Junit XML file.
- getData() : array<string|int, mixed>
- Get the existing data.
- mergeFiles() : mixed
- Helper to merge multiple files into a single one.
- setData() : void
- Sets the data array.
Properties
$dir
public
static string
$dir
= 'junit-export'
$data
protected
static array<string|int, mixed>
$data
= []
Methods
addResult()
Add a result to a test case.
public
static addResult(string $testSuite, string $testCase, string $message[, string $type = 'error' ]) : mixed
Parameters
- $testSuite : string
-
The test suite to add.
- $testCase : string
-
The test case to add the result to.
- $message : string
-
The result message.
- $type : string = 'error'
-
The result type.
addTestCase()
Add a test case to a test suite in the data array.
public
static addTestCase(string $testSuite, string $testCase) : mixed
Parameters
- $testSuite : string
-
The test suite to add the test case.
- $testCase : string
-
The test case name.
addTestSuite()
Add a test suite to the data array.
public
static addTestSuite(string $testSuite) : mixed
Parameters
- $testSuite : string
-
The test case name.
generate()
Generate the Junit XML file.
public
static generate([string $filename = 'junit.xml' ][, array<string|int, mixed>|null $data = null ]) : mixed
Parameters
- $filename : string = 'junit.xml'
-
The filename to export.
- $data : array<string|int, mixed>|null = null
-
The data to export.
getData()
Get the existing data.
public
static getData() : array<string|int, mixed>
Return values
array<string|int, mixed>mergeFiles()
Helper to merge multiple files into a single one.
public
static mergeFiles(string $destination, string $directory) : mixed
Parameters
- $destination : string
-
The destination file where multiple files will be merged.
- $directory : string
-
The directory where the files are.
setData()
Sets the data array.
public
static setData(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
The data to set.