Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BaseTestManifest.php
Go to the documentation of this file.
1 <?php
8 
12 
13 abstract class BaseTestManifest
14 {
20  protected $runTypeConfig;
21 
27  protected $relativeDirPath;
28 
35 
43  public function __construct($path, $runConfig, $suiteConfiguration)
44  {
45  $this->runTypeConfig = $runConfig;
46  $relativeDirPath = substr($path, strlen(TESTS_BP));
47  $this->relativeDirPath = ltrim($relativeDirPath, DIRECTORY_SEPARATOR);
48  $this->suiteConfiguration = $suiteConfiguration;
49  }
50 
56  public function getManifestConfig()
57  {
58  return $this->runTypeConfig;
59  }
60 
67  abstract public function addTest($testObject);
68 
74  abstract public function generate();
75 
81  public function getSuiteConfig()
82  {
83  if ($this->suiteConfiguration === null) {
84  return [];
85  }
86 
87  $suiteToTestNames = [];
88  if (empty($this->suiteConfiguration)) {
89  // if there is no configuration passed we can assume the user wants all suites generated as specified.
90  foreach (SuiteObjectHandler::getInstance()->getAllObjects() as $suite => $suiteObj) {
92  $suiteToTestNames[$suite] = array_keys($suiteObj->getTests());
93  }
94  } else {
95  // we need to loop through the configuration to make sure we capture suites with no specific config
96  foreach ($this->suiteConfiguration as $suiteName => $test) {
97  if (empty($test)) {
98  $suiteToTestNames[$suiteName] =
99  array_keys(SuiteObjectHandler::getInstance()->getObject($suiteName)->getTests());
100  continue;
101  }
102 
103  $suiteToTestNames[$suiteName] = $test;
104  }
105  }
106 
107  return $suiteToTestNames;
108  }
109 }