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 190725 - AssertionError at org.netbeans.modules.php.project.ui.codecoverage.CoverageVO.setPhpUnitVersion
Summary: AssertionError at org.netbeans.modules.php.project.ui.codecoverage.CoverageVO...
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: PHPUnit (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P3 normal with 3 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-02 19:06 UTC by Jeffrey Rubinoff
Modified: 2011-07-28 11:40 UTC (History)
26 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 172877


Attachments
stacktrace (2.72 KB, text/plain)
2010-10-02 19:06 UTC, Jeffrey Rubinoff
Details
Patch (564 bytes, patch)
2011-03-08 16:40 UTC, OndrejBrejla
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Rubinoff 2010-10-02 19:06:20 UTC
This issue was reported manually by jeff_rubinoff.
It already has 4 duplicates 


Build: NetBeans IDE Dev (Build 201009230000)
VM: Java HotSpot(TM) Client VM, 16.3-b01, Java(TM) SE Runtime Environment, 1.6.0_20-b02
OS: Windows Vista

User Comments:
GUEST: When i try to use code coverage with PHPUnit.

jeff_rubinoff: running code coverage

jeff_rubinoff: Trying to test code coverage




Stacktrace: 
java.lang.AssertionError
   at org.netbeans.modules.php.project.ui.codecoverage.CoverageVO.setPhpUnitVersion(CoverageVO.java:72)
   at org.netbeans.modules.php.project.ui.codecoverage.PhpUnitCoverageLogParser.processCoverage(PhpUnitCoverageLogParser.java:129)
   at org.netbeans.modules.php.project.ui.codecoverage.PhpUnitCoverageLogParser.startElement(PhpUnitCoverageLogParser.java:104)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
   at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
Comment 1 Jeffrey Rubinoff 2010-10-02 19:06:24 UTC
Created attachment 102235 [details]
stacktrace
Comment 2 Filip Zamboj 2010-10-03 00:50:06 UTC
I'll have a look
Comment 3 Covex 2010-11-02 15:34:06 UTC
Exception occurs only when "Code coverage / Collect and Display Code Coverage" is checked
Comment 4 taleti 2010-11-16 18:58:04 UTC
I am getting the same error when the code coverage is checked only.
Comment 5 jacobsantos 2010-11-23 13:36:21 UTC
I was able to track this down to what might be the cause. The cause is that the new PHP_CodeCoverage does not include the phpunit version. A quick fix might be to remove line http://hg.netbeans.org/main/file/aef6d3cc0966/php.project/src/org/netbeans/modules/php/project/ui/codecoverage/PhpUnitCoverageLogParser.java#l129 or commenting it out at the very least.

The real fix would be to use the phpunit class to pull the PHPunit version, since that class should already have the PHPunit version without requiring PHP_CodeCoverage to set it.


-------

I'm going to try a work around later today by having PHP_CodeCoverage set the phpunit version manually to the version I'm using. I'll comment back when I do the test.
Comment 6 jacobsantos 2010-11-23 15:16:36 UTC
Okay, it has been verified that editing PHP_CodeCoverage to add the phpunit attribute works around Netbeans.

Step 1: Find PHP_CodeCoverage path. Depends on whether PEAR was used or if manually installed PEAR. If used PEAR, then it is usually in the PHP directory. PEAR/PHP/CodeCoverage.

Step 2: Open Report/Clover.php

Step 3: Find line 74 and add {{{$root->setAttribute('phpunit', '3.5.4');}}}

Step 4: Save and then run tests again to get code coverage.
Comment 7 cliffordwhansen 2010-11-23 17:26:43 UTC
(In reply to comment #6)
> Okay, it has been verified that editing PHP_CodeCoverage to add the phpunit
> attribute works around Netbeans.
> 
> Step 1: Find PHP_CodeCoverage path. Depends on whether PEAR was used or if
> manually installed PEAR. If used PEAR, then it is usually in the PHP directory.
> PEAR/PHP/CodeCoverage.
> 
> Step 2: Open Report/Clover.php
> 
> Step 3: Find line 74 and add {{{$root->setAttribute('phpunit', '3.5.4');}}}
> 
> Step 4: Save and then run tests again to get code coverage.

I can confirm this works with PHPunit 3.5.5 :)

thanx for the workaround
Comment 8 viktor2832 2010-12-04 00:54:26 UTC
> Step 3: Find line 74 and add {{{$root->setAttribute('phpunit', '3.5.4');}}}
Can you please show where exactly it has to be placed&
Comment 9 jacobsantos 2011-01-31 15:51:31 UTC
(In reply to comment #8)
> > Step 3: Find line 74 and add {{{$root->setAttribute('phpunit', '3.5.4');}}}
> Can you please show where exactly it has to be placed&

Sorry for the extended delay. I'm unsure exactly how to be contacted when there is a comment. I will instead submit a patch, or actually a diff to show where it is.
Comment 10 jacobsantos 2011-01-31 20:19:06 UTC
(In reply to comment #8)
> > Step 3: Find line 74 and add {{{$root->setAttribute('phpunit', '3.5.4');}}}
> Can you please show where exactly it has to be placed&

Sorry, I misunderstood that you meant PHP_CodeCoverage.

The line is really not what is important. What is important is that you add that line to the coverage attribute.

From /PHP/CodeCoverage/Report/Clover.php:
>        $root = $document->createElement('coverage');
>        $root->setAttribute('generated', (int)$_SERVER['REQUEST_TIME']);
>        $document->appendChild($root);

Then add the 

>     $root->setAttribute('phpunit', '3.5.5'); // This can be any number.

After the:

>   $root = $document->createElement('coverage');
>   $root->setAttribute('generated', (int)$_SERVER['REQUEST_TIME']);
Comment 11 OndrejBrejla 2011-03-08 16:40:39 UTC
Created attachment 106827 [details]
Patch
Comment 12 Petr Pisl 2011-03-08 17:00:25 UTC
I have applied Ondra's patch.
Comment 13 Quality Engineering 2011-03-09 05:33:06 UTC
Integrated into 'main-golden', will be available in build *201103090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/93a615991d6b
User: Petr Pisl <ppisl@netbeans.org>
Log: #190725 - AssertionError at org.netbeans.modules.php.project.ui.codecoverage.CoverageVO.setPhpUnitVersion