Skip to content

#27500 Prepare ConfigurableProduct module Tests for PHPUnit 8 #27822

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

lbajsarowicz
Copy link
Contributor

@lbajsarowicz lbajsarowicz commented Apr 12, 2020

Description (*)

Preparing PHPUnit Tests to run with PHPUnit 8.
PRs for each module is separated to make tests easier to merge.

Related Pull Requests

Fixed Issues (if relevant)

  1. Unit Tests incompatible with PHPUnit 8 #27500

Manual testing scenarios (*)

N/A

Questions or comments

PR #27701 needs to be merged first (otherwise PHPUnit tests fail)

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)

@m2-assistant
Copy link

m2-assistant bot commented Apr 12, 2020

Hi @lbajsarowicz. 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.

@dmytro-ch dmytro-ch self-assigned this Apr 15, 2020
@slavvka
Copy link
Member

slavvka commented Apr 16, 2020

The cause of failure is:

18:23:59 FPHP Fatal error:  Interface 'Magento\Catalog\Api\Data\ProductExtensionInterface' not found in /var/www/html/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/ProductExtensionAttributes.php on line 10

@ihor-sviziev ihor-sviziev self-assigned this Apr 16, 2020
@slavvka slavvka changed the base branch from 2.4-develop to phpunit8 April 16, 2020 14:49
@ihor-sviziev
Copy link
Contributor

@slavvka could you give some info why static tests failing?

@slavvka
Copy link
Member

slavvka commented Apr 17, 2020

@magento run all tests

@slavvka
Copy link
Member

slavvka commented Apr 17, 2020

@ihor-sviziev

19:08:55 .PHP Fatal error:  Interface 'Magento\Catalog\Api\Data\ProductExtensionInterface' not found in /var/www/html/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/ProductExtensionAttributes.php on line 12

@lbajsarowicz
Copy link
Contributor Author

@slavvka Is that message from PHPStan?

@slavvka
Copy link
Member

slavvka commented Apr 19, 2020

@lbajsarowicz no, phpunit when running PHP static tests, only on B2B:

        <testsuite name="PHP Coding Standard Verification">
            <file>testsuite/Magento/Test/Php/LiveCodeTest.php</file>
        </testsuite>
        <testsuite name="Xss Unsafe Output Test">
            <file>testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php</file>
        </testsuite>

@slavvka
Copy link
Member

slavvka commented Apr 19, 2020

Also here are the same warnings:

14:59:34 There were 13 warnings:
14:59:34 
14:59:34 1) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "missing_previous_and_new_status" (null, null, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 2) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "missing_previous_status_and_subscribe" (null, true, true)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 3) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "new_unsubscribed_value_and_missing_previous_status" (null, false, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 4) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previous_subscribed_status_without_new_value" (1, null, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 5) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "same_subscribed_previous_and_new_status" (1, true, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 6) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "unsubscribe_previously_subscribed_customer" (1, false, false)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 7) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previously_unsubscribed_status_without_new_value" (3, null, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 8) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "subscribe_previously_unsubscribed_customer" (3, true, true)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 9) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "same_unsubscribed_previous_and_new_status" (3, false, null)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 10) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previous_unconfirmed_status_without_new_value" (4, null, true)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 11) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "subscribe_previously_unconfirmed_status" (4, true, true)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 12) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "unsubscribe_previously_unconfirmed_status" (4, false, true)
14:59:34 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
14:59:34 
14:59:34 13) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterGetByIdCreatesExtensionAttributes
14:59:34 Trying to configure method "setIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static

@slavvka
Copy link
Member

slavvka commented Apr 22, 2020

Static only in B2B:

16:48:03 .PHP Fatal error:  Interface 'Magento\Catalog\Api\Data\ProductExtensionInterface' not found in /var/www/html/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/ProductExtensionAttributes.php on line 12

@slavvka
Copy link
Member

slavvka commented Apr 22, 2020

Unit CE, EE, B2B

16:49:52 There were 13 warnings:
16:49:52 
16:49:52 1) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "missing_previous_and_new_status" (null, null, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 2) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "missing_previous_status_and_subscribe" (null, true, true)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 3) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "new_unsubscribed_value_and_missing_previous_status" (null, false, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 4) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previous_subscribed_status_without_new_value" (1, null, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 5) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "same_subscribed_previous_and_new_status" (1, true, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 6) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "unsubscribe_previously_subscribed_customer" (1, false, false)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 7) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previously_unsubscribed_status_without_new_value" (3, null, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 8) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "subscribe_previously_unsubscribed_customer" (3, true, true)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 9) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "same_unsubscribed_previous_and_new_status" (3, false, null)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 10) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "previous_unconfirmed_status_without_new_value" (4, null, true)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 11) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "subscribe_previously_unconfirmed_status" (4, true, true)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 12) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterSave with data set "unsubscribe_previously_unconfirmed_status" (4, false, true)
16:49:52 Trying to configure method "getIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static
16:49:52 
16:49:52 13) Magento\Newsletter\Test\Unit\Model\Plugin\CustomerPluginTest::testAfterGetByIdCreatesExtensionAttributes
16:49:52 Trying to configure method "setIsSubscribed" which cannot be configured because it does not exist, has not been specified, is final, or is static

@slavvka
Copy link
Member

slavvka commented Apr 23, 2020

12:36:57 PHP Fatal error:  Declaration of Magento\Banner\Test\Unit\Block\Adminhtml\Widget\Instance\Edit\Chooser\ContainerTest::setUp() must be compatible with Magento\Widget\Test\Unit\Block\Adminhtml\Widget\Instance\Edit\Chooser\AbstractContainerTest::setUp(): void in /var/www/html/app/code/Magento/Banner/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php on line 15

@slavvka
Copy link
Member

slavvka commented Apr 23, 2020

Static tests

12:41:47 .PHP Fatal error:  Interface 'Magento\Catalog\Api\Data\ProductExtensionInterface' not found in /var/www/html/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/ProductExtensionAttributes.php on line 12

@slavvka
Copy link
Member

slavvka commented Apr 23, 2020

@magento run all tests

@ihor-sviziev
Copy link
Contributor

From my perspective this pr could be merged, as I understood issue inside EE or b2b version

@slavvka slavvka merged commit 7e14469 into magento:phpunit8 Apr 24, 2020
@m2-assistant
Copy link

m2-assistant bot commented Apr 24, 2020

Hi @lbajsarowicz, 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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants