Tagged Questions
2
votes
5answers
1k views
Code Coverage with PHPUnit
I am running into an issue while attempting to determine code coverage on our site. I have PHPUnit generating a html code coverage report while running our unit tests on our three apps. We have a ...
1
vote
3answers
31 views
PHP Maximum Coverage
I have a bunch of PHP files that I would like to analyze. What I would like to do is the following:
Input: php file
Output: the input parameter values like $_GET['a']=='test1' and ...
1
vote
1answer
144 views
PHPUnit code coverage doesn't include certain lines
I'm having a strange issue with PHPUnit. I'm working on a project with a team of developers, all of which must use PHPUnit 3.6.5. For the most part, my PHPUnit works great and yields the same results ...
5
votes
2answers
53 views
How to test statements which depends on specific PHP version with PHPUnit?
I have a construct like this:
class Foo
{
public function doFoo($value = '')
{
if (function_exists('foo'))
{
return foo($value);
}
// if php ...
3
votes
0answers
61 views
phpunit merge two or more clover.xml reports
I have several clover.xml reports of different extensions of a projects. I want to combine them into one clover.xml and then create it into a clover html. But i see no way with the phpunit classes ...
1
vote
2answers
94 views
PHP_CodeCoverage_Filter::getInstance() Error running phpunit
I have installed phpunit in my ubuntu 11.10 having php version 5.2.14.
But when I run my test module it is throwing error,
PHP Fatal error: Call to undefined method ...
2
votes
1answer
354 views
PHPUnit - PHP_Token_Stream error on clover-coverage
I am using PHPUnit 3.5.10, and having a problem trying to generate xml reports for clover-coverage.
Exporting with coverage-html works fine. Also, if I exclude enough files from the coverage report ...
1
vote
2answers
54 views
PHPUnit Code Coverage of abstract class implementing an interface
I'm currently working on Bitcoin Payment Bundle for Symfony2. You can view it on my github. It is not (yet, I hope) fully test-driven developed but I try to make it as test-covered as possible.
...
5
votes
1answer
40 views
Exclude base directory from PHPUnit Code Coverage
How do I exclude the base directories from PHPUnit's Code Coverage?
This is my phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="include.php"
...
7
votes
1answer
310 views
Code Coverage with PHPUnitSeleniumTestcase
I have written Selenium Test case for PHP. I would like to get the code coverage for while I execute these test cases. My testcase:
<?php
class Example extends PHPUnit_Extensions_SeleniumTestCase
...
4
votes
5answers
1k views
PHPunit Code Coverage error
PHPunit is working, but I get this code coverage error and don't get the code coverage report.
Does anyone know how to fix this?
Thanks,
Demian.
demian@dimbo-TP:/var/www/z2d2/tests$ phpunit
...
0
votes
1answer
39 views
CodeCoverage with PHPunit not generating
PHPunit 3.7.1
PHP 5.3.14
Windows 7
Using cmd I "cd" into the dir where phpunit.xml lives and run
phpunit -c phpunit.xml
but that dosen't generate any code coverage.
phpunit.xml:
<phpunit
...
5
votes
3answers
476 views
Using PHPUnit code coverage with interfaces
I'm using PHPUnit (3.6.7) to test and provide code coverage reports on my application, everything is set-up and working as expected.
I have complete coverage for all of the code except for my ...
1
vote
1answer
141 views
PHPUnit - Trying to @cover not existing method
My test case looks like this:
class FooTest extends PHPUnit_Framework_TestCase {
/** @covers MyClass::bar */
function testBar()
{
$result = MyClass::bar();
...
4
votes
2answers
351 views
PHPSpec and coverage report
does anyone knows the method to generate coverage reports from PHPSpec tests? I thought about xdebug, but as far as I know, it cant generate reports for jenkins...
6
votes
1answer
142 views
What does Xdebug in PHP return?
This code with PHP/Xdebug (using Xdebug 2.2.1 and PHP 5.4 on Windows 7 x64, also I have added a line counter for readability):
1: xdebug_start_code_coverage();
2:
3: for ($ii = 0; $ii < 3; ++$ii)
...
3
votes
2answers
64 views
How to cover Exception Classes in PHPUnit
Im aiming for very high code coverage and want to either cover exception classes or have them excluded from the codecoverage reports.
Example code
class My_DataException extends Exception
{}
class ...
2
votes
2answers
697 views
PHPUnit code coverage not working with configuration
I have my PHPUnit setup and coverage report working fine without a white list filter. Once I add one however, the report seems to only partially generate as if PHPUnit quit unexpectedly. I do not get ...
2
votes
1answer
124 views
Is it possible to run HTML test suite from PHPUnit?
I want to measure code coverage of an HTML test suite for selenium. Therefore I want to use PHPUnit in order to execute the suite, because PHPUnit has nice support for code coverage analysis.
...
13
votes
5answers
215 views
Log line numbers of executed java code
I am writing part of a PHP web application (which will be used in a high school bug finding contest) where the user must find bugs in a given Java program. As a part of this, when the Java program ...
1
vote
2answers
208 views
PHPUnit code coverage for class that extends abstract class
I have an abstract class Exception in custom namespace which has no abstract methods. All methods are shown as covered by its tests (mocked in a standard way). The reason to make it abstract is ...
1
vote
1answer
154 views
0% code coverage with PHPUnit
I'm running module tests with PHPUnit and want to get coverage reports on the tests. I've successfully been doing this in the past, but somehow i cannot get it working again and I have no idea why ...
2
votes
2answers
150 views
PHPUnit code coverage all test files plus another directory
We are struggling to get desired results from the coverage report using phpunit.
Previously, we were only capturing code coverage for files that had unit tests associated with them (I believe this is ...
0
votes
0answers
43 views
PHP_CodeCoverage dropping a file when testing
PHPUnit 5.3.10, PHP_CodeCoverage 1.1.2
We use different extensions than just the typical .php for different functions to protect against the web server being able to run some code that is not ...
1
vote
1answer
246 views
Resolved - How can PHPUnit code coverage ignore my autoloader?
I have a bootstrap in my phpunit config that runs the Zend\Loader\StandardAutoloader.php. I can get PHPUnit code coverage to ignore it when I add
<filter>
<blacklist>
...
3
votes
1answer
116 views
PHPUnit code coverage reports SOME files as they have no code in it (and so report a 0/0 Line 100% coverage)
I've been searching a solution for a while but couldn't find any.
I do some code-coverage on my PHP application and it works fine except for a couple of files that PHPUnit seems to consider as empty ...
0
votes
1answer
148 views
PHP SimpleTest / xdebug code coverage test - ignore some lines
I have a problem with SimpleTest / xdebug test classes - specifically, I have registered a shutdown function to close my test coverage and save the results.
However, this still (correctly) shows up ...
0
votes
1answer
57 views
PHPUnit codecoverage halts without reporting any error
When executing PHPUnit with codecoverage, the coverage generating just halts without any error, and no report is generated.
The problem is caused by a fatal error in one file, but it's hard to find ...
1
vote
0answers
105 views
Code Coverage under PHPUnit for admin areas
I'm trying to get PHPUnit and CodeCoverage over a few hundred PHP code repositories. A consistent problem I receive is that CodeCoverage doesn't work over any of my Admin pages that have session_start ...
3
votes
1answer
301 views
Code coverage report incorrectly indicating 100% coverage of a controller
I'm running a series of PHPunit tests and have a controller that is reporting 100% coverage.
In the coverage report however, only 5 of its 84 lines of code are marked "green"
I'm wondering what ...
2
votes
1answer
366 views
Clover PHPUnit coverage report is including coverage for unwanted file
I have just set up CloverPHP into my Jenkins job.
I am using PHPUnit to generate the clover report and it seems to all be working apart from the coverage report which is showing the file
...
3
votes
1answer
627 views
PHPUnit Code Coverage
I am learning the ropes with Unit testing Zend Framework applications. So far I have set up PHPUnit to work with Zend Framework and have started writing some simple Test Cases.
My issue is that I am ...
4
votes
1answer
151 views
Aggregating code coverage from several executions of phpunit
I have been working with PHPUnit for a little while now, and it's starting to look like I may need to break my tests up into groups that would run as separate executions of phpunit. The main reason ...
1
vote
2answers
1k views
Clover coverage with Phing
Is there a way to get Phing to output it's coverage report in clover format?
I know phpunit has --coverage-clover but I don't know how to enable this option from Phing.
I do not want to manually use ...
1
vote
2answers
909 views
How to configure Jenkins for php coverage report?
I am struggling to set up the code coverage.
What must i do, how do i set this up so i can get a coverage map/report please?
I have a unit test that runs. What checkboxes must i check under: ...
3
votes
3answers
209 views
code coverage of xDebug and PHPUnit says 100%, in fact it is not
I have the following function:
function foo($p)
{
if ($p == null)
throw new Exception('bla');
if ($p == null)
{
throw new Exception('bla');
}
[...]
}
My Test for ...
2
votes
1answer
106 views
How to Achieve Code Coverage for If/Else in PHPUnit?
Disclaimer: I'm new to unit testing and just getting my feet wet. That being said, I understand 100% is not always possible, but I'm curious if there is a solution to code coverage with if/else ...
3
votes
2answers
991 views
How to add uncovered files to PHPUnit code coverage report of the Yii application
I am currently trying to get the code coverage report for a PHP application based on Yii framework.
Code coverage gets generated by PHPUnit 3.6, and I am using whitelist approach to source files ...
12
votes
3answers
1k views
Reaching 100% Code Coverage with PHPUnit
I've been in the process of creating a test suite for a project, and while I realize getting 100% coverage isn't the metric one should strive to, there is a strange bit in the code coverage report to ...
3
votes
2answers
997 views
Add files to code-coverage white/blacklists in `bootstrap.php` for PHPUnit
PHP_CodeCoverage 1.1 removed the singleton accessor for PHP_CodeCoverage_Filter that allowed our PHPUnit bootstrap.php files to add directories to the white/blacklists. PHPUnit 3.5 used the blacklist ...
1
vote
1answer
442 views
“Cannot redeclare class” error when running PHPUnit with Code Coverage
PHPUnit seems to execute properly (appropriate tests are executed & pass), but during code coverage an error is thrown. We are using PHPUnit 3.5 with ZF 1.11. Any insight would be greatly ...
1
vote
1answer
236 views
Why does PHPUnit show some close-curly-braces as not being covered?
I'm using PHPUnit 3.6.7, PHP_CodeCoverage 1.1.1, and Xdebug 2.1.2. When I have PHPUnit write my code coverage statistics to a clover-style XML file, it occasionally shows a close-curly-brace as not ...
1
vote
2answers
778 views
Syntax for filtering out code coverage (absolute) paths in PHPUnit
I'm just unit testing a single file and although it's the only one to get unit tested (good), code coverage is done on more than just this single file (bad). It covers some files in my PEAR directory ...
4
votes
2answers
284 views
Automatic job (phpunit with code coverage) when jenkins is idle?
My jenkins install is working properly just that the phpunit+coverage on my code takes 5 minutes finish - because of too many files.
For me, it's too much wait for just knowing if my last commit ...
0
votes
1answer
303 views
Running phpunit with no arguments after installing Xdebug via PECL generates warnings about permissions
I am running Zend Framework 1.10 on Ubuntu 10.04, just installed Xdebug to generate code coverage, via PECL.
If I run phpunit like so:
$ phpunit --coverage-html ~/coverage
It works just fine. ...
3
votes
1answer
328 views
PHPUnit coverage now incomplete as class' opening brace is not covered
Hey everyone, I've been using PHPUnit to to do unit testing on a Symfony/Doctrine project I'm working on. It was working fine until yesterday when various classes dropped from 100% coverage to 98-99%. ...
3
votes
3answers
53 views
Record which files are part of an execution? (included, required, classloaded)
[This is a code coverage question, only that I hope to use it in production with the aim of pinpointing code that can be deleted.]
Is it possible to somehow record which files are part of an ...
5
votes
2answers
528 views
Remote code coverage collecting in PHP
In our project, we are running PHPUnit tests that uses Selenium and Curl to open pages on a different development server. Server B has an Apache server running the serves the web site. Server A starts ...
3
votes
1answer
126 views
PHP Code coverage strategy for huge codebase
We have been trying to implement a simple code coverage analysis with our build process where automation tests run, since 2009 without any success. The only problem? PHP eats up all system memory, no ...
6
votes
2answers
3k views
Cannot redeclare class error when generating PHPUnit code coverage report
Starting a project with Zend Framework 1.10 and Doctrine 2 (Beta1). I am using namespaces in my own library code.
When generating code coverage reports I get a Fatal Error about Redeclaring a class. ...