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 bootstrap - Work-around for issues with running phpunit in symlinked dirs #121

Merged
merged 2 commits into from
Feb 22, 2018

Conversation

totten
Copy link
Owner

@totten totten commented Feb 7, 2018

There was add an odd phenomenon when an extension is moved to a symlinked dir, e.g.

ln -s ~/src/org.example.foo civicrm/tools/extensions/org.example.foo

If you navigated into the folder and called cv directly (e.g. cv api contact.get or cv php:boot), then it worked fine. However, if you navigated into the same folder and called phpunit (which then called cv php:boot), then they'd fail. Empirically, phpunit does the equivalent of chdir(realpath(getcwd())) (although I haven't traced how/why).

This patch provides a work-around in the template. You may need to update the tests/phpunit/bootstrap.php to benefit from it.

…mlinked dirs

There was add an odd phenomenon when an extension is moved to a symlinked dir, e.g.

```
ln -s ~/src/org.example.foo civicrm/tools/extensions/org.example.foo
```

If you navigated into the folder, the `cv` commands would work fine if
called directly (e.g.  `cv api contact.get` or `cv php:boot`).  However, if
called as part of `phpunit`, then they'd fail. Empirically, `phpunit`
does the equivalent of `chdir(realpath(getcwd()))` (although I haven't
traced how/why).

This patch provides a work-around in the template. You may need to update
the `tests/phpunit/bootstrap.php` to benefit from it.
@totten totten merged commit c032e8e into master Feb 22, 2018
@totten totten deleted the master-phpunit-symlink branch February 22, 2018 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant