Skip to content

Commit 0f16624

Browse files
committed
MQE-1704: MFTF Compatibility with PHPUnit 8
Added codeception modeule-* dependencies to fix functional tests
1 parent 6323f0d commit 0f16624

File tree

3 files changed

+170
-3
lines changed

3 files changed

+170
-3
lines changed

composer.json

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"allure-framework/allure-codeception": "~1.4.0",
1818
"aws/aws-sdk-php": "^3.132",
1919
"codeception/codeception": "~4.1.4",
20+
"codeception/module-asserts": "^1.1",
21+
"codeception/module-sequence": "^1.0",
22+
"codeception/module-webdriver": "^1.0",
2023
"composer/composer": "^1.6",
2124
"csharpru/vault-php": "~3.5.3",
2225
"csharpru/vault-php-guzzle6-transport": "^2.0",

composer.lock

+151-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Magento/FunctionalTestingFramework/Allure/Adapter/MagentoAllureAdapter.php

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\FunctionalTestingFramework\Allure\Adapter;
77

8+
use Codeception\Codecept;
9+
use Codeception\Test\Cest;
810
use Codeception\Step\Comment;
911
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
1012
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
@@ -19,9 +21,11 @@
1921
use Yandex\Allure\Adapter\Event\TestCaseFailedEvent;
2022
use Yandex\Allure\Adapter\Event\TestCaseFinishedEvent;
2123
use Yandex\Allure\Adapter\Event\TestCaseBrokenEvent;
24+
use Yandex\Allure\Adapter\Event\AddAttachmentEvent;
2225
use Codeception\Event\FailEvent;
2326
use Codeception\Event\SuiteEvent;
2427
use Codeception\Event\StepEvent;
28+
use Codeception\Event\TestEvent;
2529

2630
/**
2731
* Class MagentoAllureAdapter
@@ -246,9 +250,11 @@ public function testError(FailEvent $failEvent)
246250
/**
247251
* Override of parent method, polls stepStorage for testcase and formats it according to actionGroup nesting.
248252
*
249-
* @return void
253+
* @param TestEvent $testEvent
254+
*
255+
* @throws \Yandex\Allure\Adapter\AllureException
250256
*/
251-
public function testEnd()
257+
public function testEnd(TestEvent $testEvent)
252258
{
253259
// Pops top of stepStorage, need to add it back in after processing
254260
$rootStep = $this->getLifecycle()->getStepStorage()->pollLast();
@@ -309,6 +315,14 @@ function () use ($rootStep, $formattedSteps) {
309315

310316
$this->getLifecycle()->getStepStorage()->put($rootStep);
311317

318+
// attachments supported since Codeception 3.0
319+
if (version_compare(Codecept::VERSION, '3.0.0') > -1 && $testEvent->getTest() instanceof Cest) {
320+
$artifacts = $testEvent->getTest()->getMetadata()->getReports();
321+
foreach ($artifacts as $name => $artifact) {
322+
Allure::lifecycle()->fire(new AddAttachmentEvent($artifact, $name, null));
323+
}
324+
}
325+
312326
$this->getLifecycle()->fire(new TestCaseFinishedEvent());
313327
}
314328

0 commit comments

Comments
 (0)