예제 #1
0
<?php

require_once '../vendor/autoload.php';
use JUnitScribe\Document;
use JUnitScribe\Writer\String as StringWriter;
$document = new Document();
$document->addSuite()->setName('SuiteAllOk')->addCase()->setName('SomeAssertions')->setAssertions(10)->setTime(0.1236)->getParent()->addCase()->setName('MoreAssertiongs')->setAssertions(7)->setTime(0.2242)->getParent()->getParent()->addSuite()->setName('SuiteNotOk')->addCase()->setName('HasError')->setAssertions(9)->setTime(1.4424)->addError()->setMessage('An Error Occurred.')->setMessageBody('Some lengthy stacktrace or message body for the error.')->getParent()->getParent()->addCase()->setName('HasFailure')->setAssertions(7)->setTime(1.0023)->addFailure()->setMessage('A Failure Occurred.')->setMessageBody('Some lengthy stacktrace or message body for the failure.');
$writer = new StringWriter();
$writer->setDocument($document);
echo $writer->formatDocument();
예제 #2
0
<?php

use JUnitScribe\Document;
$document = new Document();
$document->addSuite()->setName('JUnitScribe.Suite')->addCase()->setName('JUnitScribe.Test')->setAssertions(0)->getParent()->addCase()->setClass('JUnitScribe.Test.Class')->setAssertions(2)->setTime(0.223)->getParent()->addSuite()->setName('JunitScribe.NestedSuite')->addCase()->setAssertions(5)->getParent()->getParent()->getParent()->addSuite()->setFile('./tests/fixtures/document.php')->addCase()->setFile('./tests/fixtures/document.php')->setLine(29)->setAssertions(17)->setTime(2.443)->addError()->setMessage('error message attribute')->setMessageBody('error message body')->getParent()->addFailure()->setMessage('failure message attribute')->setMessageBody('failure message body')->getParent()->getParent()->addCase()->setFile('./tests/fixtures/document.php')->setLine(43)->setAssertions(13)->setTime(1.334)->addFailure()->setMessage('secondary failure attribute')->setMessageBody('secondary failure body');
return $document;