Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJordan Riser
5,819 PointsWhere do I put files
I don't understand where these files he's opening up are located and how they talk to each other. I have a phpunit.xml file in the root and a tests folder with the test but when I run 'vendor/bin/phpunit' no tests get run. Am I supposed to put the phpunit.xml file in the vendor/bin?
2 Answers
Gerrit Verhaar
17,742 PointsIn the video on 01-pig-latin.php both source and test files were stored in the root directory. Run the test with:
vendor/bin/phpunit 01-pig-latin.php
You could move the test file to a tests directory and run it with:
vendor/bin/phpunit tests/01-pig-latin.php
If you want to run a full directory you need to keep in mind that PHP Unit will look for *Test.php files. I had to rename my tests/01-pig-latin.php file to tests/01-pig-latin-Test.php in order to run it with:
vendor/bin/phpunit
Gareth Nicoll
2,169 PointsThe following structure works for me but in example he shows he just has both files in the root I think. I have it structured
- root
|-- composer.json
|-- composer.lock
|-- vendor
|-- PigLatin.php
|-- phpunit.xml
|-- tests
| |-- PigLatinTest.php
My phpunit.xml looks like
<phpunit backupGlobals="true" bootstrap="tests/bootstrap.php">
<filter>
<blacklist>
<directory>vendor</directory>
</blacklist>
</filter>
<testsuite>
<directory>tests</directory>
</testsuite>
</phpunit>