How to run php unit tests in Sage 10 with acorn

I’m trying to set up PHPUnit tests in my Sage 10 theme using WP-CLI’s wp scaffold theme-tests. However, when I try to run the tests using vendor/bin/phpunit or lando php ./vendor/bin/phpunit, instead of running the tests, I get Acorn’s help output:

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
  Acorn 4.3.1 (Laravel 10.43.0)
  USAGE: wp acorn <command> [options] [arguments]
  about                                Display basic information about your application

Environment:

  • Sage 10
  • Acorn 4.3.1
  • PHP 8.2
  • Running in Lando/Docker environment

Questions:

  1. Is there a way to run PHPUnit tests in Sage 10 without Acorn intercepting the execution?
  2. Should we use a different approach for testing Sage 10 themes?
  3. Are there any recommended practices for setting up tests in Sage 10?

Any help or guidance would be greatly appreciated!

You’ll need to provide us with the full reproduction steps.

Besides running the wp scaffold theme-tests <theme> command, what exactly did you do? Sage doesn’t come with PHPUnit installed. If you try to manually run PHPUnit after scaffolding the tests, you’ll see an error about a file missing. How can I get a stock Sage 10 install to reproduce what you’re seeing?

I tried with different combinations. Unfortunately, I do not have the opportunity to share at the moment, but maybe it would be easier if there was someone with a ready-made recipe on how to run PHP unit in sage 10. I need to have the current Wordpress core loaded for the tests, all the plugins installed and of course my theme. I know I’m going more into integration tests here, but my services are strongly linked to Woocommece, so I would like to be able to use the api of this plugin.

If for some reason it is not possible, I would like to run the simplest unit tests in which I will mock methods from plugins.

Is there a guide or ready-made recipe on how to implement it? AI gave up :wink:

No need to make topics or post replies on here if you can’t spend the time do basic things like providing reproduction steps