5
5
*/
6
6
namespace Magento \FunctionalTestingFramework \Allure \Adapter ;
7
7
8
+ use Magento \FunctionalTestingFramework \Data \Argument \Interpreter \NullType ;
8
9
use Yandex \Allure \Adapter \AllureAdapter ;
9
10
use Codeception \Event \SuiteEvent ;
10
11
@@ -30,7 +31,7 @@ class MagentoAllureAdapter extends AllureAdapter
30
31
*
31
32
* @var array
32
33
*/
33
- protected $ groups ;
34
+ protected $ group ;
34
35
35
36
/**
36
37
* Initialize from parent with group value
@@ -42,7 +43,7 @@ class MagentoAllureAdapter extends AllureAdapter
42
43
// @codingStandardsIgnoreStart
43
44
public function _initialize (array $ ignoredAnnotations = [])
44
45
{
45
- $ this ->groups = $ this ->getGroup ($ this ->groupKey );
46
+ $ this ->group = $ this ->getGroup ($ this ->groupKey );
46
47
parent ::_initialize ($ ignoredAnnotations );
47
48
}
48
49
// @codingStandardsIgnoreEnd
@@ -51,12 +52,14 @@ public function _initialize(array $ignoredAnnotations = [])
51
52
* Array of group values passed to test runner command
52
53
*
53
54
* @param String $groupKey
54
- * @return array
55
+ * @return String
55
56
*/
56
57
private function getGroup ($ groupKey )
57
58
{
58
- $ groups = $ this ->options [$ groupKey ];
59
- return $ groups ;
59
+ if (!($ this ->options [$ groupKey ] == Null )){
60
+ return $ this ->options [$ groupKey ][0 ];
61
+ }
62
+ return null ;
60
63
}
61
64
62
65
/**
@@ -67,25 +70,27 @@ private function getGroup($groupKey)
67
70
*/
68
71
public function suiteBefore (SuiteEvent $ suiteEvent )
69
72
{
70
- $ suite = $ suiteEvent ->getSuite ();
71
- $ group = implode (". " , $ this ->groups );
72
- $ suiteName = ($ suite ->getName ())."- {$ group }" ;
73
+ $ changeSuiteEvent = $ suiteEvent ;
73
74
74
- call_user_func (\Closure::bind (
75
- function () use ($ suite , $ suiteName ) {
76
- $ suite ->name = $ suiteName ;
77
- },
78
- null ,
79
- $ suite
80
- ));
75
+ if ($ this ->group != null ) {
76
+ $ suite = $ suiteEvent ->getSuite ();
77
+ $ suiteName = ($ suite ->getName ()) . "- {$ this ->group }" ;
81
78
82
- //change suiteEvent
83
- $ changeSuiteEvent = new SuiteEvent (
84
- $ suiteEvent ->getSuite (),
85
- $ suiteEvent ->getResult (),
86
- $ suiteEvent ->getSettings ()
87
- );
79
+ call_user_func (\Closure::bind (
80
+ function () use ($ suite , $ suiteName ) {
81
+ $ suite ->name = $ suiteName ;
82
+ },
83
+ null ,
84
+ $ suite
85
+ ));
88
86
87
+ //change suiteEvent
88
+ $ changeSuiteEvent = new SuiteEvent (
89
+ $ suiteEvent ->getSuite (),
90
+ $ suiteEvent ->getResult (),
91
+ $ suiteEvent ->getSettings ()
92
+ );
93
+ }
89
94
// call parent function
90
95
parent ::suiteBefore ($ changeSuiteEvent );
91
96
}
0 commit comments