Skip to content

Commit 21e3de6

Browse files
committed
MC-30645: Admin: View orders in customer edit page
1 parent 905f9c0 commit 21e3de6

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders/RenderOrdersTabTest.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Directory\Model\Currency;
1313
use Magento\Framework\App\Config\ScopeConfigInterface;
1414
use Magento\Framework\Locale\CurrencyInterface;
15+
use Magento\Framework\ObjectManagerInterface;
1516
use Magento\Framework\Registry;
1617
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1718
use Magento\Framework\View\Element\UiComponent\DataProvider\Document;
@@ -20,7 +21,6 @@
2021
use Magento\Store\Model\System\Store;
2122
use Magento\TestFramework\Helper\Bootstrap;
2223
use Magento\TestFramework\Helper\Xpath;
23-
use Magento\TestFramework\ObjectManager;
2424
use PHPUnit\Framework\TestCase;
2525

2626
/**
@@ -40,7 +40,7 @@ class RenderOrdersTabTest extends TestCase
4040
];
4141

4242
/**
43-
* @var ObjectManager
43+
* @var ObjectManagerInterface
4444
*/
4545
private $objectManager;
4646

@@ -100,7 +100,6 @@ protected function setUp()
100100
protected function tearDown()
101101
{
102102
$this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID);
103-
$this->ordersGridBlock = null;
104103
parent::tearDown();
105104
}
106105

@@ -114,7 +113,7 @@ protected function tearDown()
114113
*/
115114
public function testRenderBlockWithoutOrders(): void
116115
{
117-
$this->processCheckOrdersGridByCustomerId(1);
116+
$this->processCheckOrdersGridByCustomerId(1, 0);
118117
}
119118

120119
/**
@@ -127,7 +126,7 @@ public function testRenderBlockWithoutOrders(): void
127126
*/
128127
public function testRenderBlockWithOneOrder(): void
129128
{
130-
$this->processCheckOrdersGridByCustomerId(1);
129+
$this->processCheckOrdersGridByCustomerId(1, 1);
131130
}
132131

133132
/**
@@ -141,23 +140,23 @@ public function testRenderBlockWithOneOrder(): void
141140
*/
142141
public function testRenderBlockWithFewOrders(): void
143142
{
144-
$this->processCheckOrdersGridByCustomerId(1);
143+
$this->processCheckOrdersGridByCustomerId(1, 5);
145144
}
146145

147146
/**
148147
* Render orders grid and assert that all data rendered as expected.
149148
*
150149
* @param int $customerId
150+
* @param int $expectedOrderCount
151151
* @return void
152152
*/
153-
private function processCheckOrdersGridByCustomerId(int $customerId): void
153+
private function processCheckOrdersGridByCustomerId(int $customerId, int $expectedOrderCount): void
154154
{
155155
$this->registerCustomerId($customerId);
156156
$ordersGridHtml = $this->getOrdersGridHtml();
157157
$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);
161160
$this->checkOrderItemsFields($orderItemsData, $ordersGridHtml);
162161
}
163162

@@ -388,13 +387,7 @@ private function prepareCreatedAtDate(string $createdAt): string
388387
{
389388
$date = new \DateTime($createdAt);
390389

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);
398391
}
399392

400393
/**

0 commit comments

Comments
 (0)