Skip to content

Commit 07abfaa

Browse files
committed
Merge pull request #545 from magento-mpi/prs
[GITHUB] Merge public Github PRs
2 parents 33b8dff + 89b1a74 commit 07abfaa

File tree

8 files changed

+23
-10
lines changed

8 files changed

+23
-10
lines changed

app/code/Magento/Customer/Setup/UpgradeData.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ public function __construct(
5656
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
5757
{
5858
$setup->startSetup();
59+
/** @var CustomerSetup $customerSetup */
60+
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
5961

6062
if (version_compare($context->getVersion(), '2.0.1', '<')) {
61-
/** @var CustomerSetup $customerSetup */
62-
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
63-
6463
$entityAttributes = [
6564
'customer' => [
6665
'website_id' => [
@@ -185,11 +184,18 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
185184
$attribute->save();
186185
}
187186
}
187+
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
188+
$indexer->reindexAll();
189+
$this->eavConfig->clear();
188190
}
189191

190-
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
191-
$indexer->reindexAll();
192-
$this->eavConfig->clear();
192+
if (version_compare($context->getVersion(), '2.0.2') < 0) {
193+
$entityTypeId = $customerSetup->getEntityTypeId(Customer::ENTITY);
194+
$attributeId = $customerSetup->getAttributeId($entityTypeId, 'gender');
195+
196+
$option = ['attribute_id' => $attributeId, 'values' => [3 => 'Not Specified']];
197+
$customerSetup->addAttributeOption($option);
198+
}
193199

194200
$setup->endSetup();
195201
}

app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ public function testGetCustomer()
169169
*/
170170
public function testGetGenderOptions()
171171
{
172-
$options = [['label' => __('Male'), 'value' => 'M'], ['label' => __('Female'), 'value' => 'F']];
172+
$options = [
173+
['label' => __('Male'), 'value' => 'M'],
174+
['label' => __('Female'), 'value' => 'F'],
175+
['label' => __('Not Specified'), 'value' => 'NA']
176+
];
173177

174178
$this->attribute->expects($this->once())->method('getOptions')->will($this->returnValue($options));
175179
$this->assertSame($options, $this->block->getGenderOptions());

app/code/Magento/Customer/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
9-
<module name="Magento_Customer" setup_version="2.0.1">
9+
<module name="Magento_Customer" setup_version="2.0.2">
1010
<sequence>
1111
<module name="Magento_Eav"/>
1212
<module name="Magento_Directory"/>

app/code/Magento/Eav/Setup/EavSetup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ public function addAttribute($entityTypeId, $code, array $attr)
803803
}
804804

805805
/**
806-
* Add Attribure Option
806+
* Add Attribute Option
807807
*
808808
* @param array $option
809809
* @return void

app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ protected function _sortTotalsList($a, $b)
644644
/**
645645
* Return total list
646646
*
647-
* @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal
647+
* @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal[] Array of totals
648648
*/
649649
protected function _getTotalsList()
650650
{

dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public function getAttributeMetadataDataProvider()
104104
['label' => '', 'value' => ''],
105105
['label' => 'Male', 'value' => '1'],
106106
['label' => 'Female', 'value' => '2'],
107+
['label' => 'Not Specified', 'value' => '3']
107108
],
108109
AttributeMetadata::FRONTEND_CLASS => '',
109110
AttributeMetadata::USER_DEFINED => false,

dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Curl extends AbstractCurl implements CustomerInterface
3737
'gender' => [
3838
'Male' => 1,
3939
'Female' => 2,
40+
'Not Specified' => 3
4041
],
4142
'region_id' => [
4243
'California' => 12,

dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ public function testToHtml()
4949
$this->assertContains('<span>Gender</span>', $html);
5050
$this->assertContains('<option value="1">Male</option>', $html);
5151
$this->assertContains('<option value="2">Female</option>', $html);
52+
$this->assertContains('<option value="3">Not Specified</option>', $html);
5253
}
5354
}

0 commit comments

Comments
 (0)