File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 10
10
use Magento \Customer \Model \Session ;
11
11
use Magento \Sales \Model \Order \Config ;
12
12
use Magento \Store \Model \StoreManagerInterface ;
13
+ use Magento \Framework \App \ObjectManager ;
13
14
14
15
/**
15
16
* Sales order history block
@@ -57,15 +58,16 @@ public function __construct(
57
58
CollectionFactory $ orderCollectionFactory ,
58
59
Session $ customerSession ,
59
60
Config $ orderConfig ,
60
- StoreManagerInterface $ storeManager ,
61
- array $ data = []
61
+ array $ data = [] ,
62
+ StoreManagerInterface $ storeManager = null
62
63
) {
63
64
$ this ->_orderCollectionFactory = $ orderCollectionFactory ;
64
65
$ this ->_customerSession = $ customerSession ;
65
66
$ this ->_orderConfig = $ orderConfig ;
66
- $ this ->storeManager = $ storeManager ;
67
- parent ::__construct ($ context , $ data );
68
67
$ this ->_isScopePrivate = true ;
68
+ $ this ->storeManager = $ storeManager ?: ObjectManager::getInstance ()
69
+ ->get (StoreManagerInterface::class);
70
+ parent ::__construct ($ context , $ data );
69
71
}
70
72
71
73
/**
Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ protected function setUp()
64
64
65
65
public function testConstructMethod ()
66
66
{
67
- $ data = [];
68
67
$ attribute = ['customer_id ' , 'store_id ' , 'status ' ];
69
68
$ customerId = 25 ;
70
69
$ storeId = 4 ;
@@ -130,8 +129,8 @@ public function testConstructMethod()
130
129
$ this ->orderCollectionFactory ,
131
130
$ this ->customerSession ,
132
131
$ this ->orderConfig ,
133
- $ this -> storeManagerMock ,
134
- $ data
132
+ [] ,
133
+ $ this -> storeManagerMock
135
134
);
136
135
$ this ->assertEquals ($ orderCollection , $ this ->block ->getOrders ());
137
136
}
You can’t perform that action at this time.
0 commit comments