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

Moosh makes Moodle behat init fail #288

Closed
mwithheld opened this issue Feb 7, 2020 · 2 comments
Closed

Moosh makes Moodle behat init fail #288

mwithheld opened this issue Feb 7, 2020 · 2 comments

Comments

@mwithheld
Copy link
Contributor

@mwithheld mwithheld commented Feb 7, 2020

  • moosh version: latest
  • moodle version: 3.8
    • database: any
  • php version:any
  • operating system:linux

Steps to reproduce

Actual behaviour

  • Install a clean Moodle
  • Install Moosh from moodle.org/plugins
curl https://moodle.org/plugins/download.php/20823/moosh_moodle.zip --output moosh.zip; unzip -o -q moosh.zip; rm -f moosh.zip;
cd moosh; php ../composer.phar install; ln -f -s $PWD/moosh.php /usr/local/bin/moosh; cd ..;
  • Run the command-line Behat init: admin/tool/behat/cli/init.php

  • It fails with these errors:

PHP Warning:  require_once(/var/www/html/moosh/tests/mooshtest/tests/behat/../../../../lib/behat/behat_base.php): failed to open stream: No such file or directory in /var/www/html/moosh/tests/mooshtest/tests/behat/behat_moosh.php on line 24
PHP Fatal error:  require_once(): Failed opening required '/var/www/html/moosh/tests/mooshtest/tests/behat/../../../../lib/behat/behat_base.php' (include_path='/var/www/html/lib/pear:.:/usr/local/lib/php') in /var/www/html/moosh/tests/mooshtest/tests/behat/behat_moosh.php on line 24

Warning: require_once(/var/www/html/moosh/tests/mooshtest/tests/behat/../../../../lib/behat/behat_base.php): failed to open stream: No such file or directory in /var/www/html/moosh/tests/mooshtest/tests/behat/behat_moosh.php on line 24

Fatal error: require_once(): Failed opening required '/var/www/html/moosh/tests/mooshtest/tests/behat/../../../../lib/behat/behat_base.php' (include_path='/var/www/html/lib/pear:.:/usr/local/lib/php') in /var/www/html/moosh/tests/mooshtest/tests/behat/behat_moosh.php on line 24
  • There is no lib/behat directory under the moosh/ dir this path resolves to. I think it's meant to be looking for lib/behat relative to the Moodle root one level higher.

  • I don't see how 4 levels up from /moosh/tests/mooshtest/tests/behat/ ever resolves to the Moodle root, which will always be 1 level higher. If it usually works b/c you're including behat_moosh.php from another directory, try use dirname(DIR) to get there.

  • If you need to, you could try a little harder to guess where the Moodle root is, e.g. pseudocode:

- Look for config.php at '__DIR__ . '/../../../../'
- If it is not there, look one more level up
- require_once from this path.

Expected behaviour

Moodle's Behat tests should not fail

@mwithheld
Copy link
Contributor Author

@mwithheld mwithheld commented Feb 7, 2020

Workaround: Nuke the moosh/tests folder.

@tmuras
Copy link
Owner

@tmuras tmuras commented Apr 5, 2020

I just think that moosh should not be installed (copied, put) into Moodle installation (source code). I think I'll update the documentation to mention that.

@tmuras tmuras closed this as completed in a5d3d25 Apr 5, 2020
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

No branches or pull requests

2 participants