Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require": {
"php": ">=5.4.0",
"codeception/codeception": "~2.0.0",
"codeception/codeception": "~2.1.0",
"allure-framework/allure-php-api": "~1.1.0",
"symfony/filesystem": "~2.6",
"symfony/finder": "~2.6"
Expand Down
36 changes: 28 additions & 8 deletions src/Yandex/Allure/Adapter/AllureAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,36 @@ class AllureAdapter extends Extension
Events::TEST_SKIPPED => 'testSkipped',
Events::TEST_END => 'testEnd',
Events::STEP_BEFORE => 'stepBefore',
Events::STEP_FAIL => 'stepFail',
Events::STEP_AFTER => 'stepAfter'
];

public function _initialize()
/**
* Annotations that should be ignored by the annotaions parser (especially PHPUnit annotations).
*
* @var array
*/
private $ignoredAnnotations = [
'after', 'afterClass', 'backupGlobals', 'backupStaticAttributes', 'before', 'beforeClass',
'codeCoverageIgnore', 'codeCoverageIgnoreStart', 'codeCoverageIgnoreEnd', 'covers',
'coversDefaultClass', 'coversNothing', 'dataProvider', 'depends', 'expectedException',
'expectedExceptionCode', 'expectedExceptionMessage', 'group', 'large', 'medium',
'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses', 'runInSeparateProcess',
'small', 'test', 'testdox', 'ticket', 'uses',
];

/**
* Extra annotations to ignore in addition to standard PHPUnit annotations.
*
* @param array $ignoredAnnotations
*/
public function _initialize(array $ignoredAnnotations = [])
{
parent::_initialize();
Annotation\AnnotationProvider::registerAnnotationNamespaces();
// Add standard PHPUnit annotations
Annotation\AnnotationProvider::addIgnoredAnnotations($this->ignoredAnnotations);
// Add custom ignored annotations
Annotation\AnnotationProvider::addIgnoredAnnotations($ignoredAnnotations);
$outputDirectory = $this->getOutputDirectory();
$deletePreviousResults =
$this->tryGetOption(DELETE_PREVIOUS_RESULTS_PARAMETER, false);
Expand Down Expand Up @@ -156,8 +178,10 @@ public function suiteBefore(SuiteEvent $suiteEvent)
$suite = $suiteEvent->getSuite();
$suiteName = $suite->getName();
$event = new TestSuiteStartedEvent($suiteName);
if (class_exists($suiteName)){
$annotationManager = new Annotation\AnnotationManager(Annotation\AnnotationProvider::getClassAnnotations(get_class($suite)));
if (class_exists($suiteName, false)) {
$annotationManager = new Annotation\AnnotationManager(
Annotation\AnnotationProvider::getClassAnnotations($suiteName)
);
$annotationManager->updateTestSuiteEvent($event);
}
$this->uuid = $event->getUuid();
Expand Down Expand Up @@ -218,10 +242,6 @@ public function stepAfter()
$this->getLifecycle()->fire(new StepFinishedEvent());
}

public function stepFail()
{
$this->getLifecycle()->fire(new StepFailedEvent());
}

/**
* @return Allure
Expand Down