[Solved] How to handle Include/Path in an application
Posted: Tue Aug 16, 2005 10:05 pm
Hi,
I came across a problem with includes and I was hoping to hear what other people did.
I saw this structure from nielsene.
I can see that All.php in acceptance-tests and unit-tests folders probably run all the tests in their own respective folders.
The All.php under the root tests directory, I assume, will run both unit-tests and accpetance tests. I wrote this page for my own project, as below:
The All.php under the root tests directory did not work. It keeps giving me include errors.
I believe I heard there was include & path related "issues" with php. Well, not really issues, but runs differently than Java (which makes sense to me). The following sitepoint thread talks a little bit about what I'm trying to figure out.
http://www.sitepoint.com/forums/showthr ... clude+path
Anyways... My questions are:
1. How do you guys handle the path "issue"? use DEFINE? Are absolute paths always used? or can we achieve this with relative paths?
2. What do you put in a test_setup.inc file? are there constants in there that define paths?
I hope I am clear and someone understands... but I am not too sure how to explain this exactly.
Any help is appreciated. Thanks!
Edit: Maybe code samples will help, as well as any thoughts you might have.
I came across a problem with includes and I was hoping to hear what other people did.
I saw this structure from nielsene.
Code: Select all
tests/All.php
tests/acceptance-tests/All.php
/<moduleName>/All.php
/<long multi-page process test>
tests/unit-tests/All.php
/classes/All.php
/<class hierarchy>/All.php
/<assorted tests cases>
/web/All.php
/<moduleName/All.php
/<ModuleFunctionality>/All.php
/<little test cases>
tests/include/test_setup.inc
/<Custom Subclasses of Unit/Web TestCases>
/sql/<preload scripts>
tests/var (holding space for temp files, etc)The All.php under the root tests directory, I assume, will run both unit-tests and accpetance tests. I wrote this page for my own project, as below:
Code: Select all
...
$this->addTestFile('unit-tests/All.php');
$this->addTestFile('acceptance-test/All.php');
...I believe I heard there was include & path related "issues" with php. Well, not really issues, but runs differently than Java (which makes sense to me). The following sitepoint thread talks a little bit about what I'm trying to figure out.
http://www.sitepoint.com/forums/showthr ... clude+path
Anyways... My questions are:
1. How do you guys handle the path "issue"? use DEFINE? Are absolute paths always used? or can we achieve this with relative paths?
2. What do you put in a test_setup.inc file? are there constants in there that define paths?
I hope I am clear and someone understands... but I am not too sure how to explain this exactly.
Any help is appreciated. Thanks!
Edit: Maybe code samples will help, as well as any thoughts you might have.