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

Fix PHPUnit tests on develop branch #1771

Merged
merged 1 commit into from
Dec 8, 2019
Merged

Conversation

mdupont
Copy link
Contributor

@mdupont mdupont commented Dec 2, 2019

When tests are run with a recent version of PHP, \Symfony\Component\Process\Process called in AbstractWebServerEmbeddedTest needs to be passed an array. When tests are run in an old PHP version (like 5.4), it needs to be passed a string.

Tests should pass regardless of the supported PHP version is running them.

Description

Make sure that we use \Symfony\Component\Process\Process::fromShellCommandLine() if available. If it's not available, it means we are running an older version of Process where it's safe to pass a string to the constructor.

Fixes #1770

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes

@mdupont mdupont changed the title fix: PHPUnit test Process() format Fix PHPUnit tests on develop branch Dec 2, 2019
@coveralls
Copy link

coveralls commented Dec 2, 2019

Coverage Status

Coverage remained the same at 94.619% when pulling aa44594 on mdupont:fix-tests into b8346af on PHPOffice:develop.

\Symfony\Component\Process\Process refuses being passed a string
with version > 5, which is installed with PHP > 7.2.5.

It also refuses being passed an array with version < 3.3, which is
installed with PHP < 5.5.9.

Solved by checking if Process::fromShellCommandLine() exists, which
was introduced in version 4.2.0.
@troosan troosan added this to the v0.18.0 milestone Dec 8, 2019
@troosan troosan merged commit 6381549 into PHPOffice:develop Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

PHPUnit tests are broken on the develop branch
3 participants