| Stefano F. Rausch 2006-05-29, 7:02 pm |
| 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
>
> --
>
|