Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SuiteObject.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
21  private $name;
22 
28  private $includeTests = [];
29 
35  private $excludeTests = [];
36 
42  private $hooks;
43 
51  public function __construct($name, $includeTests, $excludeTests, $hooks)
52  {
53  $this->name = $name;
54  $this->includeTests = $includeTests;
55  $this->excludeTests = $excludeTests;
56  $this->hooks = $hooks;
57  }
58 
64  public function getName()
65  {
66  return $this->name;
67  }
68 
74  public function getTests()
75  {
76  return $this->resolveTests($this->includeTests, $this->excludeTests);
77  }
78 
88  private function resolveTests($includeTests, $excludeTests)
89  {
90  $finalTestList = $includeTests;
91  $matchingTests = array_intersect(array_keys($includeTests), array_keys($excludeTests));
92 
93  // filter out tests for exclusion here
94  foreach ($matchingTests as $testName) {
95  unset($finalTestList[$testName]);
96  }
97 
98  if (empty($finalTestList)) {
99  trigger_error(
100  "Current suite configuration for " .
101  $this->name . " contains no tests.",
102  E_USER_WARNING
103  );
104  }
105 
106  return $finalTestList;
107  }
108 
115  public function requiresGroupFile()
116  {
117  return !empty($this->hooks);
118  }
119 
125  public function getHooks()
126  {
127  return $this->hooks;
128  }
129 
135  public function getBeforeHook()
136  {
137  return $this->hooks['before'] ?? null;
138  }
139 
145  public function getAfterHook()
146  {
147  return $this->hooks['after'] ?? null;
148  }
149 }
__construct($name, $includeTests, $excludeTests, $hooks)
Definition: SuiteObject.php:51