Skip to content

CE#34567: Fix deprecation issues found by integration tests #34781

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

Merged

Conversation

karyna-t
Copy link
Contributor

@karyna-t karyna-t commented Dec 9, 2021

Description (*)

Fix deprecation warning found by Integration Tests for PHP 8.1. compatibility

Related Pull Requests

Related Issues

  1. Fix Integration Tests to be compatible with PHP 8.1 #34567

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Dec 9, 2021

Hi @karyna-tsymbal-atwix. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-github-services m2-github-services added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Dec 9, 2021
@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review labels Dec 9, 2021
@andrewbess
Copy link
Contributor

@magento run Static Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@@ -439,7 +417,8 @@ public function getLastLoginDate()
*/
public function getStoreLastLoginDate()
{
$date = strtotime($this->getCustomerLog()->getLastLoginAt());
$lastLogin = $this->getCustomerLog()->getLastLoginAt();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

app/code/Magento/Customer/Model/Logger.php:82

@andrewbess
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess andrewbess force-pushed the fix-integration-tests-php-8.1 branch from 401600f to 54e70fb Compare December 9, 2021 18:31
@andrewbess
Copy link
Contributor

@magento run Integration Tests, Functional Tests CE, Functional Tests EE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@@ -488,7 +488,7 @@ private function setOptions(array $options): void
$this->numberFormatter->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, '');
}
if (array_key_exists('precision', $options)) {
$this->numberFormatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $options['precision']);
$this->numberFormatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $options['precision'] ?? 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think thats right place for fix. There are few places that use null as a value for precision while default is 2 \Magento\Framework\Pricing\PriceCurrencyInterface::DEFAULT_PRECISION

public function format(
$amount,
$includeContainer = true,
$precision = self::DEFAULT_PRECISION,
$scope = null,
$currency = null
);

I would ask you to test and see if we really expect\want 0 as precision in
https://github.com/magento/partners-magento2b2b/blob/32b75f9bc94fb4ddf9aa3a07393179554406eab8/app/code/Magento/PurchaseOrder/Ui/Component/Listing/Column/Price.php#L81-L86

https://github.com/magento/partners-magento2b2b/blob/32b75f9bc94fb4ddf9aa3a07393179554406eab8/app/code/Magento/CompanyCredit/Controller/Adminhtml/Index/Reimburse.php#L146-L152

If 0 is desired value please replace null with 0

@andrewbess andrewbess force-pushed the fix-integration-tests-php-8.1 branch from 97e0998 to 8ce2d14 Compare December 9, 2021 20:52
Copy link
Contributor

@andrewbess andrewbess left a comment

Choose a reason for hiding this comment

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

Hello @karyna-tsymbal-atwix
Thank you for your contribution
Great work ✔️

@magento-engcom-team
Copy link
Contributor

Hi @andrewbess, thank you for the review.
ENGCOM-9363 has been created to process this Pull Request
✳️ @andrewbess, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@andrewbess andrewbess added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: category of expertise labels Dec 9, 2021
@@ -939,7 +940,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)
);
}

return round($dimension, 3);
return $dimension ? round($dimension, 3) : 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

type casting might be more suitable here

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @xmav
Thank you for your review
Fixed, please check.

$this->addressHelper->getConfig('prefix_options', $store),
$this->addressHelper->getConfig('prefix_show', $store) == NooptreqSource::VALUE_OPTIONAL
);
$options = $this->addressHelper->getConfig('prefix_options', $store);
Copy link
Contributor

Choose a reason for hiding this comment

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

please move logic to prepareNamePrefixSuffixOptions()

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @xmav
Thank you for your review
Fixed, please check.

$this->addressHelper->getConfig('suffix_show', $store) == NooptreqSource::VALUE_OPTIONAL
);
$options = $this->addressHelper->getConfig('suffix_options', $store);
return $options !== null ? $this->prepareNamePrefixSuffixOptions(
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplication will be removed in internal PR

@xmav
Copy link
Contributor

xmav commented Dec 9, 2021

@magento-engcom-team magento-engcom-team merged commit 79327ff into magento:2.4-develop Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants