Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\Allure\Adapter;

use Magento\FunctionalTestingFramework\Data\Argument\Interpreter\NullType;
use Yandex\Allure\Adapter\AllureAdapter;
use Codeception\Event\SuiteEvent;

/**
* Class MagentoAllureAdapter
*
* Extends AllureAdapter to provide further information for allure reports
*
* @package Magento\FunctionalTestingFramework\Allure
*/

class MagentoAllureAdapter extends AllureAdapter
{
/**
* Array of group values passed to test runner command
*
* @return String
*/
private function getGroup()
{
if ($this->options['groups'] != null) {
return $this->options['groups'][0];
}
return null;
}

/**
* Override of parent method to set suitename as suitename and group name concatenated
*
* @param SuiteEvent $suiteEvent
* @return void
*/
public function suiteBefore(SuiteEvent $suiteEvent)
{
$changeSuiteEvent = $suiteEvent;

if ($this->getGroup() != null) {
$suite = $suiteEvent->getSuite();
$suiteName = ($suite->getName()) . "\\" . $this->getGroup();

call_user_func(\Closure::bind(
function () use ($suite, $suiteName) {
$suite->name = $suiteName;
},
null,
$suite
));

//change suiteEvent
$changeSuiteEvent = new SuiteEvent(
$suiteEvent->getSuite(),
$suiteEvent->getResult(),
$suiteEvent->getSettings()
);
}
// call parent function
parent::suiteBefore($changeSuiteEvent);
}
}