-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathMagentoActionProxies.php
141 lines (132 loc) · 4.08 KB
/
MagentoActionProxies.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\Module;
use Codeception\Module as CodeceptionModule;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
/**
* Class MagentoActionProxies
*
* Contains all proxy functions whose corresponding MFTF actions need to be accessible for AcceptanceTester $I
*
* @package Magento\FunctionalTestingFramework\Module
*/
class MagentoActionProxies extends CodeceptionModule
{
/**
* Create an entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $entity Name of xml entity to create.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param array $overrideFields Array of FieldName => Value of override fields.
* @param string $storeCode
* @return void
*/
public function createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys = [],
$overrideFields = [],
$storeCode = ''
) {
PersistedObjectHandler::getInstance()->createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$overrideFields,
$storeCode
);
}
/**
* Retrieves and updates a previously created entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $updateEntity Name of the static XML data to update the entity with.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @return void
*/
public function updateEntity($key, $scope, $updateEntity, $dependentObjectKeys = [])
{
PersistedObjectHandler::getInstance()->updateEntity(
$key,
$scope,
$updateEntity,
$dependentObjectKeys
);
}
/**
* Performs GET on given entity and stores entity for use
*
* @param string $key StepKey of getData action.
* @param string $scope
* @param string $entity Name of XML static data to use.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param string $storeCode
* @param integer $index
* @return void
*/
public function getEntity($key, $scope, $entity, $dependentObjectKeys = [], $storeCode = '', $index = null)
{
PersistedObjectHandler::getInstance()->getEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$storeCode,
$index
);
}
/**
* Retrieves and deletes a previously created entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @return void
*/
public function deleteEntity($key, $scope)
{
PersistedObjectHandler::getInstance()->deleteEntity($key, $scope);
}
/**
* Retrieves a field from an entity, according to key and scope given
*
* @param string $stepKey
* @param string $field
* @param string $scope
* @return string
*/
public function retrieveEntityField($stepKey, $field, $scope)
{
return PersistedObjectHandler::getInstance()->retrieveEntityField($stepKey, $field, $scope);
}
/**
* Get encrypted value by key
*
* @param string $key
* @return string|null
* @throws TestFrameworkException
*/
public function getSecret($key)
{
return CredentialStore::getInstance()->getSecret($key);
}
/**
* Returns a value to origin of the action
*
* @param mixed $value
* @return mixed
*/
public function return($value)
{
return $value;
}
}