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 199778 - Refactoring doesn't work in test files
Summary: Refactoring doesn't work in test files
Status: RESOLVED DUPLICATE of bug 217991
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal with 4 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 09:42 UTC by Petr Pisl
Modified: 2012-09-20 07:50 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2011-06-30 09:42:33 UTC
Create a class in sources and generate a test for the class. When you will try to rename the class, the refactoring doesn't offer renaming the occurrences in the test files.
Comment 1 Ondrej Brejla 2011-09-26 15:38:49 UTC
Reproducible in 7.1dev.
Comment 2 Ondrej Brejla 2012-04-06 09:03:47 UTC
Because class path of tests is not searched through when refactoring in source class path is used...it has to be fixed together with PHP project I think.
Comment 3 Tomas Mysik 2012-04-06 09:24:13 UTC
Yes, the reason is: 2 separate class paths, one for sources, the other for tests. If there was just one class path, the code completion is Source Files would show also elements from Test Files.

Will have a look at it.
Comment 4 BullfrogBlues 2012-06-06 09:59:20 UTC
Reproducible in 7.1.

This is a nasty, hateful bug. Refactored lots of code assuming the test folder files were included. Depressing to have to revert changes back and lose work.

Is there any chance this can be fixed for 7.2?
Comment 5 Ondrej Brejla 2012-06-06 10:00:22 UTC
No way to fix it in 7.2. Too much work has to be done.
Comment 6 BullfrogBlues 2012-06-06 10:06:04 UTC
Pity. Is there any workaround. I can't seem to remove the test folder and just include it as source?
Comment 7 BullfrogBlues 2012-06-06 10:07:06 UTC
don't mind that comment sorry. I got it.
Comment 8 Ondrej Brejla 2012-08-01 08:03:50 UTC
Please, don't increase priorities which can't be increased. This is common issue of P3...P1 issues are for IDE crash and such. Thanks in advance.
Comment 9 BullfrogBlues 2012-08-12 13:43:56 UTC
Sorry. This is an awful bug. 

One of the reasons I choose netbeans over eclipse is the unit testing features. (there are some other things I prefer too, netbeans is much lighter than eclipse) Probably my fav. feature though, is a seemingly trivial one: <Ctrl+Shift+T> for quickly switching back and forth between test and class-under-test. You can also run individual tests <Ctrl+F6> **Without** having to navigate to the test file. Fantastic!

Because of this bug all that goes to shit. It breaks refactoring! So you have a choice: a) select a dummy test folder for tests, in which case refactoring will work, but all the unit test features go out the window or b) keep the unit test features, in which case refactoring will not be applied to your test sources.

There is another issue though, which, due to recent requirements, regardless of this bug being fixed, renders the unit test features rather useless to me (at least for the while): [Support for Multiple Test Sources](http://netbeans.org/bugzilla/show_bug.cgi?id=206258).

|
+---mod1
|    |-src
|    +-tests
|
+---mod2
|    |-src
|    +-tests
| 
+---mod..
| 
+---tests
     |-phpunit.xmx
     +-bootstrap.php

Alas, I tell you this because I'm thining of giving eclipse a try again. I miss the mylyn features eclipse, but netbeans being lightweight and the unit testing features have swayed me to the dark side of netbeans. Maybe I will still hate eclipse.
Comment 10 Ondrej Brejla 2012-09-20 07:50:42 UTC

*** This bug has been marked as a duplicate of bug 217991 ***