@@ -37,11 +37,6 @@ class StoreCookieTest extends \PHPUnit_Framework_TestCase
37
37
*/
38
38
protected $ storeMock ;
39
39
40
- /**
41
- * @var \Closure
42
- */
43
- protected $ closureMock ;
44
-
45
40
/**
46
41
* @var \Magento\Framework\App\FrontController|\PHPUnit_Framework_MockObject_MockObject
47
42
*/
@@ -77,10 +72,6 @@ public function setUp()
77
72
->setMethods ([])
78
73
->getMock ();
79
74
80
- $ this ->closureMock = function () {
81
- return 'ExpectedValue ' ;
82
- };
83
-
84
75
$ this ->subjectMock = $ this ->getMockBuilder ('Magento\Framework\App\FrontController ' )
85
76
->disableOriginalConstructor ()
86
77
->setMethods ([])
@@ -106,7 +97,7 @@ public function setUp()
106
97
);
107
98
}
108
99
109
- public function testAroundDispatchNoSuchEntity ()
100
+ public function testBeforeDispatchNoSuchEntity ()
110
101
{
111
102
$ storeCode = 'store ' ;
112
103
$ this ->storeManagerMock ->expects ($ this ->once ())->method ('getDefaultStoreView ' )->willReturn ($ this ->storeMock );
@@ -115,13 +106,10 @@ public function testAroundDispatchNoSuchEntity()
115
106
->method ('getActiveStoreByCode ' )
116
107
->willThrowException (new NoSuchEntityException );
117
108
$ this ->storeCookieManagerMock ->expects ($ this ->once ())->method ('deleteStoreCookie ' )->with ($ this ->storeMock );
118
- $ this ->assertEquals (
119
- 'ExpectedValue ' ,
120
- $ this ->plugin ->aroundDispatch ($ this ->subjectMock , $ this ->closureMock , $ this ->requestMock )
121
- );
109
+ $ this ->plugin ->beforeDispatch ($ this ->subjectMock , $ this ->requestMock );
122
110
}
123
111
124
- public function testAroundDispatchStoreIsInactive ()
112
+ public function testBeforeDispatchStoreIsInactive ()
125
113
{
126
114
$ storeCode = 'store ' ;
127
115
$ this ->storeManagerMock ->expects ($ this ->once ())->method ('getDefaultStoreView ' )->willReturn ($ this ->storeMock );
@@ -130,13 +118,10 @@ public function testAroundDispatchStoreIsInactive()
130
118
->method ('getActiveStoreByCode ' )
131
119
->willThrowException (new StoreIsInactiveException );
132
120
$ this ->storeCookieManagerMock ->expects ($ this ->once ())->method ('deleteStoreCookie ' )->with ($ this ->storeMock );
133
- $ this ->assertEquals (
134
- 'ExpectedValue ' ,
135
- $ this ->plugin ->aroundDispatch ($ this ->subjectMock , $ this ->closureMock , $ this ->requestMock )
136
- );
121
+ $ this ->plugin ->beforeDispatch ($ this ->subjectMock , $ this ->requestMock );
137
122
}
138
123
139
- public function testAroundDispatchInvalidArgument ()
124
+ public function testBeforeDispatchInvalidArgument ()
140
125
{
141
126
$ storeCode = 'store ' ;
142
127
$ this ->storeManagerMock ->expects ($ this ->once ())->method ('getDefaultStoreView ' )->willReturn ($ this ->storeMock );
@@ -145,22 +130,16 @@ public function testAroundDispatchInvalidArgument()
145
130
->method ('getActiveStoreByCode ' )
146
131
->willThrowException (new InvalidArgumentException );
147
132
$ this ->storeCookieManagerMock ->expects ($ this ->once ())->method ('deleteStoreCookie ' )->with ($ this ->storeMock );
148
- $ this ->assertEquals (
149
- 'ExpectedValue ' ,
150
- $ this ->plugin ->aroundDispatch ($ this ->subjectMock , $ this ->closureMock , $ this ->requestMock )
151
- );
133
+ $ this ->plugin ->beforeDispatch ($ this ->subjectMock , $ this ->requestMock );
152
134
}
153
135
154
- public function testAroundDispatchNoStoreCookie ()
136
+ public function testBeforeDispatchNoStoreCookie ()
155
137
{
156
138
$ storeCode = null ;
157
- $ this ->storeManagerMock ->expects ($ this ->once ())->method ('getDefaultStoreView ' )->willReturn ($ this ->storeMock );
158
139
$ this ->storeCookieManagerMock ->expects ($ this ->once ())->method ('getStoreCodeFromCookie ' )->willReturn ($ storeCode );
140
+ $ this ->storeManagerMock ->expects ($ this ->never ())->method ('getDefaultStoreView ' )->willReturn ($ this ->storeMock );
159
141
$ this ->storeRepositoryMock ->expects ($ this ->never ())->method ('getActiveStoreByCode ' );
160
142
$ this ->storeCookieManagerMock ->expects ($ this ->never ())->method ('deleteStoreCookie ' )->with ($ this ->storeMock );
161
- $ this ->assertEquals (
162
- 'ExpectedValue ' ,
163
- $ this ->plugin ->aroundDispatch ($ this ->subjectMock , $ this ->closureMock , $ this ->requestMock )
164
- );
143
+ $ this ->plugin ->beforeDispatch ($ this ->subjectMock , $ this ->requestMock );
165
144
}
166
145
}
0 commit comments