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 not working in ddev on Mac #39

Closed
finnlewis opened this issue Jul 19, 2024 · 9 comments
Closed

phpunit not working in ddev on Mac #39

finnlewis opened this issue Jul 19, 2024 · 9 comments

Comments

@finnlewis
Copy link

Hey folks, this is great!

It works a treat on my Ubuntu machine, following the steps fro the README.md.

However, on my Mac, phpunit does not seem to be working.

When attempting to run phpunit, I get the following:

finn$ ddev phpunit core/modules/sdc
Clearing old webdriver sessions
PHPUnit 10.5.26 by Sebastian Bergmann and contributors.

Unknown option "--verbose"
Failed to run phpunit core/modules/sdc: exit status 2

I'm using ddev version v1.23.3 on both machines.

I followed the same steps, copied below:

git clone https://git.drupalcode.org/project/drupal.git drupal
cd drupal
ddev config --omit-containers=db --disable-settings-management
ddev start
ddev get justafish/ddev-drupal-core-dev
ddev restart
ddev composer install

# See included commands
ddev drupal list

# Install drupal
ddev drupal install

# Run PHPUnit tests
ddev phpunit core/modules/sdc

# Run Nightwatch tests (currently only runs on Chrome)
ddev nightwatch --tag core

Any ideas?

@rfay
Copy link
Contributor

rfay commented Jul 19, 2024

phpunit v10 does not have the --verbose option.

This project's phpunit command does not use the --verbose option, see https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit

Why don't you rm -rf .ddev/commands/web/phpunit ~/.ddev/commands/web/phpunit and do the ddev get again and ddev restart and see if you make any progress. Also try ddev exec phpunit, which is mostly the same thing. I think you may have a script in your project that is using --verbose

@finnlewis
Copy link
Author

Hey @rfay

Thanks for the quick reply.

Looks like it's in the latest tagged release: https://github.com/justafish/ddev-drupal-core-dev/blob/v0.0.11/commands/web/phpunit#L10

But not on https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit#L14

Does the ddev get justafish/ddev-drupal-core-dev pull in the latest tagged release or main branch ?

@finnlewis
Copy link
Author

Yeah, replacing my .ddev/commands/web/phpunit with this one seems to play better!

https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit

:)

@finnlewis
Copy link
Author

If we tag another release would that fix it?

@rfay
Copy link
Contributor

rfay commented Jul 19, 2024

I see, this was fixed in cd06f6c

That was pulled on May 23, 2024, and @justafish hasn't made a release since then.

You can get latest with ddev get https://github.com/justafish/ddev-drupal-core-dev/tarball/main

@justafish how about a release? (Or give privs to an additional person?)

@finnlewis
Copy link
Author

Fab, thanks @rfay

Updated install / startup steps that work for me:

git clone https://git.drupalcode.org/project/drupal.git drupal
cd drupal
ddev config --omit-containers=db --disable-settings-management
ddev start
ddev get https://github.com/justafish/ddev-drupal-core-dev/tarball/main
ddev restart
ddev composer install

# See included commands
ddev drupal list

# Install drupal
ddev drupal install

# Run PHPUnit tests
ddev phpunit core/modules/text

# Run Nightwatch tests (currently only runs on Chrome)
ddev nightwatch --tag core

Note: ddev phpunit core/modules/sdc did not run any tests for me, as it looks like there are no tests there to run as it's been moved to core, so maybe a different example would be useful to demonstrate the tests running, like ddev phpunit core/modules/text

Anyway, all good, happy to close this.

Thanks for your help @rfay , you are a legend!

@rfay
Copy link
Contributor

rfay commented Jul 19, 2024

I guess we should leave it open until release happens. Maybe you can close it then.

@scottatdrake
Copy link

Just wanted to report that I ran into this issue but the comments here got me up and running. Thanks for that. Maybe a new tag as requested in #40 would make things easier for the next folks to come by.

@justafish
Copy link
Owner

done 👍

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

4 participants