Skip to content

Commit 3c7ec06

Browse files
MacMac
authored andcommitted
Merge remote-tracking branch 'remotes/github/MAGETWO-96107' into EPAM-PR-28
2 parents b93aba6 + 7e68f61 commit 3c7ec06

File tree

4 files changed

+106
-1
lines changed

4 files changed

+106
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="EnableAdminAccountAllowCountry" type="admin_account_country_options_config">
12+
<requiredEntity type="admin_account_country_options_value">AdminAccountAllowCountryUS</requiredEntity>
13+
</entity>
14+
<entity name="AdminAccountAllowCountryUS" type="admin_account_country_options_value">
15+
<data key="value">US</data>
16+
</entity>
17+
18+
<entity name="DisableAdminAccountAllowCountry" type="default_admin_account_country_options_config">
19+
<requiredEntity type="checkoutTotalFlagZero">DefaultAdminAccountAllowCountry</requiredEntity>
20+
</entity>
21+
<entity name="DefaultAdminAccountAllowCountry" type="checkoutTotalFlagZero">
22+
<data key="value">0</data>
23+
</entity>
24+
</entities>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
10+
<operation name="AdminAccountCountryOptionConfig" dataType="admin_account_country_options_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/general/" method="POST">
11+
<object key="groups" dataType="admin_account_country_options_config">
12+
<object key="country" dataType="admin_account_country_options_config">
13+
<object key="fields" dataType="admin_account_country_options_config">
14+
<object key="allow" dataType="admin_account_country_options_value">
15+
<field key="value">string</field>
16+
</object>
17+
</object>
18+
</object>
19+
</object>
20+
</operation>
21+
22+
<operation name="DefaultAdminAccountCountryOptionConfig" dataType="default_admin_account_country_options_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/general/" method="POST">
23+
<object key="groups" dataType="default_admin_account_country_options_config">
24+
<object key="country" dataType="default_admin_account_country_options_config">
25+
<object key="fields" dataType="default_admin_account_country_options_config">
26+
<object key="allow" dataType="default_admin_account_country_options_config">
27+
<object key="inherit" dataType="checkoutTotalFlagZero">
28+
<field key="value">string</field>
29+
</object>
30+
</object>
31+
</object>
32+
</object>
33+
</object>
34+
</operation>
35+
</operations>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="CheckingCountryDropDownWithOneAllowedCountryTest">
12+
<annotations>
13+
<features value="Config"/>
14+
<stories value="MAGETWO-96107: Additional blank option in country dropdown"/>
15+
<title value="Checking country drop-down with one allowed country"/>
16+
<description value="Check country drop-down with one allowed country"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-96133"/>
19+
<group value="configuration"/>
20+
</annotations>
21+
<before>
22+
<createData entity="EnableAdminAccountAllowCountry" stepKey="setAllowedCountries"/>
23+
</before>
24+
<after>
25+
<createData entity="DisableAdminAccountAllowCountry" stepKey="setDefaultValueForAllowCountries"/>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer">
28+
<argument name="customerEmail" value="CustomerEntityOne.email"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="clearFilters"/>
31+
<waitForPageLoad stepKey="WaitForPageToLoad"/>
32+
<actionGroup ref="logout" stepKey="logout"/>
33+
</after>
34+
<!--Flush Magento Cache-->
35+
<magentoCLI stepKey="flushCache" command="cache:flush"/>
36+
<!--Create a customer account from Storefront-->
37+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="createAnAccount">
38+
<argument name="Customer" value="CustomerEntityOne"/>
39+
</actionGroup>
40+
<click selector="{{CheckoutPaymentSection.addressBook}}" stepKey="goToAddressBook"/>
41+
<click selector="{{StorefrontCustomerAddressSection.country}}" stepKey="clickToExpandCountryDropDown"/>
42+
<see selector="{{StorefrontCustomerAddressSection.country}}" userInput="United States" stepKey="seeSelectedCountry"/>
43+
<dontSee selector="{{StorefrontCustomerAddressSection.country}}" userInput="Brazil" stepKey="canNotSeeSelectedCountry"/>
44+
</test>
45+
</tests>

app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public function getItemById($countryId)
205205

206206
/**
207207
* Add filter by country code to collection.
208+
*
208209
* $countryCode can be either array of country codes or string representing one country code.
209210
* $iso can be either array containing 'iso2', 'iso3' values or string with containing one of that values directly.
210211
* The collection will contain countries where at least one of country $iso fields matches $countryCode.
@@ -297,7 +298,7 @@ public function toOptionArray($emptyLabel = ' ')
297298
}
298299
$options[] = $option;
299300
}
300-
if ($emptyLabel !== false && count($options) > 0) {
301+
if ($emptyLabel !== false && count($options) > 1) {
301302
array_unshift($options, ['value' => '', 'label' => $emptyLabel]);
302303
}
303304

0 commit comments

Comments
 (0)