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

PhpUnit 8 Migration - AdminNotification #27521

Merged

Conversation

ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Mar 31, 2020

Description (*)

This PR updates unit tests in AdminNotification module + contains framework fix from #27519

Note:
We have 2 warnings that can't be fixed because these new methods doesn't exists in phpunit 6:

1) Magento\AdminNotification\Test\Unit\Model\System\Message\CacheOutdatedTest::testGetText
Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.

2) Magento\AdminNotification\Test\Unit\Model\System\Message\Media\Synchronization\ErrorTest::testGetText
Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.

Related Pull Requests

Fixed Issues (if relevant)

  1. Unit Tests incompatible with PHPUnit 8 #27500

Manual testing scenarios (*)

  1. Run tests in phpunit 6 (currently in 2.4-develop) using vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Magento/AdminNotification/
  2. Install phpunit 8, run tests using vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Magento/AdminNotification/

Questions or comments

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 are green)

Fix library related to unit tests
@m2-assistant
Copy link

m2-assistant bot commented Mar 31, 2020

Hi @ihor-sviziev. Thank you for your contribution
Here is 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

For more details, please, review the Magento Contributor Guide documentation.

Update unit tests in AdminNotification module
Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

In future we can change the scope for Test properties from protected to private.
I'm not sure if it's for purpose or accidentally, but you've added changes from other PR.

You can put in the description that this PR would work after merging another (however the changes introduced in files related to AdminNotification are backward compatible, so there's no dependency)

@ihor-sviziev
Copy link
Contributor Author

@magento run all tests

@ihor-sviziev
Copy link
Contributor Author

@lbajsarowicz
I fixed comments that you left. Why I put there one commit from framework - just to make these pull requests independent, as the same commit is there in al PRs - there will not be any conflicts between them and all of these PRs will actually work

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, thank you for the review.
ENGCOM-7243 has been created to process this Pull Request
✳️ @lbajsarowicz, 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

@ihor-sviziev
Copy link
Contributor Author

@lenaorobei seems like we have false positive in static test

@lenaorobei
Copy link
Contributor

@ihor-sviziev looking into it.

@ghost ghost assigned lenaorobei Apr 1, 2020
@lenaorobei
Copy link
Contributor

Yes, the 3-rd finding looks like false-positive, but it should disappear when first 2 will be fixed.

Copy link
Contributor

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

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

Yes, I reviewed them before and was waiting for tests to pass.
We have all green, so my approval is there.

@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz, thank you for the review.
ENGCOM-7243 has been created to process this Pull Request
✳️ @lbajsarowicz, 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

@engcom-Alfa
Copy link
Contributor

engcom-Alfa commented Apr 2, 2020

✔️ QA Passed

Preconditions:
PHPUnit v8.5.3
php 7.3

Before:
Screenshot from 2020-04-02 16-47-39

After:
Screenshot from 2020-04-02 16-38-14

@engcom-Alfa engcom-Alfa added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Apr 2, 2020
@engcom-Echo engcom-Echo self-assigned this Apr 3, 2020
@magento-engcom-team magento-engcom-team merged commit 3bb1b22 into magento:2.4-develop Apr 4, 2020
@m2-assistant
Copy link

m2-assistant bot commented Apr 4, 2020

Hi @ihor-sviziev, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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.

6 participants