Skip to content

Commit a02fa7c

Browse files
author
Joan He
authored
Merge pull request #2896 from magento-borg/MAGETWO-90995
[2.3.0-Regression] MAGETWO-90995 Error on info:language:list call
2 parents 38f975a + f4f4dae commit a02fa7c

12 files changed

+158
-41
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="CheckoutShippingPage" url="/checkout/#shipping" module="Checkout" area="storefront">
12+
<section name="CheckoutShippingGuestInfoSection"/>
13+
<section name="CheckoutShippingSection"/>
14+
</page>
15+
</pages>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<title value="Guest Checkout"/>
15+
<description value="Address State Field For UK Customers Remain Option even After Browser Refresh"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-93329"/>
18+
<group value="checkout"/>
19+
</annotations>
20+
<before>
21+
<createData entity="_defaultCategory" stepKey="createCategory"/>
22+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
</createData>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
28+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
29+
</after>
30+
31+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
32+
<waitForPageLoad stepKey="waitForPageLoad1"/>
33+
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
34+
<click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
35+
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
36+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/>
37+
<see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/>
38+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" />
39+
<selectOption stepKey="selectCounty" selector="{{CheckoutShippingSection.country}}" userInput="{{UK_Address.country_id}}"/>
40+
<waitForPageLoad stepKey="waitFormToReload"/>
41+
<reloadPage stepKey="refreshPage"/>
42+
<waitForPageLoad stepKey="waitFormToReload1"/>
43+
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
44+
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
45+
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
46+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{UK_Address.street[0]}}" stepKey="enterStreet"/>
47+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{UK_Address.city}}" stepKey="enterCity"/>
48+
<waitForPageLoad stepKey="waitFormToReload2"/>
49+
<see userInput="State/Province" stepKey="StateFieldStillExists"/>
50+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{UK_Address.telephone}}" stepKey="enterTelephone"/>
51+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
52+
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
53+
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
54+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
55+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
56+
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
57+
58+
</test>
59+
</tests>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@
8585
</entity>
8686
<!--If required other field can be added to UK_Address entity, dont modify any existing data-->
8787
<entity name="UK_Address" type="address">
88+
<array key="street">
89+
<item>7700 xyz street</item>
90+
<item>113</item>
91+
</array>
92+
<data key="city">London</data>
8893
<data key="country_id">GB</data>
94+
<data key="telephone">512-345-6789</data>
8995
</entity>
9096
</entities>

app/code/Magento/Ui/view/base/web/js/form/element/region.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ define([
4949
if (option && !option['is_region_required']) {
5050
this.error(false);
5151
this.validation = _.omit(this.validation, 'required-entry');
52+
registry.get(this.customName, function (input) {
53+
input.validation['required-entry'] = false;
54+
input.required(false);
55+
});
5256
} else {
5357
this.validation['required-entry'] = true;
5458
}

setup/src/Magento/Setup/Console/Command/InfoBackupsListCommand.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
use Magento\Framework\Filesystem\Driver\File;
1212
use Magento\Framework\Setup\BackupRollback;
1313
use Symfony\Component\Console\Command\Command;
14+
use Symfony\Component\Console\Helper\TableFactory;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Output\OutputInterface;
17+
use Magento\Framework\App\ObjectManager;
1618

1719
/**
1820
* Command prints list of available backup files
@@ -33,16 +35,24 @@ class InfoBackupsListCommand extends Command
3335
*/
3436
private $directoryList;
3537

38+
/**
39+
* @var TableFactory
40+
*/
41+
private $tableHelperFactory;
42+
3643
/**
3744
* @param DirectoryList $directoryList
3845
* @param File $file
46+
* @param TableFactory $tableHelperFactory
3947
*/
4048
public function __construct(
4149
DirectoryList $directoryList,
42-
File $file
50+
File $file,
51+
TableFactory $tableHelperFactory = null
4352
) {
4453
$this->directoryList = $directoryList;
4554
$this->file = $file;
55+
$this->tableHelperFactory = $tableHelperFactory ?: ObjectManager::getInstance()->create(TableFactory::class);
4656
parent::__construct();
4757
}
4858

@@ -90,14 +100,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
90100
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
91101
}
92102
$output->writeln("<info>Showing backup files in $backupsDir.</info>");
93-
/** @var \Symfony\Component\Console\Helper\Table $table */
94-
$table = $this->getHelperSet()->get('table');
95-
$table->setHeaders(['Backup Filename', 'Backup Type']);
103+
/** @var \Symfony\Component\Console\Helper\Table $tableHelper */
104+
$tableHelper = $this->tableHelperFactory->create(['output' => $output]);
105+
$tableHelper->setHeaders(['Backup Filename', 'Backup Type']);
96106
asort($tempTable);
97107
foreach ($tempTable as $key => $value) {
98-
$table->addRow([$key, $value]);
108+
$tableHelper->addRow([$key, $value]);
99109
}
100-
$table->render($output);
110+
$tableHelper->render();
101111
} else {
102112
$output->writeln('<info>No backup files found.</info>');
103113
}

setup/src/Magento/Setup/Console/Command/InfoCurrencyListCommand.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
namespace Magento\Setup\Console\Command;
88

9+
use Symfony\Component\Console\Helper\TableFactory;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112
use Symfony\Component\Console\Command\Command;
1213
use Magento\Framework\Setup\Lists;
14+
use Magento\Framework\App\ObjectManager;
1315

1416
/**
1517
* Command prints list of available currencies
@@ -23,12 +25,19 @@ class InfoCurrencyListCommand extends Command
2325
*/
2426
private $lists;
2527

28+
/**
29+
* @var TableFactory
30+
*/
31+
private $tableHelperFactory;
32+
2633
/**
2734
* @param Lists $lists
35+
* @param TableFactory $tableHelperFactory
2836
*/
29-
public function __construct(Lists $lists)
37+
public function __construct(Lists $lists, TableFactory $tableHelperFactory = null)
3038
{
3139
$this->lists = $lists;
40+
$this->tableHelperFactory = $tableHelperFactory ?: ObjectManager::getInstance()->create(TableFactory::class);
3241
parent::__construct();
3342
}
3443

@@ -48,14 +57,14 @@ protected function configure()
4857
*/
4958
protected function execute(InputInterface $input, OutputInterface $output)
5059
{
51-
$table = $this->getHelperSet()->get('table');
52-
$table->setHeaders(['Currency', 'Code']);
60+
$tableHelper = $this->tableHelperFactory->create(['output' => $output]);
61+
$tableHelper->setHeaders(['Currency', 'Code']);
5362

5463
foreach ($this->lists->getCurrencyList() as $key => $currency) {
55-
$table->addRow([$currency, $key]);
64+
$tableHelper->addRow([$currency, $key]);
5665
}
5766

58-
$table->render($output);
67+
$tableHelper->render();
5968
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
6069
}
6170
}

setup/src/Magento/Setup/Console/Command/InfoLanguageListCommand.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
namespace Magento\Setup\Console\Command;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Setup\Lists;
1011
use Symfony\Component\Console\Command\Command;
12+
use Symfony\Component\Console\Helper\TableFactory;
1113
use Symfony\Component\Console\Input\InputInterface;
1214
use Symfony\Component\Console\Output\OutputInterface;
1315

@@ -23,12 +25,19 @@ class InfoLanguageListCommand extends Command
2325
*/
2426
private $lists;
2527

28+
/**
29+
* @var TableFactory
30+
*/
31+
private $tableHelperFactory;
32+
2633
/**
2734
* @param Lists $lists
35+
* @param TableFactory $tableHelperFactory
2836
*/
29-
public function __construct(Lists $lists)
37+
public function __construct(Lists $lists, TableFactory $tableHelperFactory = null)
3038
{
3139
$this->lists = $lists;
40+
$this->tableHelperFactory = $tableHelperFactory ?: ObjectManager::getInstance()->create(TableFactory::class);
3241
parent::__construct();
3342
}
3443

@@ -48,14 +57,14 @@ protected function configure()
4857
*/
4958
protected function execute(InputInterface $input, OutputInterface $output)
5059
{
51-
$table = $this->getHelperSet()->get('table');
52-
$table->setHeaders(['Language', 'Code']);
60+
$tableHelper = $this->tableHelperFactory->create(['output' => $output]);
61+
$tableHelper->setHeaders(['Language', 'Code']);
5362

5463
foreach ($this->lists->getLocaleList() as $key => $locale) {
55-
$table->addRow([$locale, $key]);
64+
$tableHelper->addRow([$locale, $key]);
5665
}
5766

58-
$table->render($output);
67+
$tableHelper->render();
5968
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
6069
}
6170
}

setup/src/Magento/Setup/Console/Command/InfoTimezoneListCommand.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Symfony\Component\Console\Output\OutputInterface;
1111
use Symfony\Component\Console\Command\Command;
1212
use Magento\Framework\Setup\Lists;
13+
use Symfony\Component\Console\Helper\TableFactory;
14+
use Magento\Framework\App\ObjectManager;
1315

1416
/**
1517
* Command prints list of available timezones
@@ -23,12 +25,19 @@ class InfoTimezoneListCommand extends Command
2325
*/
2426
private $lists;
2527

28+
/**
29+
* @var TableFactory
30+
*/
31+
private $tableHelperFactory;
32+
2633
/**
2734
* @param Lists $lists
35+
* @param TableFactory $tableHelperFactory
2836
*/
29-
public function __construct(Lists $lists)
37+
public function __construct(Lists $lists, TableFactory $tableHelperFactory = null)
3038
{
3139
$this->lists = $lists;
40+
$this->tableHelperFactory = $tableHelperFactory ?: ObjectManager::getInstance()->create(TableFactory::class);
3241
parent::__construct();
3342
}
3443

@@ -48,14 +57,14 @@ protected function configure()
4857
*/
4958
protected function execute(InputInterface $input, OutputInterface $output)
5059
{
51-
$table = $this->getHelperSet()->get('table');
52-
$table->setHeaders(['Timezone', 'Code']);
60+
$tableHelper = $this->tableHelperFactory->create(['output' => $output]);
61+
$tableHelper->setHeaders(['Timezone', 'Code']);
5362

5463
foreach ($this->lists->getTimezoneList() as $key => $timezone) {
55-
$table->addRow([$timezone, $key]);
64+
$tableHelper->addRow([$timezone, $key]);
5665
}
5766

58-
$table->render($output);
67+
$tableHelper->render();
5968
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
6069
}
6170
}

setup/src/Magento/Setup/Test/Unit/Console/Command/InfoBackupsListCommandTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public function testExecute()
1616
$table = $this->createMock(\Symfony\Component\Console\Helper\Table::class);
1717
$table->expects($this->once())->method('setHeaders')->with(['Backup Filename', 'Backup Type']);
1818
$table->expects($this->once())->method('addRow')->with(['backupFile_media.tgz', 'media']);
19-
/** @var \Symfony\Component\Console\Helper\HelperSet|\PHPUnit_Framework_MockObject_MockObject $helperSet */
20-
$helperSet = $this->createMock(\Symfony\Component\Console\Helper\HelperSet::class);
21-
$helperSet->expects($this->once())->method('get')->with('table')->will($this->returnValue($table));
19+
/** @var \Symfony\Component\Console\Helper\TableFactory|\PHPUnit_Framework_MockObject_MockObject $helperSet */
20+
$tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
21+
$tableFactoryMock->expects($this->once())->method('create')->will($this->returnValue($table));
2222
/** @var \Magento\Framework\App\Filesystem\DirectoryList
2323
* |\PHPUnit_Framework_MockObject_MockObject $directoryList
2424
*/
@@ -29,8 +29,7 @@ public function testExecute()
2929
$file->expects($this->once())
3030
->method('readDirectoryRecursively')
3131
->will($this->returnValue(['backupFile_media.tgz']));
32-
$command = new InfoBackupsListCommand($directoryList, $file);
33-
$command->setHelperSet($helperSet);
32+
$command = new InfoBackupsListCommand($directoryList, $file, $tableFactoryMock);
3433
$commandTester = new CommandTester($command);
3534
$commandTester->execute([]);
3635
$expected = 'Showing backup files in ';

setup/src/Magento/Setup/Test/Unit/Console/Command/InfoCurrencyListCommandTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ public function testExecute()
2121
$table->expects($this->once())->method('setHeaders')->with(['Currency', 'Code']);
2222
$table->expects($this->once())->method('addRow')->with(['Currency description', 'CUR']);
2323

24-
/** @var \Symfony\Component\Console\Helper\HelperSet|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25-
$helperSet = $this->createMock(\Symfony\Component\Console\Helper\HelperSet::class);
26-
$helperSet->expects($this->once())->method('get')->with('table')->will($this->returnValue($table));
24+
/** @var \Symfony\Component\Console\Helper\TableFactory|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25+
$tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
26+
$tableFactoryMock->expects($this->once())->method('create')->will($this->returnValue($table));
2727

2828
/** @var \Magento\Framework\Setup\Lists|\PHPUnit_Framework_MockObject_MockObject $list */
2929
$list = $this->createMock(\Magento\Framework\Setup\Lists::class);
3030
$list->expects($this->once())->method('getCurrencyList')->will($this->returnValue($currencies));
31-
$command = new InfoCurrencyListCommand($list);
32-
$command->setHelperSet($helperSet);
31+
$command = new InfoCurrencyListCommand($list, $tableFactoryMock);
3332
$commandTester = new CommandTester($command);
3433
$commandTester->execute([]);
3534
}

setup/src/Magento/Setup/Test/Unit/Console/Command/InfoLanguageListCommandTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ public function testExecute()
2121
$table->expects($this->once())->method('setHeaders')->with(['Language', 'Code']);
2222
$table->expects($this->once())->method('addRow')->with(['Language description', 'LNG']);
2323

24-
/** @var \Symfony\Component\Console\Helper\HelperSet|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25-
$helperSet = $this->createMock(\Symfony\Component\Console\Helper\HelperSet::class);
26-
$helperSet->expects($this->once())->method('get')->with('table')->will($this->returnValue($table));
24+
/** @var \Symfony\Component\Console\Helper\TableFactory|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25+
$tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
26+
$tableFactoryMock->expects($this->once())->method('create')->will($this->returnValue($table));
2727

2828
/** @var \Magento\Framework\Setup\Lists|\PHPUnit_Framework_MockObject_MockObject $list */
2929
$list = $this->createMock(\Magento\Framework\Setup\Lists::class);
3030
$list->expects($this->once())->method('getLocaleList')->will($this->returnValue($languages));
31-
$command = new InfoLanguageListCommand($list);
32-
$command->setHelperSet($helperSet);
31+
$command = new InfoLanguageListCommand($list, $tableFactoryMock);
3332
$commandTester = new CommandTester($command);
3433
$commandTester->execute([]);
3534
}

setup/src/Magento/Setup/Test/Unit/Console/Command/InfoTimezoneListCommandTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ public function testExecute()
2121
$table->expects($this->once())->method('setHeaders')->with(['Timezone', 'Code']);
2222
$table->expects($this->once())->method('addRow')->with(['timezone description', 'timezone']);
2323

24-
/** @var \Symfony\Component\Console\Helper\HelperSet|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25-
$helperSet = $this->createMock(\Symfony\Component\Console\Helper\HelperSet::class);
26-
$helperSet->expects($this->once())->method('get')->with('table')->will($this->returnValue($table));
24+
/** @var \Symfony\Component\Console\Helper\TableFactory|\PHPUnit_Framework_MockObject_MockObject $helperSet */
25+
$tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
26+
$tableFactoryMock->expects($this->once())->method('create')->will($this->returnValue($table));
2727

2828
/** @var \Magento\Framework\Setup\Lists|\PHPUnit_Framework_MockObject_MockObject $list */
2929
$list = $this->createMock(\Magento\Framework\Setup\Lists::class);
3030
$list->expects($this->once())->method('getTimezoneList')->will($this->returnValue($timezones));
31-
$command = new InfoTimezoneListCommand($list);
32-
$command->setHelperSet($helperSet);
31+
$command = new InfoTimezoneListCommand($list, $tableFactoryMock);
3332
$commandTester = new CommandTester($command);
3433
$commandTester->execute([]);
3534
}

0 commit comments

Comments
 (0)