<p>Yes it is possible, see this example plugin by Selvin Ortiz: <a href="https://github.com/selvinortiz/craft.loath" rel="nofollow noreferrer">https://github.com/selvinortiz/craft.loath</a>.</p>

<p>You can also check out <a href="https://github.com/boboldehampsink/import" rel="nofollow noreferrer">https://github.com/boboldehampsink/import</a> for some detailed unit tests.</p>

CC BY-SA 3.0
2014-09-04T20:33:32.357Z
Excellent, thanks Bob, this is exactly what I was looking for!
Lindsey D
CC BY-SA 3.0
2017-09-29T11:57:00.530Z
That plugin uses: `/craft/app/vendor/phpunit/phpunit/phpunit.php`, 
`/craft/app/tests/bootstrap.php`, 
and `/craft/app/tests/phpunit.xml` which doesn't ship in the latest version of Craft 2 anyone.
Maarten de Graaf
CC BY-SA 3.0
2017-10-03T10:59:40.333Z
True. I still provide these files myself for now and I'm not sure what Craft's future philosophy on testing will be.
Bob Olde Hampsink
CC BY-SA 3.0
2014-09-03T12:46:28.600Z
2017-09-29T11:25:45.260Z
2017-09-29T11:25:45.260Z
Bob Olde Hampsink
<p>Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?</p>

<plugin-development>
Craft ships with PHPUnit... How can we use it to test our plugins?
# Craft ships with PHPUnit... How can we use it to test our plugins?

(Asked by: username_0 on 2014-09-03)

Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?

**Tags:** plugin-development

---

## 1 answers

### Answer by username_1 on 2014-09-03. Score: 6 | Accepted answer

Yes it is possible, see this example plugin by Selvin Ortiz: <https://github.com/selvinortiz/craft.loath>.

You can also check out <https://github.com/boboldehampsink/import> for some detailed unit tests.

> **Comments:**
> **username_0**: Excellent, thanks Bob, this is exactly what I was looking for!  
> **username_2**: That plugin uses: `/craft/app/vendor/phpunit/phpunit/phpunit.php`,  `/craft/app/tests/bootstrap.php`,  and `/craft/app/tests/phpunit.xml` which doesn't ship in the latest version of Craft 2 anyone.  
> **username_1**: True. I still provide these files myself for now and I'm not sure what Craft's future philosophy on testing will be.  

---

