Re: [PHPUnit]: Directory structure for unit tests
| From: | Stefano F. Rausch | Date: | Mon, 29 May 2006 18:37:44 +0000 |
| Subject: | Re: [PHPUnit]: Directory structure for unit tests | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24191@lists.php.net to get a copy of this message | ||
Hi Andreas,
It's a matter of taste.
However, if you are using PHPUnit2, see the structure that's defined there, which, BTW, I would suggest very strongly to follow. I.e.:
<project root>
|
+ ClassA.php
+ ClassB.php
|
+ <subpackage>
| |
| + ClassC.php
| + ClassD.php
|
+ <Tests>
|
+ AllTests.php (includes: <subpackage>/AllTests.php)
+ ClassATest.php
+ ClassBTest.php
|
+ <subpackage>
|
+ AllTests.php
+ ClassCTest.php
+ ClassDTest.php
With this structure, you can independently tests every single class, every "subpackage" or all classes together. Furthermore you can deploy the production code without the tests - if you really don't want to do it ;)
HTH
-- Stefano
Andreas Hofmann wrote:
Hi all,
I am new to PHP and I wonder how unit tests (PHPUnit2) should be
structured in directories within a PHP project?
Is it:
a)
<project root>
|
|- a.php
|- b.php
|-<test>
| aTest.php
| bTest.php
|-<package>
|
| c.php
|-<test>
|-cTest.php
b)
<project root>
|
|- a.php
|- b.php
|- aTest.php
|- bTest.php
|-<package>
|
| c.php
|-cTest.php
c)
<project root>
|
|- a.php
|- b.php
|-<package>
| |
| | c.php
|-<test>
|- aTest.php
|- bTest.php
|- cTest.php
Or is it something completly different, or doesn't it matter?
Thanks in advance
Andreas
--