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 163633 - PHPUnit message
Summary: PHPUnit message
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: PHPUnit (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Tomas Mysik
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2009-04-24 20:26 UTC by alexey_baranov
Modified: 2009-05-14 07:57 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
wrong encoding, not enough space (95.88 KB, image/jpeg)
2009-04-24 20:31 UTC, alexey_baranov
Details
test log (1.01 KB, text/xml)
2009-04-29 15:04 UTC, alexey_baranov
Details
wrong encoding utf-8 project (89.08 KB, image/jpeg)
2009-04-29 22:18 UTC, alexey_baranov
Details
wrong encoding utf-8 project (966 bytes, text/xml)
2009-04-30 14:17 UTC, alexey_baranov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alexey_baranov 2009-04-24 20:26:07 UTC
Hi!

I have a small remark about PHPUnit UI. If the test is not passed, the message appears in the wrong encoding. And
besides there is not enough space between the programmer's $message and system messages "Failed asserting that <.....".

I use Windows-1251 encoding in my project. Thanks.
Comment 1 alexey_baranov 2009-04-24 20:31:24 UTC
Created attachment 80883 [details]
wrong encoding, not enough space
Comment 2 Tomas Mysik 2009-04-27 09:52:46 UTC
Would it be possible to get your PHPUnit XML log please? It can be found in your TMP directory (its name is "nb-
Comment 3 Tomas Mysik 2009-04-28 13:47:39 UTC
Could you please attach your PHPUnit log? Its name is nb-phpunit-log.xml and it can be found in TMP directory.

Steps to get this file:
- right click your project > Test
- UI with test results appears
- find the file in the temporary folder and attach it to this issue

Thanks a lot.
Comment 4 alexey_baranov 2009-04-29 02:39:31 UTC
Hello.

I do not know what folder TMP? You mean the folder Windows\Temp or C:\Documents and Settings\Administrator\.nbi\tmp?

In any case, I carried out the test again. And did not find the file on the entire hard drive. And also any other files
like *phpunit*.xml

I run NetBeans 6.7M3 on Windows XP SP3
Comment 5 Tomas Mysik 2009-04-29 09:17:38 UTC
> I do not know what folder TMP? You mean the folder Windows\Temp or
> C:\Documents and Settings\Administrator\.nbi\tmp?

For Windows, it will be likely something like "C:\DOCUME~1\<username>\LOCALS~1\Temp\". In any case, the name
of the file is exactly "nb-phpunit-log.xml". I will try to reproduce myself later but your XML log would help a lot.

One more idea - would it be possible to attach your unit test (or better the whole project) to this issue? I could try
to run it and see what happens (what is the encoding you are using for your PHP files/project? UTF-8 or
Windows-1251? You can verify it in Project Properties dialog).

Thanks a lot.
Comment 6 alexey_baranov 2009-04-29 15:02:07 UTC
Hello!

	
The file was lying there, where you said. It's my mistake. Here it is.
Comment 7 alexey_baranov 2009-04-29 15:04:46 UTC
Created attachment 81212 [details]
test log
Comment 8 alexey_baranov 2009-04-29 15:10:18 UTC
I'm using Windows-1251 encoding for PHP files.
Comment 9 Tomas Mysik 2009-04-29 15:53:47 UTC
Thanks for the file and information. So, if you open the XML log in an editor you will see that the message is
"broken". So, unfortunately it's a "bug" in PHPUnit (using quotes because I think that one can hardly find out in
which encoding a pure PHP file is saved).

Please, could you try these steps and tell us whether it's OK or not?
- create a new PHP project with UTF-8 encoding
- create a PHP class
- create a unit test for this class
- run it

My guess is that the message will be OK in such case.

IMHO the problem here is that the XML log is in UTF-8 encoding but your PHP scrips are in Windows-1251
encoding... You can easily verify that yourself by running:

phpunit --log-xml C:\phpunit.log /path/to/your/test/file

in command line - is the output OK? If yes, is the XML log OK?

Unfortunately, NetBeans cannot solve this issue, NetBeans just parses the XML log produced by PHPUnit. Looking
at phpunit.de website, I'm not able to find any way how to tell PHPUnit that the message in the PHP script is not
UTF-8 but Windows-1251. As I wrote earlier, if you try to use UTF-8 for your scripts, it should work I think (BTW why
do you use Windows-1251 encoding and not UTF-8 which is recommended/preferred?).

Keeping this issue opened but very likely will be closed as WONTFIX; but I will try to investigate more. Any ideas are
welcome, of course.

Thanks for reporting.
Comment 10 alexey_baranov 2009-04-29 22:14:46 UTC
Ok. I've completed all the steps.

- create a new PHP project with UTF-8 encoding
- create a PHP class
- create a unit test for this class
- run it

And hire is the result.
Comment 11 alexey_baranov 2009-04-29 22:18:26 UTC
Created attachment 81245 [details]
wrong encoding utf-8 project
Comment 12 Tomas Mysik 2009-04-30 08:29:28 UTC
Could you please attach the XML log again? Thanks.
Comment 13 alexey_baranov 2009-04-30 14:12:44 UTC
Sure. Here's the new log.
Comment 14 alexey_baranov 2009-04-30 14:17:23 UTC
Created attachment 81316 [details]
wrong encoding utf-8 project
Comment 15 Tomas Mysik 2009-04-30 14:38:09 UTC
Looking into the XML file - now the message is correct (in the prevoius XML file it wasn't) - so I was right in my
prevoius comments.

Now I will investigate why the message is not properly displayed in the UI.
Comment 16 Tomas Mysik 2009-04-30 15:27:57 UTC
It works for me on Linux but does not on Windows...
Comment 17 alexey_baranov 2009-04-30 16:29:53 UTC
Tell me if you need my help.
Comment 18 Tomas Mysik 2009-05-13 12:27:52 UTC
I found the problem and have fix for it, will push it soon. But please notice that your PHP projects _have to_ use UTF-8 encoding (reasons explained earlier,
should not be problem because UTF-8 is highly recommended).

Thanks for reporting this issue.
Comment 19 Tomas Mysik 2009-05-13 12:54:39 UTC
Fixed, please verify if possible. Thanks.
http://hg.netbeans.org/web-main/rev/2458cb9468ab
Comment 20 Quality Engineering 2009-05-14 07:57:12 UTC
Integrated into 'main-golden', will be available in build *200905140201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2458cb9468ab
User: Tomas Mysik <tmysik@netbeans.org>
Log: #163633: PHPUnit message