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

Public Member Functions

 withName ($name)
 
 withAnnotations ($annotations=null)
 
 withBeforeHook ($beforeHook=null)
 
 withAfterHook ($afterHook=null)
 
 withFailedHook ($failedHook=null)
 
 withTestActions ($actions=null)
 
 withFileName ($filename=null)
 
 withTestReference ($reference=null)
 
 build ()
 

Data Fields

 $testName = 'testTest'
 
 $filename = null
 
 $testActionBeforeName = 'testActionBefore'
 
 $testActionAfterName = 'testActionAfter'
 
 $testActionFailedName = 'testActionFailed'
 
 $testTestActionName = 'testActionInTest'
 
 $testActionType = 'testAction'
 

Detailed Description

Definition at line 13 of file TestDataArrayBuilder.php.

Member Function Documentation

◆ build()

build ( )

Output the resulting test data array based on parameters set in the object

Returns
array

Definition at line 240 of file TestDataArrayBuilder.php.

241  {
242  // return a static data array representing a single test
243  return [$this->testName => array_merge(
244  [
245  TestObjectExtractor::NAME => $this->testName,
246  TestObjectExtractor::TEST_ANNOTATIONS => $this->annotations,
247  TestObjectExtractor::TEST_BEFORE_HOOK => $this->beforeHook,
248  TestObjectExtractor::TEST_AFTER_HOOK => $this->afterHook,
249  TestObjectExtractor::TEST_FAILED_HOOK => $this->failedHook,
250  "filename" => $this->filename,
251  "extends" => $this->testReference
252  ],
253  $this->testActions
254  )];
255  }

◆ withAfterHook()

withAfterHook (   $afterHook = null)

Add an after hook passed in by arg (or default if no arg)

Parameters
null$afterHook
Returns
$this

Definition at line 147 of file TestDataArrayBuilder.php.

148  {
149  if ($afterHook == null) {
150  $this->afterHook = [$this->testActionAfterName => [
153 
154  ]];
155  } else {
156  $this->afterHook = $afterHook;
157  }
158 
159  return $this;
160  }

◆ withAnnotations()

withAnnotations (   $annotations = null)

Add annotations passed in by arg (or default if no arg)

Parameters
array$annotations
Returns
$this

Definition at line 110 of file TestDataArrayBuilder.php.

111  {
112  if ($annotations == null) {
113  $this->annotations = ['group' => [['value' => 'test']]];
114  } else {
115  $this->annotations = $annotations;
116  }
117 
118  return $this;
119  }

◆ withBeforeHook()

withBeforeHook (   $beforeHook = null)

Add a before hook passed in by arg (or default if no arg)

Parameters
null$beforeHook
Returns
$this

Definition at line 127 of file TestDataArrayBuilder.php.

128  {
129  if ($beforeHook == null) {
130  $this->beforeHook = [$this->testActionBeforeName => [
133  ]];
134  } else {
135  $this->beforeHook = $beforeHook;
136  }
137 
138  return $this;
139  }

◆ withFailedHook()

withFailedHook (   $failedHook = null)

Add a failed hook passed in by arg (or default if no arg)

Parameters
null$failedHook
Returns
$this

Definition at line 168 of file TestDataArrayBuilder.php.

169  {
170  if ($failedHook == null) {
171  $this->failedHook = [$this->testActionFailedName => [
174 
175  ]];
176  } else {
177  $this->failedHook = $failedHook;
178  }
179 
180  return $this;
181  }

◆ withFileName()

withFileName (   $filename = null)

Add file name passe in by arg (or default if no arg)

Parameters
string$filename
Returns
$this

Definition at line 208 of file TestDataArrayBuilder.php.

209  {
210  if ($filename == null) {
211  $this->filename =
212  "/magento2-functional-testing-framework/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml";
213  } else {
214  $this->filename = $filename;
215  }
216 
217  return $this;
218  }

◆ withName()

withName (   $name)
Parameters
string$name
Returns
$this

Definition at line 98 of file TestDataArrayBuilder.php.

99  {
100  $this->testName = $name;
101  return $this;
102  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ withTestActions()

withTestActions (   $actions = null)

Add test actions passed in by arg (or default if no arg)

Parameters
array$actions
Returns
$this

Definition at line 189 of file TestDataArrayBuilder.php.

190  {
191  if ($actions == null) {
192  $this->testActions = [$this->testTestActionName => [
195  ]];
196  } else {
197  $this->testActions = $actions;
198  }
199 
200  return $this;
201  }

◆ withTestReference()

withTestReference (   $reference = null)

Add test reference passed in by arg (or default if no arg)

Parameters
string$reference
Returns
$this

Definition at line 226 of file TestDataArrayBuilder.php.

227  {
228  if ($reference != null) {
229  $this->testReference = $reference;
230  }
231 
232  return $this;
233  }

Field Documentation

◆ $filename

$filename = null

Definition at line 27 of file TestDataArrayBuilder.php.

◆ $testActionAfterName

$testActionAfterName = 'testActionAfter'

Definition at line 41 of file TestDataArrayBuilder.php.

◆ $testActionBeforeName

$testActionBeforeName = 'testActionBefore'

Definition at line 34 of file TestDataArrayBuilder.php.

◆ $testActionFailedName

$testActionFailedName = 'testActionFailed'

Definition at line 48 of file TestDataArrayBuilder.php.

◆ $testActionType

$testActionType = 'testAction'

Definition at line 62 of file TestDataArrayBuilder.php.

◆ $testName

$testName = 'testTest'

Definition at line 20 of file TestDataArrayBuilder.php.

◆ $testTestActionName

$testTestActionName = 'testActionInTest'

Definition at line 55 of file TestDataArrayBuilder.php.


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