Skip to content

Commit 1944bf0

Browse files
committed
MTA-3464: Merge Domain Functional Bamboo Plan
- Fix issues found by static tests
1 parent 62faaef commit 1944bf0

File tree

4 files changed

+60
-15
lines changed

4 files changed

+60
-15
lines changed

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,45 @@ private function prepareCustomer(
100100
: $initialCustomer->getData();
101101
$groupId = $customer->hasData('group_id') ? $customer : $initialCustomer;
102102
$data['group_id'] = ['customerGroup' => $groupId->getDataFieldConfig('group_id')['source']->getCustomerGroup()];
103+
$customerAddress = $this->prepareCustomerAddress($initialCustomer, $address, $addressToDelete);
104+
if (!empty($customerAddress)) {
105+
$data['address'] = $customerAddress;
106+
}
107+
108+
return $this->fixtureFactory->createByCode(
109+
'customer',
110+
['data' => $data]
111+
);
112+
}
113+
114+
/**
115+
* Prepare address for customer entity.
116+
*
117+
* @param Customer $initialCustomer
118+
* @param Address|null $address
119+
* @param Address|null $addressToDelete
120+
* @return array
121+
*/
122+
private function prepareCustomerAddress(
123+
Customer $initialCustomer,
124+
Address $address = null,
125+
Address $addressToDelete = null
126+
) {
127+
$customerAddress = [];
103128

104129
if ($initialCustomer->hasData('address')) {
105130
$addressesList = $initialCustomer->getDataFieldConfig('address')['source']->getAddresses();
106131
foreach ($addressesList as $key => $addressFixture) {
107132
if ($addressToDelete === null || $addressFixture != $address) {
108-
$data['address'] = ['addresses' => [$key => $addressFixture]];
133+
$customerAddress = ['addresses' => [$key => $addressFixture]];
109134
}
110135
}
111136
}
112137
if ($address !== null) {
113-
$data['address']['addresses'][] = $address;
138+
$customerAddress['addresses'][] = $address;
114139
}
115140

116-
return $this->fixtureFactory->createByCode(
117-
'customer',
118-
['data' => $data]
119-
);
141+
return $customerAddress;
120142
}
121143

122144
/**

dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class ViewedProductsReportEntityTest extends Injectable
6262
* @var CatalogProductIndex
6363
*/
6464
protected $catalogProductIndexPage;
65+
6566
/**
6667
* Catalog product index page
6768
*
@@ -149,7 +150,11 @@ protected function openProducts(array $products, $total)
149150
foreach ($products as $key => $product) {
150151
for ($i = 0; $i < $total[$key]; $i++) {
151152
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
152-
$this->assertEquals($product->getName(), $this->cmsIndex->getTitleBlock()->getTitle(), 'Could not open product page');
153+
$this->assertEquals(
154+
$product->getName(),
155+
$this->cmsIndex->getTitleBlock()->getTitle(),
156+
'Could not open product page.'
157+
);
153158
}
154159
}
155160
}

dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/OnePageCheckoutWithDiscountTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public function test()
2424
{
2525
$this->executeScenario();
2626
}
27-
}
27+
}

dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.php

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*
2626
* @group Vault
2727
* @ZephyrId MAGETWO-54059, MAGETWO-54072, MAGETWO-54068, MAGETWO-54015, MAGETWO-54011
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829
*/
2930
class DeleteSavedCreditCardTest extends Injectable
3031
{
@@ -33,11 +34,28 @@ class DeleteSavedCreditCardTest extends Injectable
3334
const TEST_TYPE = '3rd_party_test';
3435
/* end tags */
3536

37+
/**
38+
* Page for one page checkout.
39+
*
40+
* @var CheckoutOnepage
41+
*/
42+
private $checkoutOnepage;
43+
44+
/**
45+
* Injection data.
46+
*
47+
* @param CheckoutOnepage $checkoutOnepage
48+
* @return void
49+
*/
50+
public function __inject(CheckoutOnepage $checkoutOnepage)
51+
{
52+
$this->checkoutOnepage = $checkoutOnepage;
53+
}
54+
3655
/**
3756
* Runs delete saved credit card test.
3857
*
3958
* @param AssertCreditCardNotPresentOnCheckout $assertCreditCardNotPresentOnCheckout
40-
* @param CheckoutOnepage $checkoutOnepage
4159
* @param $products
4260
* @param $configData
4361
* @param $customer
@@ -46,10 +64,10 @@ class DeleteSavedCreditCardTest extends Injectable
4664
* @param $shipping
4765
* @param array $payments
4866
* @param $creditCardSave
67+
* @return void
4968
*/
5069
public function test(
5170
AssertCreditCardNotPresentOnCheckout $assertCreditCardNotPresentOnCheckout,
52-
CheckoutOnepage $checkoutOnepage,
5371
$products,
5472
$configData,
5573
$customer,
@@ -68,7 +86,7 @@ public function test(
6886
foreach ($payments as $key => $payment) {
6987
$this->addToCart($products);
7088
$this->proceedToCheckout();
71-
if($key < 1) { // if this is the first order to be placed
89+
if ($key < 1) { // if this is the first order to be placed
7290
$this->selectCheckoutMethod($checkoutMethod, $customer);
7391
$this->fillShippingAddress($shippingAddress);
7492
}
@@ -83,7 +101,7 @@ public function test(
83101
}
84102
// Delete credit cards from Stored Payment Methods and verify they are not available on checkout
85103
$paymentsCount = count($payments);
86-
for($i = 2; $i < $paymentsCount; $i++) {
104+
for ($i = 2; $i < $paymentsCount; $i++) {
87105
$deletedCard = $this->deleteCreditCardFromMyAccount(
88106
$customer,
89107
$payments[$i]['creditCard'],
@@ -93,7 +111,7 @@ public function test(
93111
$this->proceedToCheckout();
94112
$this->fillShippingMethod($shipping);
95113
$assertCreditCardNotPresentOnCheckout->processAssert(
96-
$checkoutOnepage,
114+
$this->checkoutOnepage,
97115
$deletedCard['deletedCreditCard']
98116
);
99117
}
@@ -243,7 +261,7 @@ protected function saveCreditCard($payment, $creditCardSave)
243261
);
244262
$saveCreditCardStep->run();
245263
}
246-
264+
247265
/**
248266
* @return void
249267
*/
@@ -254,7 +272,7 @@ protected function fillBillingInformation()
254272
);
255273
$fillBillingInformationStep->run();
256274
}
257-
275+
258276
/**
259277
* @return void
260278
*/

0 commit comments

Comments
 (0)