Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
DefaultTestManifest Class Reference
Inheritance diagram for DefaultTestManifest:
BaseTestManifest SingleRunTestManifest

Public Member Functions

 __construct ($suiteConfiguration, $testPath)
 
 addTest ($testObject)
 
 generate ()
 
- Public Member Functions inherited from BaseTestManifest
 __construct ($path, $runConfig, $suiteConfiguration)
 
 getManifestConfig ()
 
 addTest ($testObject)
 
 generate ()
 

Data Fields

const DEFAULT_CONFIG = 'default'
 

Protected Member Functions

 generateSuiteEntries ($fileResource)
 

Protected Attributes

 $manifestPath
 
 $testNames = []
 
- Protected Attributes inherited from BaseTestManifest
 $runTypeConfig
 
 $relativeDirPath
 
 $suiteConfiguration
 

Detailed Description

Definition at line 12 of file DefaultTestManifest.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $suiteConfiguration,
  $testPath 
)

DefaultTestManifest constructor.

Parameters
array$suiteConfiguration
string$testPath

Definition at line 43 of file DefaultTestManifest.php.

44  {
45  $this->manifestPath = dirname($testPath) . DIRECTORY_SEPARATOR . 'testManifest.txt';
46  $this->cleanManifest($this->manifestPath);
47  parent::__construct($testPath, self::DEFAULT_CONFIG, $suiteConfiguration);
48  }

Member Function Documentation

◆ addTest()

addTest (   $testObject)

Takes a test name and set of tests, records the names in a file for codeception to consume.

Parameters
TestObject$testObject
Returns
void

Definition at line 56 of file DefaultTestManifest.php.

57  {
58  $this->testNames[] = $testObject->getCodeceptionName();
59  }

◆ generate()

generate ( )

Function which outputs a list of all test files to the defined testManifest.txt file.

Returns
void

Definition at line 66 of file DefaultTestManifest.php.

67  {
68  $fileResource = fopen($this->manifestPath, 'a');
69 
70  foreach ($this->testNames as $testName) {
71  $line = $this->relativeDirPath . DIRECTORY_SEPARATOR . $testName . '.php';
72  fwrite($fileResource, $line . PHP_EOL);
73  }
74 
75  $this->generateSuiteEntries($fileResource);
76 
77  fclose($fileResource);
78  }

◆ generateSuiteEntries()

generateSuiteEntries (   $fileResource)
protected

Function which takes the test suites passed to the manifest and generates corresponding entries in the manifest.

Parameters
resource$fileResource
Returns
void

Definition at line 86 of file DefaultTestManifest.php.

87  {
88  foreach ($this->getSuiteConfig() as $suiteName => $tests) {
89  $line = "-g {$suiteName}";
90  fwrite($fileResource, $line . PHP_EOL);
91  }
92  }

Field Documentation

◆ $manifestPath

$manifestPath
protected

Definition at line 21 of file DefaultTestManifest.php.

◆ $testNames

$testNames = []
protected

Definition at line 35 of file DefaultTestManifest.php.

◆ DEFAULT_CONFIG

const DEFAULT_CONFIG = 'default'

Definition at line 14 of file DefaultTestManifest.php.


The documentation for this class was generated from the following file: