File tree Expand file tree Collapse file tree 2 files changed +116
-0
lines changed
src/Magento/FunctionalTestingFramework/Filter/Test Expand file tree Collapse file tree 2 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \FunctionalTestingFramework \Filter \Test ;
10
+
11
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
12
+ use Magento \FunctionalTestingFramework \Filter \FilterInterface ;
13
+ use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
14
+
15
+ /**
16
+ * Class ExcludeGroup
17
+ */
18
+ class ExcludeGroup implements FilterInterface
19
+ {
20
+ const ANNOTATION_TAG = 'group ' ;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ private $ filterValues = [];
26
+
27
+ /**
28
+ * Group constructor.
29
+ *
30
+ * @param array $filterValues
31
+ * @throws TestFrameworkException
32
+ */
33
+ public function __construct (array $ filterValues = [])
34
+ {
35
+ $ this ->filterValues = $ filterValues ;
36
+ }
37
+
38
+ /**
39
+ * Filter tests by group.
40
+ *
41
+ * @param TestObject[] $tests
42
+ * @return void
43
+ */
44
+ public function filter (array &$ tests )
45
+ {
46
+ if ($ this ->filterValues === []) {
47
+ return ;
48
+ }
49
+ /** @var TestObject $test */
50
+ foreach ($ tests as $ testName => $ test ) {
51
+ $ groups = $ test ->getAnnotationByName (self ::ANNOTATION_TAG );
52
+ $ testExcludeGroup = !empty (array_intersect ($ groups , $ this ->filterValues ));
53
+ if ($ testExcludeGroup ) {
54
+ unset($ tests [$ testName ]);
55
+ }
56
+ }
57
+ }
58
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \FunctionalTestingFramework \Filter \Test ;
10
+
11
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
12
+ use Magento \FunctionalTestingFramework \Filter \FilterInterface ;
13
+ use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
14
+
15
+ /**
16
+ * Class IncludeGroup
17
+ */
18
+ class IncludeGroup implements FilterInterface
19
+ {
20
+ const ANNOTATION_TAG = 'group ' ;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ private $ filterValues = [];
26
+
27
+ /**
28
+ * Group constructor.
29
+ *
30
+ * @param array $filterValues
31
+ * @throws TestFrameworkException
32
+ */
33
+ public function __construct (array $ filterValues = [])
34
+ {
35
+ $ this ->filterValues = $ filterValues ;
36
+ }
37
+
38
+ /**
39
+ * Filter tests by group.
40
+ *
41
+ * @param TestObject[] $tests
42
+ * @return void
43
+ */
44
+ public function filter (array &$ tests )
45
+ {
46
+ if ($ this ->filterValues === []) {
47
+ return ;
48
+ }
49
+ /** @var TestObject $test */
50
+ foreach ($ tests as $ testName => $ test ) {
51
+ $ groups = $ test ->getAnnotationByName (self ::ANNOTATION_TAG );
52
+ $ testIncludeGroup = empty (array_intersect ($ groups , $ this ->filterValues ));
53
+ if ($ testIncludeGroup ) {
54
+ unset($ tests [$ testName ]);
55
+ }
56
+ }
57
+ }
58
+ }
You can’t perform that action at this time.
0 commit comments