@@ -48,6 +48,12 @@ public function testUnloginAction()
48
48
$ this ->createPartialMock (\Magento \Framework \App \DeploymentConfig::class, ['isAvailable ' ]);
49
49
$ deployConfigMock ->expects ($ this ->once ())->method ('isAvailable ' )->will ($ this ->returnValue (true ));
50
50
51
+ $ sessionMock = $ this ->createPartialMock (
52
+ \Magento \Backend \Model \Auth \Session::class,
53
+ ['prolong ' , 'isSessionExists ' ]
54
+ );
55
+ $ sessionMock ->expects ($ this ->once ())->method ('isSessionExists ' )->will ($ this ->returnValue (false ));
56
+
51
57
$ stateMock = $ this ->createPartialMock (\Magento \Framework \App \State::class, ['setAreaCode ' ]);
52
58
$ stateMock ->expects ($ this ->once ())->method ('setAreaCode ' );
53
59
@@ -57,6 +63,7 @@ public function testUnloginAction()
57
63
$ urlMock = $ this ->createMock (\Magento \Backend \Model \Url::class);
58
64
59
65
$ returnValueMap = [
66
+ [\Magento \Backend \Model \Auth \Session::class, $ sessionMock ],
60
67
[\Magento \Framework \App \State::class, $ stateMock ],
61
68
[\Magento \Backend \Model \Session \AdminConfig::class, $ sessionConfigMock ],
62
69
[\Magento \Backend \Model \Url::class, $ urlMock ]
@@ -68,7 +75,6 @@ public function testUnloginAction()
68
75
->method ('get ' )
69
76
->will ($ this ->returnValueMap ($ returnValueMap ));
70
77
71
- $ sessionMock = $ this ->createPartialMock (\Magento \Backend \Model \Auth \Session::class, ['prolong ' ]);
72
78
$ this ->objectManager ->expects ($ this ->once ())
73
79
->method ('create ' )
74
80
->will ($ this ->returnValue ($ sessionMock ));
@@ -87,4 +93,29 @@ public function testIndexAction()
87
93
$ viewModel = $ controller ->unloginAction ();
88
94
$ this ->assertInstanceOf (\Zend \View \Model \ViewModel::class, $ viewModel );
89
95
}
96
+
97
+ /**
98
+ * @covers \Magento\Setup\Controller\SystemConfig::prolongAction
99
+ */
100
+ public function testProlongActionWithExistingSession ()
101
+ {
102
+ $ this ->objectManagerProvider ->expects ($ this ->once ())->method ('get ' )->will (
103
+ $ this ->returnValue ($ this ->objectManager )
104
+ );
105
+ $ deployConfigMock =
106
+ $ this ->createPartialMock (\Magento \Framework \App \DeploymentConfig::class, ['isAvailable ' ]);
107
+ $ deployConfigMock ->expects ($ this ->once ())->method ('isAvailable ' )->will ($ this ->returnValue (true ));
108
+ $ sessionMock = $ this ->createPartialMock (
109
+ \Magento \Backend \Model \Auth \Session::class,
110
+ ['prolong ' , 'isSessionExists ' ]
111
+ );
112
+ $ sessionMock ->expects ($ this ->once ())->method ('isSessionExists ' )->will ($ this ->returnValue (true ));
113
+
114
+ $ this ->serviceManager ->expects ($ this ->once ())->method ('get ' )->will ($ this ->returnValue ($ deployConfigMock ));
115
+ $ this ->objectManager ->expects ($ this ->once ())
116
+ ->method ('get ' )
117
+ ->will ($ this ->returnValue ($ sessionMock ));
118
+ $ controller = new Session ($ this ->serviceManager , $ this ->objectManagerProvider );
119
+ $ this ->assertEquals (new \Zend \View \Model \JsonModel (['success ' => true ]), $ controller ->prolongAction ());
120
+ }
90
121
}
0 commit comments