Skip to content

Commit a3dc450

Browse files
committed
Add more cases
1 parent 0173e34 commit a3dc450

File tree

1 file changed

+45
-13
lines changed
  • dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab

1 file changed

+45
-13
lines changed

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

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Magento\Customer\Block\Adminhtml\Edit\Tab\Cart
1818
*
1919
* @magentoAppArea adminhtml
20+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2021
*/
2122
class CartTest extends \PHPUnit\Framework\TestCase
2223
{
@@ -28,7 +29,7 @@ class CartTest extends \PHPUnit\Framework\TestCase
2829
private $_context;
2930

3031
/**
31-
* @var Registry
32+
* @var Registry
3233
*/
3334
private $_coreRegistry;
3435

@@ -38,7 +39,7 @@ class CartTest extends \PHPUnit\Framework\TestCase
3839
private $_storeManager;
3940

4041
/**
41-
* @var Cart
42+
* @var Cart
4243
*/
4344
private $_block;
4445

@@ -85,24 +86,55 @@ public function tearDown()
8586
*
8687
* @magentoDataFixture Magento/Sales/_files/quote_with_two_products_and_customer.php
8788
* @magentoDataFixture Magento/Customer/_files/customer.php
88-
* @magentoAppIsolation enabled
89-
* @magentoDbIsolation disabled
89+
* @dataProvider getQuoteDataProvider
90+
*
91+
* @param int $customerId
92+
* @param bool $guest
93+
* @param bool $contains
9094
* @return void
9195
*/
92-
public function testVerifyCollectionWithQuote(): void
96+
public function testVerifyCollectionWithQuote(int $customerId, bool $guest, bool $contains): void
9397
{
9498
$session = $this->_objectManager->create(SessionQuote::class);
95-
$session->setCustomerId(self::CUSTOMER_ID_VALUE);
99+
$session->setCustomerId($customerId);
96100
$quoteFixture = $this->_objectManager->create(Quote::class);
97101
$quoteFixture->load('test01', 'reserved_order_id');
98-
$quoteFixture->setCustomerIsGuest(false)
99-
->setCustomerId(self::CUSTOMER_ID_VALUE)
102+
$quoteFixture->setCustomerIsGuest($guest)
103+
->setCustomerId($customerId)
100104
->save();
101-
$html = $this->_block->toHtml();
102-
$this->assertNotContains(
103-
"We couldn't find any records",
104-
$this->_block->getGridParentHtml()
105-
);
105+
$this->_block->toHtml();
106+
if ($contains) {
107+
$this->assertContains(
108+
"We couldn't find any records",
109+
$this->_block->getGridParentHtml()
110+
);
111+
} else {
112+
$this->assertNotContains(
113+
"We couldn't find any records",
114+
$this->_block->getGridParentHtml()
115+
);
116+
}
117+
}
118+
119+
/**
120+
* Data provider for withQuoteTest
121+
*
122+
* @return array
123+
*/
124+
public function getQuoteDataProvider(): array
125+
{
126+
return [
127+
[
128+
6,
129+
false,
130+
true
131+
],
132+
[
133+
self::CUSTOMER_ID_VALUE,
134+
true,
135+
false
136+
],
137+
];
106138
}
107139

108140
/**

0 commit comments

Comments
 (0)