-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathTestHookObject.php
88 lines (77 loc) · 1.78 KB
/
TestHookObject.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\Test\Objects;
use Magento\FunctionalTestingFramework\Test\Util\ActionMergeUtil;
use Magento\FunctionalTestingFramework\Test\Util\TestObjectExtractor;
/**
* Class TestHookObject
*/
class TestHookObject
{
/**
* Type of Hook (i.e. before or after).
*
* @var string
*/
private $type;
/**
* Name of parent object
*
* @var string
*/
private $parentName;
/**
* Array which contains the action objects to be executed in a hook.
*
* @var array
*/
private $actions = [];
/**
* Array of Hook-defined data.
* @var array|null
*/
private $customData = [];
/**
* TestHookObject constructor.
* @param string $type
* @param string $parentName
* @param array $actions
*/
public function __construct($type, $parentName, $actions)
{
$this->type = $type;
$this->parentName = $parentName;
$this->actions = $actions;
}
/**
* Getter for hook type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Returns an array of action objects to be executed within the hook.
*
* @return array
*/
public function getActions()
{
$mergeUtil = new ActionMergeUtil($this->parentName, $this->getType());
$mergedSteps = $mergeUtil->resolveActionSteps($this->actions);
return $mergedSteps;
}
/**
* Returns an array of customData to be interperpreted by the generator.
* @return array|null
*/
public function getCustomData()
{
return $this->customData;
}
}