magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.32k forks source link

Static unit tests failure #10146

Closed ionutturdean closed 5 years ago

ionutturdean commented 7 years ago

Hi,

After installing Magento-EE-2.1.7, and adding one test module the static unit tests are failing. If I run the tests just on the Magento-EE-2.1.7 with no custom module the test are working with no errors.

Preconditions

I am using Magento-EE-2.1.7

Steps to reproduce

Create a custom module Run the unit tests: php bin/magento dev:tests:run unit

Expected result

  1. Tests should run with no errors

Actual result

PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from /var/www/html/magento2/dev/tests/static/framework/tests/unit/phpunit.xml.dist

...............................F...F......FFF.................... 65 / 66 ( 98%) .

Time: 270 ms, Memory: 8.00MB

There were 5 failures:

1) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Extend class in different module" ('Magento\AnotherModule\SomeClass', 'something extends \Magento\SomeModule\Any\ClassName {', array(array('Magento\SomeModule', 'hard', 'Magento\SomeModule\Any\ClassName'))) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array (

/var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

2) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Helper class from another module" ('Magento\AnotherModule\SomeClass', '$this->helper("Magento\SomeModule\Any\ClassName")', array(array('Magento\SomeModule', 'hard', 'Magento\SomeModule\Any\ClassName'))) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array (

/var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

3) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin on class in different module" ('Magento\Module1\Plugin2', 'Magento\Module2\Subject', array(array('Magento\Module2', 'soft', 'Magento\Module2\Subject'))) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array (

/var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

4) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin depends on arbitrary class in same module as subject" ('Magento\Module1\Plugin2', 'Magento\Module2\NotSubject', array(array('Magento\Module2', 'soft', 'Magento\Module2\NotSubject'))) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array (

/var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

5) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin depends on arbitrary class in arbitrary module" ('Magento\Module1\Plugin2', 'Magento\OtherModule\NotSubject', array(array('Magento\OtherModule', 'hard', 'Magento\OtherModule\NotSubject'))) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array (

/var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

FAILURES!
Tests: 66, Assertions: 89, Failures: 5.

Similar issue was reported in this ticket: #3901 The ticket was closed on the 27 of March as the test was no longer failing, but for me is still reproducing.

veloraven commented 7 years ago

@ionutturdean thank you for your feedback. Please report EE issues via the Support portal of your account or Partner portal if you are a partner reporting on behalf of a merchant. Github is intended for Community edition reports given no account management for CE users. This will allow for proper tracking of issues at the account level.

Chuvisco88 commented 6 years ago

I am having the same issue but getting 7 failures. All of them happen in dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php or dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php How to fix this?

mzeis commented 6 years ago

Hi,

I'm re-opening this in accordance with @paliarush. This is an acknowedlged bug and tracked in MAGETWO-85859.

mzeis commented 6 years ago

I can reproduce this on Commerce Edition 2.2.3 with PHPUnit 6.2.0.

ghost commented 6 years ago

We were not able to reproduce this issue on latest Magento 2 release. @mzeis can you please confirm issue is reproducible on Magento 2.2.5?

mzeis commented 6 years ago

Hi @engcom-backlog-pb,

yes I still can reproduce it in developer and production mode, both using bin/magento dev:tests:run unit and more quickly by executing a subset of the tests directly.

Steps to reproduce including Composer installation:

[/tmp] 
$ composer create-project --repository=https://repo.magento.com/ magento/project-enterprise-edition magento

Installing magento/project-enterprise-edition (2.2.5)
  - Installing magento/project-enterprise-edition (2.2.5): Loading from cache
Created project in magento
Loading composer repositories with package information

(...)

Writing lock file
Generating autoload files

[/tmp] 
$ cd magento/

[/tmp/magento] 
$ bin/magento setup:install --base-url=http://localhost/magento2ee --db-host=localhost --db-name=magento --db-user=root --db-password=root --backend-frontname=admin --admin-firstname=admin --admin-lastname=admin --admin-email=admin@admin.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

Starting Magento installation:
File permissions check...
[Progress: 1 / 825]
Required extensions check...
[Progress: 2 / 825]

(...)

Post installation file permissions check...
For security, remove write permissions from these directories: '/tmp/magento/app/etc'
[Progress: 824 / 825]
Write installation date...
[Progress: 825 / 825]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin
Nothing to import.

[/tmp/magento] 
$ bin/magento deploy:mode:set developer
Enabled developer mode.

$ cd dev/tests/static/framework/tests/unit/

[/tmp/magento/dev/tests/static/framework/tests/unit] 
$ /usr/bin/php7.0 /tmp/magento/vendor/phpunit/phpunit/phpunit 
PHPUnit 6.2.4 by Sebastian Bergmann and contributors.

.........FF........................F...F......FFF................ 65 / 90 ( 72%)
.........................                                         90 / 90 (100%)

Time: 183 ms, Memory: 8.00MB

There were 7 failures:

1) Magento\TestFramework\Dependency\DiRuleTest::testGetDependencyInfo with data set "Di external dependencies" ('Magento\SomeModule', '<?xml version="1.0"?>\n<!--\n...fig>\n', array(array('Magento\ExternalModule3', 'soft', 'Magento\ExternalModule3\Some\...\Class'), array('Magento\ExternalModule5', 'soft', 'Magento\ExternalModule5\Some\...\Class'), array('Magento\ExternalModule6', 'soft', 'Magento\ExternalModule6\Some\...\Class'), array('Magento\ExternalModule1', 'hard', 'Magento\ExternalModule1\Some\Argument1'), array('Magento\ExternalModule2', 'hard', 'Magento\ExternalModule2\Some\Argument2'), array('Magento\ExternalModule4', 'hard', 'Magento\ExternalModule4\Some\Argument3')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
-    1 => Array (...)
-    2 => Array (...)
-    3 => Array (...)
-    4 => Array (...)
-    5 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php:27

2) Magento\TestFramework\Dependency\DiRuleTest::testGetDependencyInfo with data set "Di virtual dependencies" ('Magento\SomeModule', '<?xml version="1.0"?>\r\n<!--...g>\r\n', array(array('Magento\AnotherModule', 'hard', 'Magento\AnotherModule\Some\Class1'), array('Magento\AnotherModule', 'hard', 'Magento\AnotherModule\Some\Class2')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
-    1 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DiRuleTest.php:27

3) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Extend class in different module" ('Magento\AnotherModule\SomeClass', 'something extends \Magento\So...Name {', array(array('Magento\SomeModule', 'hard', 'Magento\SomeModule\Any\ClassName')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

4) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Helper class from another module" ('Magento\AnotherModule\SomeClass', '$this->helper("Magento\SomeMo...Name")', array(array('Magento\SomeModule', 'hard', 'Magento\SomeModule\Any\ClassName')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

5) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin on class in different module" ('Magento\Module1\Plugin2', 'Magento\Module2\Subject', array(array('Magento\Module2', 'soft', 'Magento\Module2\Subject')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

6) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin depends on arbitrary class in same module as subject" ('Magento\Module1\Plugin2', 'Magento\Module2\NotSubject', array(array('Magento\Module2', 'soft', 'Magento\Module2\NotSubject')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

7) Magento\TestFramework\Dependency\PhpRuleTest::testGetDependencyInfo with data set "Plugin depends on arbitrary class in arbitrary module" ('Magento\Module1\Plugin2', 'Magento\OtherModule\NotSubject', array(array('Magento\OtherModule', 'hard', 'Magento\OtherModule\NotSubject')))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => Array (...)
 )

/tmp/magento/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php:42

FAILURES!
Tests: 90, Assertions: 133, Failures: 7.

These are the 7 failures been mentioned by @Chuvisco88.

magento-engcom-team commented 5 years ago

Hi @engcom-backlog-andrii. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

ghost commented 5 years ago
[centos@ca5325a7900b unit]$ /var/www/html/vendor/phpunit/phpunit/phpunit
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

...............................................................................................                                                                                                                    95 / 95 (100%)

Time: 1.77 seconds, Memory: 8.00MB

OK (95 tests, 138 assertions)