@@ -32,15 +32,20 @@ class HttpTest extends \PHPUnit_Framework_TestCase
32
32
protected $ _infoProcessorMock ;
33
33
34
34
/**
35
- * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager | \PHPUnit_Framework_MockObject_MockObject
35
+ * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager | \PHPUnit_Framework_MockObject_MockObject
36
36
*/
37
- protected $ objectManager ;
37
+ protected $ objectManagerMock ;
38
38
39
39
/**
40
- * @var \Magento\Framework\Stdlib\StringUtils | \PHPUnit_Framework_MockObject_MockObject
40
+ * @var \Magento\Framework\Stdlib\StringUtils | \PHPUnit_Framework_MockObject_MockObject
41
41
*/
42
42
protected $ converterMock ;
43
43
44
+ /**
45
+ * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
46
+ */
47
+ private $ objectManager ;
48
+
44
49
/**
45
50
* @var array
46
51
*/
@@ -58,7 +63,7 @@ protected function setUp()
58
63
);
59
64
$ this ->_infoProcessorMock = $ this ->getMock ('Magento\Framework\App\Request\PathInfoProcessorInterface ' );
60
65
$ this ->_infoProcessorMock ->expects ($ this ->any ())->method ('process ' )->will ($ this ->returnArgument (1 ));
61
- $ this ->objectManager = $ this ->getMock ('Magento\Framework\ObjectManagerInterface ' );
66
+ $ this ->objectManagerMock = $ this ->getMock ('Magento\Framework\ObjectManagerInterface ' );
62
67
$ this ->converterMock = $ this ->getMockBuilder ('Magento\Framework\Stdlib\StringUtils ' )
63
68
->disableOriginalConstructor ()
64
69
->setMethods (['cleanString ' ])
@@ -67,6 +72,8 @@ protected function setUp()
67
72
68
73
// Stash the $_SERVER array to protect it from modification in test
69
74
$ this ->serverArray = $ _SERVER ;
75
+
76
+ $ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
70
77
}
71
78
72
79
public function tearDown ()
@@ -77,23 +84,23 @@ public function tearDown()
77
84
/**
78
85
* @return \Magento\Framework\App\Request\Http
79
86
*/
80
- private function getModel ($ uri = null , $ mockAppConfig = true )
87
+ private function getModel ($ uri = null , $ appConfigMock = true )
81
88
{
82
89
83
90
$ model = $ this ->objectManager ->getObject (
84
91
'Magento\Framework\App\Request\Http ' ,
85
92
[
86
93
'routeConfig ' => $ this ->_routerListMock ,
87
94
'pathInfoProcessor ' => $ this ->_infoProcessorMock ,
88
- 'objectManager ' => $ this ->objectManager ,
95
+ 'objectManager ' => $ this ->objectManagerMock ,
89
96
'converter ' => $ this ->converterMock ,
90
97
'uri ' => $ uri ,
91
98
]
92
99
);
93
100
94
- if ($ mockAppConfig ) {
95
- $ mockConfig = $ this ->getMock (\Magento \Framework \App \Config::class, [], [], '' , false );
96
- $ this ->objectManager ->setBackwardCompatibleProperty ($ model , 'appConfig ' , $ mockConfig );
101
+ if ($ appConfigMock ) {
102
+ $ configMock = $ this ->getMock (\Magento \Framework \App \Config::class, [], [], '' , false );
103
+ $ this ->objectManager ->setBackwardCompatibleProperty ($ model , 'appConfig ' , $ configMock );
97
104
}
98
105
99
106
return $ model ;
@@ -348,7 +355,7 @@ public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $header
348
355
->willReturn ($ configOffloadHeader );
349
356
350
357
$ this ->objectManager ->setBackwardCompatibleProperty ($ this ->_model , 'appConfig ' , $ configMock );
351
- $ this ->objectManager ->setBackwardCompatibleProperty ($ this ->_model , 'SSLOffloadHeader ' , null );
358
+ $ this ->objectManager ->setBackwardCompatibleProperty ($ this ->_model , 'sslOffloadHeader ' , null );
352
359
353
360
$ this ->_model ->getServer ()->set ($ headerOffloadKey , $ headerOffloadValue );
354
361
$ this ->_model ->getServer ()->set ('HTTPS ' , $ serverHttps );
0 commit comments