I would like to get started writing some unit tests for the
application I'm working on, but I'm having a little bit of trouble
figuring out just what goes where and why. The default tests
directory structure as defined by Zend_Tool is as follows:
tests
|--phpunit.xml
|--application
| |-bootstrap.php
|--library
| |-bootstrap.php
(Pardon the ASCII art.)
Now, I can certainly see the benefit of separating tests out in this
manner, but I'm a bit confused about what goes into each of the
provided files (as provided by Zend_Tool, they are empty…at least as
of a few days ago). I know that phpunit.xml should conform to the
usual syntax (http://www.phpunit.de/manual/current/en/appendixes.configuration.html),
and that its root element can include a bootstrap path as follows:
<phpunit bootstrap="application/bootstrap.php">
...
</phpunit>
But that only addresses one of the bootstrap files in the default
structure. Presumably if I ran my tests from within the "tests"
directory, I'd want to run both my "applications" tests and my
"library" tests, right? If that's the case, why not have a
bootstrap.php in the root "tests" directory that covers both suites?
Or maybe there should be a separate phpunit.xml file in each of the
subdirectories of "tests", pointing at a different bootstrap file?
I can certainly get it working via either of those solutions, but I
wanted to see if anyone could provide more details on why the default
structure is what it is…I've read through the proposal
(http://framework.zend.com/wiki/display/ZFPROP/Zend+Framework+Default+Project+Structure+-+Wil+Sinclair)
and there are some hints at the very end…but I'm still not sure I know
what I'm doing :)
Can anybody help clarify this for me?
Thanks!
Adam
没有评论:
发表评论