From 2a5c5506405e3d6be58f63d3eb98247b36e7cd73 Mon Sep 17 00:00:00 2001 From: Chad Bean Date: Thu, 16 Jul 2015 00:39:45 -0400 Subject: [PATCH 1/4] Added Not Specified as a gender option so when customer does not specify value does not default to male --- app/code/Magento/Customer/Setup/CustomerSetup.php | 2 +- app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Setup/CustomerSetup.php b/app/code/Magento/Customer/Setup/CustomerSetup.php index d96f2469f983e..c3483bd664042 100644 --- a/app/code/Magento/Customer/Setup/CustomerSetup.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -324,7 +324,7 @@ public function getDefaultEntities() 'validate_rules' => 'a:0:{}', 'position' => 110, 'admin_checkout' => 1, - 'option' => ['values' => ['Male', 'Female']], + 'option' => ['values' => ['Not Specified', 'Male', 'Female']], ], 'disable_auto_group_change' => [ 'type' => 'static', diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php index ed42e290f660c..1133ae149e60a 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php @@ -169,7 +169,7 @@ public function testGetCustomer() */ public function testGetGenderOptions() { - $options = [['label' => __('Male'), 'value' => 'M'], ['label' => __('Female'), 'value' => 'F']]; + $options = [['label' => __('Not Specified'), 'value' => 'NA'], ['label' => __('Male'), 'value' => 'M'], ['label' => __('Female'), 'value' => 'F']]; $this->attribute->expects($this->once())->method('getOptions')->will($this->returnValue($options)); $this->assertSame($options, $this->block->getGenderOptions()); From 72d885136a107d4c86e6005485e3aa82550ce85d Mon Sep 17 00:00:00 2001 From: Chad Bean Date: Thu, 16 Jul 2015 00:51:14 -0400 Subject: [PATCH 2/4] Updated tests to reflect the addition of Gender: Not Specified --- .../testsuite/Magento/Customer/Api/CustomerMetadataTest.php | 5 +++-- .../app/Magento/Customer/Test/Handler/Customer/Curl.php | 5 +++-- .../testsuite/Magento/Customer/Block/Widget/GenderTest.php | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php index 21a80b605d33b..dcd3503d7be4f 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php @@ -98,8 +98,9 @@ public function getAttributeMetadataDataProvider() AttributeMetadata::DATA_MODEL => '', AttributeMetadata::OPTIONS => [ ['label' => '', 'value' => ''], - ['label' => 'Male', 'value' => '1'], - ['label' => 'Female', 'value' => '2'], + ['label' => 'Not Specified', 'value' => '1'], + ['label' => 'Male', 'value' => '2'], + ['label' => 'Female', 'value' => '3'] ], AttributeMetadata::FRONTEND_CLASS => '', AttributeMetadata::FRONTEND_LABEL => 'Gender', diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index 2d8f5faf09f88..1f3330f93bab0 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php @@ -35,8 +35,9 @@ class Curl extends AbstractCurl implements CustomerInterface 'United Kingdom' => 'GB' ], 'gender' => [ - 'Male' => 1, - 'Female' => 2, + 'Not Specified' => 1, + 'Male' => 2, + 'Female' => 3 ], 'region_id' => [ 'California' => 12, diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php index b2aa8d62f9dfb..6ff739276a00e 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php @@ -47,7 +47,8 @@ public function testToHtml() { $html = $this->_block->toHtml(); $this->assertContains('Gender', $html); - $this->assertContains('', $html); - $this->assertContains('', $html); + $this->assertContains('', $html); + $this->assertContains('', $html); + $this->assertContains('', $html); } } From afeb17064ab171aeb292b2c6078f9423d8ba2adc Mon Sep 17 00:00:00 2001 From: Chad Bean Date: Wed, 29 Jul 2015 21:42:33 -0400 Subject: [PATCH 3/4] Change order of customer gender values --- .../Magento/Customer/Test/Unit/Block/Widget/GenderTest.php | 6 +++++- .../testsuite/Magento/Customer/Api/CustomerMetadataTest.php | 6 +++--- .../app/Magento/Customer/Test/Handler/Customer/Curl.php | 6 +++--- .../testsuite/Magento/Customer/Block/Widget/GenderTest.php | 6 +++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php index 1133ae149e60a..59aea3be5cc1b 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php @@ -169,7 +169,11 @@ public function testGetCustomer() */ public function testGetGenderOptions() { - $options = [['label' => __('Not Specified'), 'value' => 'NA'], ['label' => __('Male'), 'value' => 'M'], ['label' => __('Female'), 'value' => 'F']]; + $options = [ + ['label' => __('Male'), 'value' => 'M'], + ['label' => __('Female'), 'value' => 'F'], + ['label' => __('Not Specified'), 'value' => 'NA'] + ]; $this->attribute->expects($this->once())->method('getOptions')->will($this->returnValue($options)); $this->assertSame($options, $this->block->getGenderOptions()); diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php index dcd3503d7be4f..2c7cd67f0ba24 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php @@ -98,9 +98,9 @@ public function getAttributeMetadataDataProvider() AttributeMetadata::DATA_MODEL => '', AttributeMetadata::OPTIONS => [ ['label' => '', 'value' => ''], - ['label' => 'Not Specified', 'value' => '1'], - ['label' => 'Male', 'value' => '2'], - ['label' => 'Female', 'value' => '3'] + ['label' => 'Male', 'value' => '1'], + ['label' => 'Female', 'value' => '2'], + ['label' => 'Not Specified', 'value' => '3'] ], AttributeMetadata::FRONTEND_CLASS => '', AttributeMetadata::FRONTEND_LABEL => 'Gender', diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index 1f3330f93bab0..a385d1b4ff99a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php @@ -35,9 +35,9 @@ class Curl extends AbstractCurl implements CustomerInterface 'United Kingdom' => 'GB' ], 'gender' => [ - 'Not Specified' => 1, - 'Male' => 2, - 'Female' => 3 + 'Male' => 1, + 'Female' => 2, + 'Not Specified' => 3 ], 'region_id' => [ 'California' => 12, diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php index 6ff739276a00e..c612baf883b32 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/GenderTest.php @@ -47,8 +47,8 @@ public function testToHtml() { $html = $this->_block->toHtml(); $this->assertContains('Gender', $html); - $this->assertContains('', $html); - $this->assertContains('', $html); - $this->assertContains('', $html); + $this->assertContains('', $html); + $this->assertContains('', $html); + $this->assertContains('', $html); } } From 695567961430b4f181a7fbb51632754a970a8771 Mon Sep 17 00:00:00 2001 From: Chad Bean Date: Mon, 3 Aug 2015 14:16:56 -0400 Subject: [PATCH 4/4] Update CustomerSetup to change order of gender in option --- app/code/Magento/Customer/Setup/CustomerSetup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Setup/CustomerSetup.php b/app/code/Magento/Customer/Setup/CustomerSetup.php index c3483bd664042..34a34f01f3e65 100644 --- a/app/code/Magento/Customer/Setup/CustomerSetup.php +++ b/app/code/Magento/Customer/Setup/CustomerSetup.php @@ -324,7 +324,7 @@ public function getDefaultEntities() 'validate_rules' => 'a:0:{}', 'position' => 110, 'admin_checkout' => 1, - 'option' => ['values' => ['Not Specified', 'Male', 'Female']], + 'option' => ['values' => ['Male', 'Female', 'Not Specified']], ], 'disable_auto_group_change' => [ 'type' => 'static',