17
17
* Magento\Customer\Block\Adminhtml\Edit\Tab\Cart
18
18
*
19
19
* @magentoAppArea adminhtml
20
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
20
21
*/
21
22
class CartTest extends \PHPUnit \Framework \TestCase
22
23
{
@@ -28,7 +29,7 @@ class CartTest extends \PHPUnit\Framework\TestCase
28
29
private $ _context ;
29
30
30
31
/**
31
- * @var Registry
32
+ * @var Registry
32
33
*/
33
34
private $ _coreRegistry ;
34
35
@@ -38,7 +39,7 @@ class CartTest extends \PHPUnit\Framework\TestCase
38
39
private $ _storeManager ;
39
40
40
41
/**
41
- * @var Cart
42
+ * @var Cart
42
43
*/
43
44
private $ _block ;
44
45
@@ -85,24 +86,55 @@ public function tearDown()
85
86
*
86
87
* @magentoDataFixture Magento/Sales/_files/quote_with_two_products_and_customer.php
87
88
* @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
90
94
* @return void
91
95
*/
92
- public function testVerifyCollectionWithQuote (): void
96
+ public function testVerifyCollectionWithQuote (int $ customerId , bool $ guest , bool $ contains ): void
93
97
{
94
98
$ session = $ this ->_objectManager ->create (SessionQuote::class);
95
- $ session ->setCustomerId (self :: CUSTOMER_ID_VALUE );
99
+ $ session ->setCustomerId ($ customerId );
96
100
$ quoteFixture = $ this ->_objectManager ->create (Quote::class);
97
101
$ quoteFixture ->load ('test01 ' , 'reserved_order_id ' );
98
- $ quoteFixture ->setCustomerIsGuest (false )
99
- ->setCustomerId (self :: CUSTOMER_ID_VALUE )
102
+ $ quoteFixture ->setCustomerIsGuest ($ guest )
103
+ ->setCustomerId ($ customerId )
100
104
->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
+ ];
106
138
}
107
139
108
140
/**
0 commit comments