12
12
use Magento \Directory \Model \Currency ;
13
13
use Magento \Framework \App \Config \ScopeConfigInterface ;
14
14
use Magento \Framework \Locale \CurrencyInterface ;
15
+ use Magento \Framework \ObjectManagerInterface ;
15
16
use Magento \Framework \Registry ;
16
17
use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
17
18
use Magento \Framework \View \Element \UiComponent \DataProvider \Document ;
20
21
use Magento \Store \Model \System \Store ;
21
22
use Magento \TestFramework \Helper \Bootstrap ;
22
23
use Magento \TestFramework \Helper \Xpath ;
23
- use Magento \TestFramework \ObjectManager ;
24
24
use PHPUnit \Framework \TestCase ;
25
25
26
26
/**
@@ -40,7 +40,7 @@ class RenderOrdersTabTest extends TestCase
40
40
];
41
41
42
42
/**
43
- * @var ObjectManager
43
+ * @var ObjectManagerInterface
44
44
*/
45
45
private $ objectManager ;
46
46
@@ -100,7 +100,6 @@ protected function setUp()
100
100
protected function tearDown ()
101
101
{
102
102
$ this ->registry ->unregister (RegistryConstants::CURRENT_CUSTOMER_ID );
103
- $ this ->ordersGridBlock = null ;
104
103
parent ::tearDown ();
105
104
}
106
105
@@ -114,7 +113,7 @@ protected function tearDown()
114
113
*/
115
114
public function testRenderBlockWithoutOrders (): void
116
115
{
117
- $ this ->processCheckOrdersGridByCustomerId (1 );
116
+ $ this ->processCheckOrdersGridByCustomerId (1 , 0 );
118
117
}
119
118
120
119
/**
@@ -127,7 +126,7 @@ public function testRenderBlockWithoutOrders(): void
127
126
*/
128
127
public function testRenderBlockWithOneOrder (): void
129
128
{
130
- $ this ->processCheckOrdersGridByCustomerId (1 );
129
+ $ this ->processCheckOrdersGridByCustomerId (1 , 1 );
131
130
}
132
131
133
132
/**
@@ -141,23 +140,23 @@ public function testRenderBlockWithOneOrder(): void
141
140
*/
142
141
public function testRenderBlockWithFewOrders (): void
143
142
{
144
- $ this ->processCheckOrdersGridByCustomerId (1 );
143
+ $ this ->processCheckOrdersGridByCustomerId (1 , 5 );
145
144
}
146
145
147
146
/**
148
147
* Render orders grid and assert that all data rendered as expected.
149
148
*
150
149
* @param int $customerId
150
+ * @param int $expectedOrderCount
151
151
* @return void
152
152
*/
153
- private function processCheckOrdersGridByCustomerId (int $ customerId ): void
153
+ private function processCheckOrdersGridByCustomerId (int $ customerId, int $ expectedOrderCount ): void
154
154
{
155
155
$ this ->registerCustomerId ($ customerId );
156
156
$ ordersGridHtml = $ this ->getOrdersGridHtml ();
157
157
$ orderItemsData = $ this ->getOrderGridItemsData ();
158
- $ ordersCount = count ($ orderItemsData );
159
- $ this ->assertOrdersCount ($ ordersCount , $ ordersGridHtml );
160
- $ this ->assertIsEmptyGridMessageArrears ($ ordersGridHtml , $ ordersCount === 0 );
158
+ $ this ->assertOrdersCount ($ expectedOrderCount , $ ordersGridHtml );
159
+ $ this ->assertIsEmptyGridMessageArrears ($ ordersGridHtml , $ expectedOrderCount === 0 );
161
160
$ this ->checkOrderItemsFields ($ orderItemsData , $ ordersGridHtml );
162
161
}
163
162
@@ -388,13 +387,7 @@ private function prepareCreatedAtDate(string $createdAt): string
388
387
{
389
388
$ date = new \DateTime ($ createdAt );
390
389
391
- return $ this ->timezone ->formatDateTime (
392
- $ date ,
393
- \IntlDateFormatter::MEDIUM ,
394
- \IntlDateFormatter::MEDIUM ,
395
- null ,
396
- null
397
- );
390
+ return $ this ->timezone ->formatDateTime ($ date , \IntlDateFormatter::MEDIUM , \IntlDateFormatter::MEDIUM );
398
391
}
399
392
400
393
/**
0 commit comments