11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2015 Adobe
4+ * All Rights Reserved .
55 */
66declare (strict_types=1 );
77
88namespace Magento \Sales \Test \Unit \Helper ;
99
10- use Magento \Customer \Model \Session ;
1110use Magento \Framework \App \Config ;
1211use Magento \Framework \App \Config \ScopeConfigInterface ;
1312use Magento \Framework \App \Helper \Context ;
@@ -40,11 +39,6 @@ class ReorderTest extends TestCase
4039 */
4140 protected $ orderMock ;
4241
43- /**
44- * @var MockObject|Session
45- */
46- protected $ customerSessionMock ;
47-
4842 /**
4943 * @var OrderRepositoryInterface|MockObject
5044 */
@@ -66,15 +60,10 @@ protected function setUp(): void
6660 ->method ('getScopeConfig ' )
6761 ->willReturn ($ this ->scopeConfigMock );
6862
69- $ this ->customerSessionMock = $ this ->getMockBuilder (Session::class)
70- ->disableOriginalConstructor ()
71- ->getMock ();
72-
7363 $ this ->repositoryMock = $ this ->getMockBuilder (OrderRepositoryInterface::class)
7464 ->getMockForAbstractClass ();
7565 $ this ->helper = new Reorder (
7666 $ contextMock ,
77- $ this ->customerSessionMock ,
7867 $ this ->repositoryMock
7968 );
8069
@@ -156,40 +145,17 @@ public function testCanReorderStoreNotAllowed()
156145 $ this ->assertFalse ($ this ->helper ->canReorder (1 ));
157146 }
158147
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-
178148 /**
179149 * Tests what happens if the customer is logged in and the order does or does not allow reorders.
180150 *
181151 * @param bool $orderCanReorder
182152 * @return void
183153 * @dataProvider getOrderCanReorder
184154 */
185- public function testCanReorderCustomerLoggedInAndOrderCanReorder ($ orderCanReorder )
155+ public function testCanReorder ($ orderCanReorder )
186156 {
187157 $ this ->setupOrderMock (true );
188158
189- $ this ->customerSessionMock ->expects ($ this ->once ())
190- ->method ('isLoggedIn ' )
191- ->willReturn (true );
192-
193159 $ this ->orderMock ->expects ($ this ->once ())
194160 ->method ('canReorder ' )
195161 ->willReturn ($ orderCanReorder );
0 commit comments