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 205135 - "Create PHPUnit test" deletes files
Summary: "Create PHPUnit test" deletes files
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: PHPUnit (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 10:30 UTC by marcusson
Modified: 2011-11-21 12:14 UTC (History)
1 user (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 marcusson 2011-11-15 10:30:13 UTC
I'm using Dev-Build 201111090600.

Create a class "Foo" in "Foo.php".
Create a class "FooTest" in "FooTest.php" in same directory.
Right click "Foo.php" and select "Tools > Create PHPUnit tests"

Expected:
- test-case get's created in test-directory

Actually:
- test-case get's created in same directory
- "FooTest.php" is overwritten and then deleted without warning
- the file and all user changes are lost

Suggested solution:
- OPTION 1) generate test in test directory instead of current directory
- OPTION 2) if file *Test.php exists then ask user if he wishes to use the existing file and if not: warn the user before replacing the file
Comment 1 Tomas Mysik 2011-11-15 10:37:36 UTC
Thanks for catching that.

(In reply to comment #0)
> Suggested solution:
> - OPTION 1) generate test in test directory instead of current directory

Would be the best but unfortunately, not possbile since NetBeans just runs PHPUnit via command line and PHPUnit itself generates the file.

> - OPTION 2) if file *Test.php exists then ask user if he wishes to use the
> existing file and if not: warn the user before replacing the file

Something like this needs to be done.
Comment 2 Tomas Mysik 2011-11-15 13:20:29 UTC
Fixed. Lado, could you please verify? Thanks a lot.

http://hg.netbeans.org/web-main/rev/396b4d6e8fb5
Comment 3 Quality Engineering 2011-11-16 15:48:15 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/396b4d6e8fb5
User: Tomas Mysik <tmysik@netbeans.org>
Log: #205135 - "Create PHPUnit test" deletes files
Comment 4 Vladimir Riha 2011-11-21 12:14:48 UTC
Verified. User is asked if he want to use existing file, if so the file is moved to selected directory.

Product Version: NetBeans IDE Dev (Build 201111200600)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02