Skip to content

Commit 1848d9d

Browse files
committed
Merge pull request #12 from ilyar/master
Update for Codeception 2.1
2 parents b2e3b80 + 32474b4 commit 1848d9d

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"require": {
1919
"php": ">=5.4.0",
20-
"codeception/codeception": "~2.0.0",
20+
"codeception/codeception": "~2.1.0",
2121
"allure-framework/allure-php-api": "~1.1.0",
2222
"symfony/filesystem": "~2.6",
2323
"symfony/finder": "~2.6"

src/Yandex/Allure/Adapter/AllureAdapter.php

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,36 @@ class AllureAdapter extends Extension
5050
Events::TEST_SKIPPED => 'testSkipped',
5151
Events::TEST_END => 'testEnd',
5252
Events::STEP_BEFORE => 'stepBefore',
53-
Events::STEP_FAIL => 'stepFail',
5453
Events::STEP_AFTER => 'stepAfter'
5554
];
5655

57-
public function _initialize()
56+
/**
57+
* Annotations that should be ignored by the annotaions parser (especially PHPUnit annotations).
58+
*
59+
* @var array
60+
*/
61+
private $ignoredAnnotations = [
62+
'after', 'afterClass', 'backupGlobals', 'backupStaticAttributes', 'before', 'beforeClass',
63+
'codeCoverageIgnore', 'codeCoverageIgnoreStart', 'codeCoverageIgnoreEnd', 'covers',
64+
'coversDefaultClass', 'coversNothing', 'dataProvider', 'depends', 'expectedException',
65+
'expectedExceptionCode', 'expectedExceptionMessage', 'group', 'large', 'medium',
66+
'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses', 'runInSeparateProcess',
67+
'small', 'test', 'testdox', 'ticket', 'uses',
68+
];
69+
70+
/**
71+
* Extra annotations to ignore in addition to standard PHPUnit annotations.
72+
*
73+
* @param array $ignoredAnnotations
74+
*/
75+
public function _initialize(array $ignoredAnnotations = [])
5876
{
5977
parent::_initialize();
6078
Annotation\AnnotationProvider::registerAnnotationNamespaces();
79+
// Add standard PHPUnit annotations
80+
Annotation\AnnotationProvider::addIgnoredAnnotations($this->ignoredAnnotations);
81+
// Add custom ignored annotations
82+
Annotation\AnnotationProvider::addIgnoredAnnotations($ignoredAnnotations);
6183
$outputDirectory = $this->getOutputDirectory();
6284
$deletePreviousResults =
6385
$this->tryGetOption(DELETE_PREVIOUS_RESULTS_PARAMETER, false);
@@ -156,8 +178,10 @@ public function suiteBefore(SuiteEvent $suiteEvent)
156178
$suite = $suiteEvent->getSuite();
157179
$suiteName = $suite->getName();
158180
$event = new TestSuiteStartedEvent($suiteName);
159-
if (class_exists($suiteName)){
160-
$annotationManager = new Annotation\AnnotationManager(Annotation\AnnotationProvider::getClassAnnotations(get_class($suite)));
181+
if (class_exists($suiteName, false)) {
182+
$annotationManager = new Annotation\AnnotationManager(
183+
Annotation\AnnotationProvider::getClassAnnotations($suiteName)
184+
);
161185
$annotationManager->updateTestSuiteEvent($event);
162186
}
163187
$this->uuid = $event->getUuid();
@@ -218,10 +242,6 @@ public function stepAfter()
218242
$this->getLifecycle()->fire(new StepFinishedEvent());
219243
}
220244

221-
public function stepFail()
222-
{
223-
$this->getLifecycle()->fire(new StepFailedEvent());
224-
}
225245

226246
/**
227247
* @return Allure

0 commit comments

Comments
 (0)