| View previous topic :: View next topic |
| Author |
Message |
andrewmigliore
Joined: 10 Mar 2009 Posts: 2 Location: Portland, OR
|
Posted: Tue Mar 10, 2009 3:44 pm Post subject: PHPUnit test template and relative paths |
|
|
I am not sure where or how this is generated but the default template for a test file for a php file uses:
| Code: |
ini_set("include_path", "RELATIVE_PATH_TO_CLASS" . ini_get("include_path"));
|
When you run 100 tests at the same time this will insert 100 relative path snippets into the existing include_path. This slows down searching for files at the the end of the path, the path that existed before the mod for the test file. This way lies madness.
I would like to create my own template for phpunit in netbeans to do something a kin to:
| Code: |
$dir = str_replace("/tests", '', dirname(__FILE__));
require_once 'PHPUnit/Framework.php';
require_once $dir . '/ProductSearchServiceV2.php'
|
This assumes a path structure similar to the source and that the tests root is within the root of the source tree.
Anyway would like to customize the template and I think the relative paths approach for the existing template needs to change.
cheers |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
Posted: Tue Mar 10, 2009 4:33 pm Post subject: PHPUnit test template and relative paths |
|
|
Hi,
On úterý 10 března 2009 16:45:04 andrewmigliore wrote:
| Quote: | I am not sure where or how this is generated but the default template for a
test file for a php file uses:
Code:
ini_set("include_path", "RELATIVE_PATH_TO_CLASS" .
ini_get("include_path"));
|
Yes, this is because we need to ensure that both actions ("Test" on project
node and "Run File" on a single file) will work.
| Quote: | When you run 100 tests at the same time this will insert 100 relative path
snippets into the existing include_path. This slows down searching for
files at the the end of the path, the path that existed before the mod for
the test file. This way lies madness.
|
I don't know how PHP works internally but I would expect some optimizations
like removing duplicates from Include Path. But of course, longer Include Path
means longer time to search.
| Quote: | I would like to create my own template for phpunit in netbeans to do
something a kin to:
Code:
$dir = str_replace("/tests", '', dirname(__FILE__));
require_once 'PHPUnit/Framework.php';
require_once $dir . '/ProductSearchServiceV2.php'
This assumes a path structure similar to the source and that the tests root
is within the root of the source tree.
Anyway would like to customize the template and I think the relative paths
approach for the existing template needs to change.
|
Of course, you can create your own template and then use it (Tools > Templates
or right click a PHP file and select "Save as Template").
Feel free to file an issue [1] against PHP project and if you are able to
suggest a better solution for this situation [2] and ideally measure the
difference, please do so. Thanks in advance.
Tomas
[1] http://www.netbeans.org/community/issues
[2] the solution must be OS independent
--
Tomas Mysik
address-removed |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|