Skip to content
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

Fix #10438: Potential error on order edit page when address has extension attributes #11787

Merged
merged 1 commit into from
Nov 21, 2017

Conversation

YevSent
Copy link
Contributor

@YevSent YevSent commented Oct 26, 2017

Fixed Issues

  1. Potential error on order edit page when address has extension attributes #10438: Potential error on order edit page when address has extension attributes

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)


$object = $this->adminOrderCreate->applyCoupon($couponCode);
$this->assertEquals($this->adminOrderCreate, $object);
self::assertEquals($this->adminOrderCreate, $object);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->assert* must be used, change all occurrences.

Copy link
Contributor Author

@YevSent YevSent Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlangur, assert* it's a static function. Also, I didn't find any requirements about $this->...* usage instead self::... for tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy, it's a recommendation of PHPUnit author, we should not rely on 15 years old things from Java: sebastianbergmann/phpunit#1914 (comment)

Maybe I'll implement static test enforcing this someday but till then please keep things consistent, most of calls in Magento codebase are $this->assert currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see, it's just a recommendation. We are using self::assert more than 1 year in the tests.

Another point, it's calling static methods as non-static could be changed in future versions, the same we have got for PHP 5.6 for calling non-static as static - http://php.net/manual/en/migration56.deprecated.php

Copy link
Contributor

@orlangur orlangur Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course you can use self:: technically but it's lame.

31352 occurrences of $this->assert vs 296 of self::assert, hm, not too much tests written during more than a year :)

There is no point in continuing discussion but now I see that a test enforcing best practices is really needed.

@magento-engcom-team magento-engcom-team added 2.2.x bugfix Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 7, 2017
@okorshenko okorshenko added this to the November 2017 milestone Nov 7, 2017
@YevSent YevSent removed the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Nov 8, 2017
@omiroshnichenko omiroshnichenko self-assigned this Nov 20, 2017
@@ -296,7 +304,8 @@ public function __construct(
\Magento\Sales\Api\OrderManagementInterface $orderManagement,
\Magento\Quote\Model\QuoteFactory $quoteFactory,
array $data = [],
\Magento\Framework\Serialize\Serializer\Json $serializer = null
\Magento\Framework\Serialize\Serializer\Json $serializer = null,
ExtensibleDataObjectConverter $dataObjectConverter = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, update docblock accordingly with the parameters that you accept.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

 - Changed shipping and billing address comparision
 - Refactored related tests
okorshenko pushed a commit that referenced this pull request Nov 21, 2017
@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 21, 2017
@YevSent YevSent deleted the G#10438 branch July 2, 2018 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report bugfix Fixed in 2.2.x The issue has been fixed in 2.2 release line Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants