Skip to content

Commit 9f902c4

Browse files
committed
MTA-3333: Deliver functional test fixes that were made during regression testing
1 parent a599e9b commit 9f902c4

File tree

7 files changed

+52
-16
lines changed

7 files changed

+52
-16
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ class TierPrice extends DataSource
2626
*/
2727
private $customerGroups;
2828

29+
/**
30+
* Repository Factory instance.
31+
*
32+
* @var RepositoryFactory
33+
*/
34+
private $repositoryFactory;
35+
36+
/**
37+
* Fixture Factory instance.
38+
*
39+
* @var FixtureFactory
40+
*/
41+
private $fixtureFactory;
42+
43+
/**
44+
* Rought fixture field data.
45+
*
46+
* @var array
47+
*/
48+
private $fixtureData = null;
49+
2950
/**
3051
* @constructor
3152
* @param RepositoryFactory $repositoryFactory
@@ -40,14 +61,28 @@ public function __construct(
4061
array $params,
4162
$data = []
4263
) {
64+
$this->repositoryFactory = $repositoryFactory;
65+
$this->fixtureFactory = $fixtureFactory;
4366
$this->params = $params;
44-
if (!isset($data['dataset'])) {
67+
$this->fixtureData = $data;
68+
}
69+
70+
/**
71+
* Return prepared data set.
72+
*
73+
* @param string $key [optional]
74+
* @return mixed
75+
* @throws \Exception
76+
*/
77+
public function getData($key = null)
78+
{
79+
if (!isset($this->fixtureData['dataset'])) {
4580
throw new \Exception("Data must be set");
4681
}
47-
$this->data = $repositoryFactory->get($this->params['repository'])->get($data['dataset']);
82+
$this->data = $this->repositoryFactory->get($this->params['repository'])->get($this->fixtureData['dataset']);
4883
foreach ($this->data as $key => $item) {
4984
/** @var CustomerGroup $customerGroup */
50-
$customerGroup = $fixtureFactory->createByCode(
85+
$customerGroup = $this->fixtureFactory->createByCode(
5186
'customerGroup',
5287
['dataset' => $item['customer_group']['dataset']]
5388
);
@@ -57,6 +92,8 @@ public function __construct(
5792
$this->data[$key]['customer_group'] = $customerGroup->getCustomerGroupCode();
5893
$this->customerGroups[$key] = $customerGroup;
5994
}
95+
96+
return parent::getData($key);
6097
}
6198

6299
/**

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function fillCustomer(FixtureInterface $customer, $address = null)
7979
*
8080
* @param FixtureInterface $customer
8181
* @param FixtureInterface|FixtureInterface[]|null $address
82-
* @param Address $addressToDelete = null
82+
* @param Address|null $addressToDelete
8383
* @return $this
8484
*/
8585
public function updateCustomer(FixtureInterface $customer, $address = null, Address $addressToDelete = null)

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertAddressDeletedFrontend.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ public function processAssert(
3232
Customer $customer,
3333
Address $addressToDelete
3434
) {
35-
3635
$this->objectManager->create(
37-
'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep',
36+
\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
3837
['customer' => $customer]
3938
)->run();
4039

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupFieldDisabled.php renamed to dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupFieldsDisabled.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use Magento\Customer\Test\Page\Adminhtml\CustomerGroupEdit;
1212

1313
/**
14-
* Assert that group field is not available.
14+
* Assert that group fields are not available.
1515
*/
16-
class AssertCustomerGroupFieldDisabled extends AbstractConstraint
16+
class AssertCustomerGroupFieldsDisabled extends AbstractConstraint
1717
{
1818
/**
19-
* Assert that field is disabled on customer group form.
19+
* Assert that fields are disabled on customer group form.
2020
*
2121
* @param CustomerGroupEdit $customerGroupEdit
2222
* @param array $disabledFields
@@ -35,12 +35,12 @@ public function processAssert(
3535
}
3636

3737
/**
38-
* Success assert of customer group field not available.
38+
* Success assert of customer fields are not available.
3939
*
4040
* @return string
4141
*/
4242
public function toString()
4343
{
44-
return 'Customer group field is not available.';
44+
return 'Customer fields are not available.';
4545
}
4646
}

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerNameFrontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function processAssert(
3333

3434
$customerAccountIndex->open();
3535
$infoBlock = $customerAccountIndex->getInfoBlock()->getContactInfoContent();
36-
$infoBlock = explode("\n", $infoBlock);
36+
$infoBlock = explode(PHP_EOL, $infoBlock);
3737
$nameInDashboard = $infoBlock[0];
3838
\PHPUnit_Framework_Assert::assertTrue(
3939
$nameInDashboard == $customerName,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function __inject(
8787
* @param Customer $customer
8888
* @param Customer $initialCustomer
8989
* @param Address|null $address
90-
* @param Address $addressToDelete
90+
* @param Address|null $addressToDelete
9191
* @return Customer
9292
*/
9393
private function prepareCustomer(
@@ -125,8 +125,8 @@ private function prepareCustomer(
125125
*
126126
* @param Customer $initialCustomer
127127
* @param Customer $customer
128-
* @param Address $address [optional]
129-
* @param int $addressIndexToDelete [optional]
128+
* @param Address|null $address
129+
* @param int|null $addressIndexToDelete
130130
* @throws \Exception
131131
* @return array
132132
*/

dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/VerifyDisabledCustomerGroupFieldTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<data name="disabledFields" xsi:type="array">
1313
<item name="0" xsi:type="string">customer_group_code</item>
1414
</data>
15-
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupFieldDisabled" />
15+
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupFieldsDisabled" />
1616
</variation>
1717
</testCase>
1818
</config>

0 commit comments

Comments
 (0)