public function testEvent()
 {
     $testCase = new TestCase();
     $uuid = 'test-uuid';
     $testCaseName = 'test-case-name';
     $testCaseTitle = 'test-case-title';
     $testCaseDescriptionValue = 'test-case-description-value';
     $testCaseDescriptionType = DescriptionType::TEXT;
     $testCaseLabelValue = 'test-case-label-value';
     $testCaseLabelName = LabelType::STORY;
     $testCaseParameterName = 'test-case-parameter-name';
     $testCaseParameterValue = 'test-case-parameter-value';
     $testCaseParameterKind = ParameterKind::ARGUMENT;
     $event = new TestCaseStartedEvent($uuid, $testCaseName);
     $event->withTitle($testCaseTitle)->withDescription(new Description($testCaseDescriptionType, $testCaseDescriptionValue))->withLabels([new Label($testCaseLabelName, $testCaseLabelValue)])->withParameters([new Parameter($testCaseParameterName, $testCaseParameterValue, $testCaseParameterKind)]);
     $event->process($testCase);
     $this->assertEquals(Status::PASSED, $testCase->getStatus());
     $this->assertEquals($testCaseTitle, $testCase->getTitle());
     $this->assertNotEmpty($testCase->getStart());
     $this->assertEquals($testCaseName, $testCase->getName());
     $this->assertNotEmpty($testCase->getDescription());
     $this->assertEquals($testCaseDescriptionValue, $testCase->getDescription()->getValue());
     $this->assertEquals($testCaseDescriptionType, $testCase->getDescription()->getType());
     $this->assertEquals(1, sizeof($testCase->getLabels()));
     $labels = $testCase->getLabels();
     $label = array_pop($labels);
     $this->assertTrue($label instanceof Label && $label->getName() === $testCaseLabelName && $label->getValue() === $testCaseLabelValue);
     $this->assertEquals(1, sizeof($testCase->getParameters()));
     $parameters = $testCase->getParameters();
     $parameter = array_pop($parameters);
     $this->assertTrue($parameter instanceof Parameter && $parameter->getName() === $testCaseParameterName && $parameter->getValue() === $testCaseParameterValue && $parameter->getKind() === $testCaseParameterKind);
     $this->assertEmpty($testCase->getStop());
     $this->assertEmpty($testCase->getSteps());
     $this->assertEmpty($testCase->getAttachments());
 }
 public function updateTestCaseEvent(TestCaseStartedEvent $event)
 {
     if ($this->isTitlePresent()) {
         $event->setTitle($this->getTitle());
     }
     if ($this->isDescriptionPresent()) {
         $event->setDescription($this->getDescription());
     }
     if ($this->areLabelsPresent()) {
         $event->setLabels($this->getLabels());
     }
     if ($this->areParametersPresent()) {
         $event->setParameters($this->getParameters());
     }
 }
 private function generateXML($tmpDir)
 {
     AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . "/../../../../vendor/jms/serializer/src");
     Model\Provider::setOutputDirectory($tmpDir);
     Allure::setDefaultLifecycle();
     $testSuiteStartedEvent = new TestSuiteStartedEvent(TEST_SUITE_NAME);
     $uuid = $testSuiteStartedEvent->getUuid();
     $testSuiteStartedEvent->setTitle(TEST_SUITE_TITLE);
     $testSuiteStartedEvent->setDescription(new Description(DescriptionType::HTML, DESCRIPTION));
     $testSuiteStartedEvent->setLabels([Label::feature(FEATURE_NAME), Label::story(STORY_NAME)]);
     Allure::lifecycle()->fire($testSuiteStartedEvent);
     $testCaseStartedEvent = new TestCaseStartedEvent($uuid, TEST_CASE_NAME);
     $testCaseStartedEvent->setDescription(new Description(DescriptionType::MARKDOWN, DESCRIPTION));
     $testCaseStartedEvent->setLabels([Label::feature(FEATURE_NAME), Label::story(STORY_NAME), Label::severity(SeverityLevel::MINOR)]);
     $testCaseStartedEvent->setTitle(TEST_CASE_TITLE);
     $testCaseStartedEvent->setParameters([new Parameter(PARAMETER_NAME, PARAMETER_VALUE, ParameterKind::SYSTEM_PROPERTY)]);
     Allure::lifecycle()->fire($testCaseStartedEvent);
     $testCaseFailureEvent = new TestCaseFailedEvent();
     $testCaseFailureEvent = $testCaseFailureEvent->withMessage(FAILURE_MESSAGE)->withException(new \Exception());
     Allure::lifecycle()->fire($testCaseFailureEvent);
     $stepStartedEvent = new StepStartedEvent(STEP_NAME);
     $stepStartedEvent = $stepStartedEvent->withTitle(STEP_TITLE);
     Allure::lifecycle()->fire($stepStartedEvent);
     Allure::lifecycle()->fire(new AddAttachmentEvent(STEP_ATTACHMENT_SOURCE, STEP_ATTACHMENT_TITLE, 'text/plain'));
     Allure::lifecycle()->fire(new StepFinishedEvent());
     Allure::lifecycle()->fire(new TestCaseFinishedEvent());
     Allure::lifecycle()->fire(new TestSuiteFinishedEvent($uuid));
     return $uuid;
 }
 protected function processTestCaseStartedEvent(TestCaseStartedEvent $event)
 {
     //init root step if needed
     $this->getStepStorage()->getLast();
     $testCase = $this->getTestCaseStorage()->get();
     $event->process($testCase);
     $this->getTestSuiteStorage()->get($event->getSuiteUuid())->addTestCase($testCase);
 }