-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathPrimary.php
71 lines (65 loc) · 2.72 KB
/
Primary.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
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\ObjectManager\ConfigLoader;
/**
* Class Primary
* Primary DI configuration loader
*
* @internal
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
// @codingStandardsIgnoreFile
class Primary
{
/**
* Framework mode
*
* @var string
*/
protected $appMode = 'developer';
/**
* Load primary DI configuration
*
* @return array
*/
public function load()
{
$reader = new \Magento\FunctionalTestingFramework\ObjectManager\Config\Reader\Dom(
new \Magento\FunctionalTestingFramework\Config\FileResolver\Primary(),
new \Magento\FunctionalTestingFramework\ObjectManager\Config\Mapper\Dom(
$this->createArgumentInterpreter()
),
new \Magento\FunctionalTestingFramework\ObjectManager\Config\SchemaLocator(),
new \Magento\FunctionalTestingFramework\Config\ValidationState($this->appMode)
);
return $reader->read();
}
/**
* Return newly created instance on an argument interpreter, suitable for processing DI arguments
*
* @return \Magento\FunctionalTestingFramework\Data\Argument\InterpreterInterface
*/
protected function createArgumentInterpreter()
{
$booleanUtils = new \Magento\FunctionalTestingFramework\Stdlib\BooleanUtils();
$constInterpreter = new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Constant();
$result = new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Composite(
[
'boolean' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Boolean($booleanUtils),
'string' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\StringUtils($booleanUtils),
'number' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Number(),
'null' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\NullType(),
'object' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\DataObject($booleanUtils),
'const' => $constInterpreter,
'init_parameter' => new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Argument($constInterpreter)
],
\Magento\FunctionalTestingFramework\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE
);
// Add interpreters that reference the composite
$result->addInterpreter('array', new \Magento\FunctionalTestingFramework\Data\Argument\Interpreter\ArrayType($result));
return $result;
}
}