55 */
66namespace Magento \FunctionalTestingFramework \Allure \Adapter ;
77
8+ use Magento \FunctionalTestingFramework \Data \Argument \Interpreter \NullType ;
89use Yandex \Allure \Adapter \AllureAdapter ;
910use Codeception \Event \SuiteEvent ;
1011
@@ -30,7 +31,7 @@ class MagentoAllureAdapter extends AllureAdapter
3031 *
3132 * @var array
3233 */
33- protected $ groups ;
34+ protected $ group ;
3435
3536 /**
3637 * Initialize from parent with group value
@@ -42,7 +43,7 @@ class MagentoAllureAdapter extends AllureAdapter
4243 // @codingStandardsIgnoreStart
4344 public function _initialize (array $ ignoredAnnotations = [])
4445 {
45- $ this ->groups = $ this ->getGroup ($ this ->groupKey );
46+ $ this ->group = $ this ->getGroup ($ this ->groupKey );
4647 parent ::_initialize ($ ignoredAnnotations );
4748 }
4849 // @codingStandardsIgnoreEnd
@@ -51,12 +52,14 @@ public function _initialize(array $ignoredAnnotations = [])
5152 * Array of group values passed to test runner command
5253 *
5354 * @param String $groupKey
54- * @return array
55+ * @return String
5556 */
5657 private function getGroup ($ groupKey )
5758 {
58- $ groups = $ this ->options [$ groupKey ];
59- return $ groups ;
59+ if (!($ this ->options [$ groupKey ] == Null )){
60+ return $ this ->options [$ groupKey ][0 ];
61+ }
62+ return null ;
6063 }
6164
6265 /**
@@ -67,25 +70,27 @@ private function getGroup($groupKey)
6770 */
6871 public function suiteBefore (SuiteEvent $ suiteEvent )
6972 {
70- $ suite = $ suiteEvent ->getSuite ();
71- $ group = implode (". " , $ this ->groups );
72- $ suiteName = ($ suite ->getName ())."- {$ group }" ;
73+ $ changeSuiteEvent = $ suiteEvent ;
7374
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 }" ;
8178
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+ ));
8886
87+ //change suiteEvent
88+ $ changeSuiteEvent = new SuiteEvent (
89+ $ suiteEvent ->getSuite (),
90+ $ suiteEvent ->getResult (),
91+ $ suiteEvent ->getSettings ()
92+ );
93+ }
8994 // call parent function
9095 parent ::suiteBefore ($ changeSuiteEvent );
9196 }
0 commit comments