-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rest api multiselect attribute bc break between 2.1.8 and 2.3.0 #21901
Rest api multiselect attribute bc break between 2.1.8 and 2.3.0 #21901
Conversation
Hi @Valant13. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution @Valant13!
Please check my comments, simplify implementation and unit test.
Also, please write an API test covering initial case and after all builds are green, squash changes into a single commit.
|
||
$arrayFrontendInputs = ['multiselect']; | ||
$frontendInput = $attribute->getFrontendInput(); | ||
if (in_array($frontendInput, $arrayFrontendInputs)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (in_array($frontendInput, $arrayFrontendInputs)) { | |
if ($attribute->getFrontendInput() === 'multiselect') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for the review.
Do you mean integration tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | ||
* @var Attribute|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
$attributeMock = $this->getMockBuilder(Attribute::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix formatting and use createMock
instead to make mock declarations more compact.
/** | ||
* @var SimpleType|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
$simpleType = ($this->objectManger)->getObject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of ObjectManager and setUp
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @orlangur. I use ObjectManager to create testable class instance. What should I use instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant just get rid of property and setUp
method but here it also makes sense to replace it with new
operator.
* @return array | ||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||
*/ | ||
public function getTypeDataProvider() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such test does not actually verify anything. It's just a method logic written in a different form.
Try splitting into proper test cases.
963f3b7
to
c0370a7
Compare
Hi @Valant13 , looks like you made some commits with email different than in your GitHub profile, please, add email from commits to your profile! |
/** | ||
* @var SimpleType|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
$simpleType = ($this->objectManger)->getObject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant just get rid of property and setUp
method but here it also makes sense to replace it with new
operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Valant13 perfect! 👍
LGTM, please squash changes into a single commit so that we have perfectly clean history 😉
Hi @sidolov, thank you for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are still not squashed. @Valant13 please do it.
@orlangur, sorry for delay. I will squash changes on the next week |
Add conditions for multiselect attribute validation. REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Create unit test for app/code/Magento/Eav/Model/TypeLocator/SimpleType.php. REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Code refactoring. REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Code refactoring. REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Change unit test functionality for app/code/Magento/Eav/Model/TypeLocator/SimpleType.php. REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Create api-functional test for the following case REST API multiselect attribute BC break between 2.1.8 and 2.3.0. Remove ObjectManager and setUp method.
984c09d
to
a8bcd7d
Compare
@orlangur, I have squashed all changes to the single commit |
Hi @orlangur, thank you for the review. |
b3f0fc5
to
b44e33d
Compare
b44e33d
to
5162d50
Compare
Hi @Valant13 thank you for collaboration, yours changes doesn't work for SOAP client, and test testUpdateMultiselectAttributesWithArrayValue() failed with following result
|
@Valant13, I am closing this PR now due to inactivity. |
Hi @Valant13, thank you for your contribution! |
Description (*)
Correct conditions for multiselect attribute validation have been added.
Unit test for app/code/Magento/Eav/Model/TypeLocator/SimpleType.php has been created.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Sample JSON body (options as string with ids separated by comma):
Sample JSON body (options as array of ids in string):
Contribution checklist (*)