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 Tests bundled with Magento fatal errors #27638

Closed
lbajsarowicz opened this issue Apr 7, 2020 · 7 comments
Closed

PHPUnit Tests bundled with Magento fatal errors #27638

lbajsarowicz opened this issue Apr 7, 2020 · 7 comments
Assignees
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reported on 2.3.4 Indicates original Magento version for the Issue report.

Comments

@lbajsarowicz
Copy link
Contributor

lbajsarowicz commented Apr 7, 2020

Preconditions (*)

  1. Vanilla Magento 2.3.4

Steps to reproduce (*)

  1. vendor/bin/phpunit -c dev/tests/phpunit.xml.dist

Expected result (*)

  1. Tests executed till the end

Actual result (*)

  1. Fatal errors:
Fatal error: Class Mock_CartExtensionInterface_0ba80a0b contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Magento\Quote\Api\Data\CartExtensionInterface::getAmazonOrderReferenceId, Magento\Quote\Api\Data\CartExtensionInterface::setAmazonOrderReferenceId) in /var/www/html/vendor/phpunit/phpunit-mock-objects/src/Generator.php(264) : eval()'d code on line 1
@m2-assistant
Copy link

m2-assistant bot commented Apr 7, 2020

Hi @lbajsarowicz. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

@lbajsarowicz do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@ghost ghost added this to Ready for QA in Community Backlog Apr 7, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Apr 7, 2020
@lbajsarowicz
Copy link
Contributor Author

As I was asked to update the issue:
image

PHP Fatal error:  Class Magento\Catalog\Api\Data\ProductExtension contains 18 abstract methods and must therefore be declared abstract or implement the remaining methods (Magento\Catalog\Api\Data\ProductExtensionInterface::getWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::setWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::getCategoryLinks, ...) in /var/www/html/dev/tests/unit/tmp/generated/code/Magento/Catalog/Api/Data/ProductExtension.php on line 4

Fatal error: Class Magento\Catalog\Api\Data\ProductExtension contains 18 abstract methods and must therefore be declared abstract or implement the remaining methods (Magento\Catalog\Api\Data\ProductExtensionInterface::getWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::setWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::getCategoryLinks, ...) in /var/www/html/dev/tests/unit/tmp/generated/code/Magento/Catalog/Api/Data/ProductExtension.php on line 4

PHP:

www-data@rescue-php-fpm:08:28 PM:/var/www/html$ php -v
PHP 7.3.15 (cli) (built: Mar  9 2020 03:13:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.15, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.
    with Zend OPcache v7.3.15, Copyright (c) 1999-2018, by Zend Technologies

@lbajsarowicz
Copy link
Contributor Author

Another one <3

Test 'Magento\Catalog\Test\Unit\Model\Product\CopierTest::testCopy' started
PHP Fatal error:  Class Magento\Catalog\Api\Data\ProductExtension contains 18 abstract methods and must therefore be declared abstract or implement the remaining methods (Magento\Catalog\Api\Data\ProductExtensionInterface::getWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::setWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::getCategoryLinks, ...) in /var/www/html/dev/tests/unit/tmp/generated/code/Magento/Catalog/Api/Data/ProductExtension.php on line 4

Fatal error: Class Magento\Catalog\Api\Data\ProductExtension contains 18 abstract methods and must therefore be declared abstract or implement the remaining methods (Magento\Catalog\Api\Data\ProductExtensionInterface::getWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::setWebsiteIds, Magento\Catalog\Api\Data\ProductExtensionInterface::getCategoryLinks, ...) in /var/www/html/dev/tests/unit/tmp/generated/code/Magento/Catalog/Api/Data/ProductExtension.php on line 4

@lbajsarowicz
Copy link
Contributor Author

Ooo! Who could expect.
Another one!


There was 1 error:

1) Magento\Framework\Stdlib\Test\Unit\DateTime\TimezoneTest::testDateIncludeTime with data set "Parse greek d/m/y date with time" ('30/10/2021, 12:01 π.μ.', 'el_GR', true, 1635570060)
Exception: DateTime::__construct(): Failed to parse time string (30/10/2021, 12:01 π.μ.) at position 0 (3): Unexpected character

/var/www/html/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php:186
/var/www/html/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneTest.php:95

lbajsarowicz added a commit to lbajsarowicz/magento2 that referenced this issue Apr 10, 2020
@ghost ghost assigned lbajsarowicz Apr 10, 2020
@ghost ghost moved this from Ready for QA to PR In Progress in Community Backlog Apr 10, 2020
lbajsarowicz added a commit to lbajsarowicz/magento2 that referenced this issue Apr 10, 2020
lbajsarowicz added a commit to lbajsarowicz/magento2 that referenced this issue Apr 11, 2020
magento-engcom-team added a commit that referenced this issue Apr 16, 2020
 - Merge Pull Request #27701 from lbajsarowicz/magento2:bugfix/unit-test-fatal-error
 - Merged commits:
   1. f34f8c3
   2. f616fd8
   3. dd39f7e
   4. 8e30aa9
magento-engcom-team added a commit that referenced this issue Apr 16, 2020
…op latest changes

Accepted Community Pull Requests:
 - #27603: Fix zoom on search input #27506 (by @ptylek)
 - #27689: [MFTF] Using action group to go to admin category page (by @Usik2203)
 - #27685: Removed a duplicate variable in Magento\QuoteGraphQl\Model\Resolver\Cart and in \Magento\QuoteGraphQl\Model\Resolver\SetBillingAddressOnCart (by @bgorski)
 - #27677: [MFTF] Removed redundant ActionGroup (by @Usik2203)
 - #27325: MFTF: Fix failing CMS tests due to PageBuilder conflict (by @lbajsarowicz)
 - #27701: #27638 Fix fatal errors in Unit Tests (by @lbajsarowicz)
@ihor-sviziev
Copy link
Contributor

I see that this issue was already fixed by #27701, so I'm closing this issue.

@ghost ghost moved this from PR In Progress to Done (last 30 days) in Community Backlog Apr 28, 2020
@ihor-sviziev ihor-sviziev added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Apr 28, 2020
@magento-engcom-team
Copy link
Contributor

Hi @lbajsarowicz. Thank you for your report.
The issue has been fixed in #27701 by @lbajsarowicz in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@magento-engcom-team magento-engcom-team removed this from Done (last 30 days) in Community Backlog May 8, 2020
@jacekl
Copy link

jacekl commented Jul 7, 2020

Good job @lbajsarowicz !

I have the same issue upgrading from 2.3.3. to 2.3.5... One thing to mention:

  • it happens after you run setup:di:compile command before running unit tests,
  • if you remove generated/code directory contents and run unit tests without setup:di:compile - tests are executing correctly.

At least for me.

@magento-engcom-team magento-engcom-team added the Reported on 2.3.4 Indicates original Magento version for the Issue report. label Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reported on 2.3.4 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

4 participants