akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

Behat test crashes #4668

Closed jukump closed 5 years ago

jukump commented 8 years ago

akeneo-pim-system-info_2016-06-28_12-27.txt

I set up Behat as described here: http://docs.akeneo.com/1.4/contributing/behat.html

Setting up the test environment worked, but when I run

./bin/behat features/filter/identifier.feature

the test crashes to the following error:

Call to undefined function Context\assertEquals() in .../pim-community-dev/features/Context/CommandContext.php on line 54

Line 54: assertEquals($expected, $actual);

This only seems to be an issue with some tests. Other tests also crash when assertEquals() or assertTrue() is called, but for example this works fine:

./bin/behat features/product-group/create_product_group.feature

The 1.2.0 version of behat/common-contexts doesn't seem to be compatible with PHPUnit installed via composer, so I'm using behat/common-contexts:dev-master, which requires phpunit/phpunit:~4.0. Other dependencies are the same as in the docs.

arnolanglade commented 8 years ago

The behat/common-contexts does not require phpunit/phpunit but the PIM does. It requires the 3.7, not the 4.0. Did you ran a composer update or install?

jukump commented 8 years ago

Thanks for the reply. I ran composer install.

In fact the master branch of behat/common-contexts seems to require phpunit/phpunit:~4.0: https://github.com/Behat/CommonContexts/blob/master/composer.json#L34.

I tried version 1.2.0 earlier (which does not require PHPUnit) but it didn't work if PHPUnit is autoloaded using composer because it uses require_once to load PHPUnit: https://github.com/Behat/CommonContexts/blob/v1.2.0/Behat/CommonContexts/WebApiContext.php#L11.

With 1.2.0, when it gets to this point

require_once() .../pim-community-dev/vendor/behat/common-contexts/Behat/CommonContexts/WebApiContext.php:11

it results in

require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in .../pim-community-dev/vendor/phpunit/phpunit/PHPUnit/Autoload.php on line 45

Line 45: require_once 'File/Iterator/Autoload.php';

Looks like it's trying to load the file using Pear at this point, but installing the dependencies using Pear was not in the documentation. This could be fixed by using the master branch which uses composer autoloading, but doing so causes the issue in the original post. Any ideas how to get the tests running with either version?

arnolanglade commented 8 years ago

Ok I understand! Anyway, the projet is abandoned, the real fix is to removed that library.

jukump commented 8 years ago

That would be the best solution. I got most of the tests working for myself by using some workarounds, but as you said, the real fix would be to drop the deprecated library.

nidup commented 8 years ago

Don't hesitate to open a PR on the master to drop "behat/common-contexts" and change a bit the Akeneo PIM WebApiContext which is the only one using this library.

Doodoune commented 5 years ago

Hi @jukump! Did you still have this issue? Regards,

Doodoune commented 5 years ago

Hi! I close this issue. Feel free to reopen it if you still have an error. Regards,