Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields
TestGenerator Class Reference

Public Member Functions

 getExportDir ()
 
 createAllTestFiles ($testManifest=null, $testsToIgnore=null)
 

Static Public Member Functions

static getInstance ($dir=null, $tests=[], $debug=false)
 

Data Fields

const REQUIRED_ENTITY_REFERENCE = 'createDataKey'
 
const GENERATED_DIR = '_generated'
 
const DEFAULT_DIR = 'default'
 
const TEST_SCOPE = 'test'
 
const HOOK_SCOPE = 'hook'
 
const SUITE_SCOPE = 'suite'
 
const PRESSKEY_ARRAY_ANCHOR_KEY = '987654321098765432109876543210'
 

Detailed Description

Class TestGenerator @SuppressWarnings(PHPMD)

Definition at line 32 of file TestGenerator.php.

Member Function Documentation

◆ createAllTestFiles()

createAllTestFiles (   $testManifest = null,
  $testsToIgnore = null 
)

Assemble ALL PHP strings using the assembleAllTestPhp function. Loop over and pass each array item to the createCestFile function.

Parameters
BaseTestManifest$testManifest
array$testsToIgnore
Returns
void
Exceptions
TestReferenceException

Definition at line 188 of file TestGenerator.php.

189  {
190  if ($this->tests === null) {
191  // no-op if the test configuration is null
192  return;
193  }
194 
195  DirSetupUtil::createGroupDir($this->exportDirectory);
196  if ($testsToIgnore === null) {
197  $testsToIgnore = SuiteObjectHandler::getInstance()->getAllTestReferences();
198  }
199 
200  $testPhpArray = $this->assembleAllTestPhp($testManifest, $testsToIgnore);
201  foreach ($testPhpArray as $testPhpFile) {
202  $this->createCestFile($testPhpFile[1], $testPhpFile[0]);
203  }
204  }

◆ getExportDir()

getExportDir ( )

Returns the absolute path to the test export director for the generator instance.

Returns
string

Definition at line 124 of file TestGenerator.php.

125  {
126  return $this->exportDirectory;
127  }

◆ getInstance()

static getInstance (   $dir = null,
  $tests = [],
  $debug = false 
)
static

Singleton method to retrieve Test Generator

Parameters
string$dir
array$tests
boolean$debug
Returns
TestGenerator

Definition at line 114 of file TestGenerator.php.

115  {
116  return new TestGenerator($dir, $tests, $debug);
117  }
$debug
Definition: router.php:22

Field Documentation

◆ DEFAULT_DIR

const DEFAULT_DIR = 'default'

Definition at line 36 of file TestGenerator.php.

◆ GENERATED_DIR

const GENERATED_DIR = '_generated'

Definition at line 35 of file TestGenerator.php.

◆ HOOK_SCOPE

const HOOK_SCOPE = 'hook'

Definition at line 38 of file TestGenerator.php.

◆ PRESSKEY_ARRAY_ANCHOR_KEY

const PRESSKEY_ARRAY_ANCHOR_KEY = '987654321098765432109876543210'

Definition at line 40 of file TestGenerator.php.

◆ REQUIRED_ENTITY_REFERENCE

const REQUIRED_ENTITY_REFERENCE = 'createDataKey'

Definition at line 34 of file TestGenerator.php.

◆ SUITE_SCOPE

const SUITE_SCOPE = 'suite'

Definition at line 39 of file TestGenerator.php.

◆ TEST_SCOPE

const TEST_SCOPE = 'test'

Definition at line 37 of file TestGenerator.php.


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