This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 199072 - NetBeans ignores PHPUNIT.XML and runs tests from all folders
Summary: NetBeans ignores PHPUNIT.XML and runs tests from all folders
Status: RESOLVED WONTFIX
Alias: None
Product: php
Classification: Unclassified
Component: PHPUnit (show other bugs)
Version: 7.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-01 06:12 UTC by RuslTG
Modified: 2011-09-21 15:33 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshots in archive (160.97 KB, application/octet-stream)
2011-06-01 06:12 UTC, RuslTG
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RuslTG 2011-06-01 06:12:01 UTC
Created attachment 108642 [details]
Screenshots in archive

Hello, developers.

I am using Zend Framework for my projects and found out this oddness:

In my project I want to test "/library" folder. Unit tests placed separately in "/test_library" folder (image 0).

When I using PHPUnit from command line all going ok (55 tests, image 1).

When I using NetBeans it ignores my "phpunit.xml" and runs tests in both "/test_library" and "/test_application" folders (56 tests, image 6).

I don't know why this happening.
Comment 1 Petr Pisl 2011-06-01 13:33:01 UTC
Hi, we are now working on the test groups. See more here http://wiki.netbeans.org/PHPUnitTestGroups. 

It will solved the problem. Now you can define your test suite through use custome test suite field.
Comment 2 dukeofgaming 2011-07-12 17:44:57 UTC
I'm not sure Test Groups solve the problem as this looks like an additional feature. The expected behavior (or at least what I expect) would be that, given the XML configuration, the Test folders would load dynamically and not ask for a specific one.

In other words:

- The test action (alt + F6) would run the command "phpunit -c path/to/config.xml"
- If the config.xml is configured, don't ask for a single test folder
- Load test folders & files according to the rules and patterns described in the config.xml

I'm currently using Symfony 2, where there is a test folder for each bundle (like a plugin/module in Symfony 1. There is a default php unit configuration file in Symfony 2, yo can see it here: https://github.com/symfony/symfony-standard/blob/master/app/phpunit.xml.dist

Regards,

David
Comment 3 Tomas Mysik 2011-09-21 15:07:30 UTC
Well, hard to say what to do now.

NetBeans uses its own TestSuite [1] which runs the "right" tests (reasons for having own suite can be found in issue #167519). It means that all tests are added if one invokes Test action on project node and also runs just a single file if one runs just one test file. This is the expected behavior, I would say, for most of the users. If a project has PHPUnit XML configuration set, it is definitely not ignored, it is passed to the PHPUnit script. Apparently, the tests in the test suite has precedence over tests in the XML configuration.

Not sure how/whether this problem can be fixed. Any ideas?

Possible work arounds:
- provide your own test suite (in Project Properties, category PHPUnit)
- use PHPUnit test groups
- any other ideas?

Thanks for reporting and any ideas.
[1] <nb-install-dir>/php/phpunit/NetBeansSuite.php
Comment 4 RuslTG 2011-09-21 15:28:23 UTC
Thank you for your answers.
I am glad to now that somebody thought about this trouble.

But I solved this oddness by totally separating /library from /application
So Library and Application are two different projects with the different unit tests.

/library/tests
/application/tests
Comment 5 Tomas Mysik 2011-09-21 15:33:03 UTC
(In reply to comment #4)
> Thank you for your answers.
> I am glad to now that somebody thought about this trouble.

Nothing to thank for.

> But I solved this oddness

Great to hear!

Closing as WONTFIX (it is more appropriate) but feel free to reopen and provide your ideas how this issue could be solved. Keeping the current behavior makes more sense to me.

Thanks.