1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2015 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
8
8
namespace Magento \Sales \Test \Unit \Helper ;
9
9
10
- use Magento \Customer \Model \Session ;
11
10
use Magento \Framework \App \Config ;
12
11
use Magento \Framework \App \Config \ScopeConfigInterface ;
13
12
use Magento \Framework \App \Helper \Context ;
@@ -40,11 +39,6 @@ class ReorderTest extends TestCase
40
39
*/
41
40
protected $ orderMock ;
42
41
43
- /**
44
- * @var MockObject|Session
45
- */
46
- protected $ customerSessionMock ;
47
-
48
42
/**
49
43
* @var OrderRepositoryInterface|MockObject
50
44
*/
@@ -66,15 +60,10 @@ protected function setUp(): void
66
60
->method ('getScopeConfig ' )
67
61
->willReturn ($ this ->scopeConfigMock );
68
62
69
- $ this ->customerSessionMock = $ this ->getMockBuilder (Session::class)
70
- ->disableOriginalConstructor ()
71
- ->getMock ();
72
-
73
63
$ this ->repositoryMock = $ this ->getMockBuilder (OrderRepositoryInterface::class)
74
64
->getMockForAbstractClass ();
75
65
$ this ->helper = new Reorder (
76
66
$ contextMock ,
77
- $ this ->customerSessionMock ,
78
67
$ this ->repositoryMock
79
68
);
80
69
@@ -156,40 +145,17 @@ public function testCanReorderStoreNotAllowed()
156
145
$ this ->assertFalse ($ this ->helper ->canReorder (1 ));
157
146
}
158
147
159
- /**
160
- * Tests what happens if the customer is not logged in and the store does allow re-orders.
161
- *
162
- * @return void
163
- */
164
- public function testCanReorderCustomerNotLoggedIn ()
165
- {
166
- $ this ->setupOrderMock (true );
167
-
168
- $ this ->customerSessionMock ->expects ($ this ->once ())
169
- ->method ('isLoggedIn ' )
170
- ->willReturn (false );
171
- $ this ->repositoryMock ->expects ($ this ->once ())
172
- ->method ('get ' )
173
- ->with (1 )
174
- ->willReturn ($ this ->orderMock );
175
- $ this ->assertTrue ($ this ->helper ->canReorder (1 ));
176
- }
177
-
178
148
/**
179
149
* Tests what happens if the customer is logged in and the order does or does not allow reorders.
180
150
*
181
151
* @param bool $orderCanReorder
182
152
* @return void
183
153
* @dataProvider getOrderCanReorder
184
154
*/
185
- public function testCanReorderCustomerLoggedInAndOrderCanReorder ($ orderCanReorder )
155
+ public function testCanReorder ($ orderCanReorder )
186
156
{
187
157
$ this ->setupOrderMock (true );
188
158
189
- $ this ->customerSessionMock ->expects ($ this ->once ())
190
- ->method ('isLoggedIn ' )
191
- ->willReturn (true );
192
-
193
159
$ this ->orderMock ->expects ($ this ->once ())
194
160
->method ('canReorder ' )
195
161
->willReturn ($ orderCanReorder );
0 commit comments