# How to run php unit tests in Sage 10 with acorn

**URL:** https://discourse.roots.io/t/how-to-run-php-unit-tests-in-sage-10-with-acorn/29102
**Category:** sage
**Tags:** phpunit, acorn
**Created:** 2025-01-11T20:31:18Z
**Posts:** 6

## Post 1 by @grzesiek1owline — 2025-01-11T20:31:18Z

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!

---

## Post 2 by @ben — 2025-01-13T11:59:34Z

You’ll need to provide us with the [full reproduction steps](https://discourse.roots.io/t/how-to-best-ask-questions-on-this-forum/24582).

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?

---

## Post 3 by @grzesiek1owline — 2025-01-21T01:06:42Z

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:

---

## Post 4 by @ben — 2025-01-21T09:50:44Z



---

## Post 5 by @ben — 2025-01-21T09:53:14Z

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

---

## Post 6 by @ben — 2025-01-21T09:53:20Z


