Tagged Questions
1
vote
1answer
20 views
Force Exclude files from PHPUnit Code Coverage
Is it possible to forcefully exclude a folder from PHPUnit's code coverage?
Problem I've got is, that I have a Symfony 1.4 project, which has folders at ./lib/vendor/symfony/*. I want to exclude ...
0
votes
3answers
28 views
Cannot redeclare class error with CodeCoverage and Composer
I'm getting an error with PHPUnit Code_Coverage when using Composer's autoload.php as the bootstrap file. I've created my own boostrap.php file and simply include each file individually and everything ...
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 ...
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 ...
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"
...
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.
...
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
...
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 ...
0
votes
1answer
112 views
why phpUnit test code coverage not working in Symfony2 when including file?
PHP Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in /home/manivasagam/projects/ProofCentral/src/ProofCentral/ServiceBundle/Tests/Services/AttachmentServiceTest.php ...
1
vote
1answer
29 views
Generate new code coverage for a single file without clearing all other coverage reports in PHPUnit
First the question:
In PHPUnit 3.5, is there a way to generate a coverage report for a single test without the report for the entire test suite being overwritten. I.e. only update the coverage report ...
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();
...
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.
...
0
votes
1answer
175 views
PHPUnit, Code Coverage, xdebug and html reports
Well, I have a problem trying to setup code coverage reports. First thing I had to do was to install xdebug, I did it, and it worked...Well, actually, instead of showing me the coverage of my test ...
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 ...
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 ...
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 ...
0
votes
0answers
160 views
Configuring Clover in Jenkins for PHPUnit Selenium tests
I am attempting to get PHPUnit to collect code coverage information from Selenium tests as per the docs.
I've copied phpunit_coverage.php to the relevant location, added the append and prepend files ...
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 ...
1
vote
0answers
30 views
How do I map code coverage reports to a diff file?
I have code coverage running from PhpUnit, and I can generate a diff file in Git that will show me what's about to be released.
How would I go about mapping one to the other, so that I can say the ...
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>
...
2
votes
2answers
188 views
Does PHPUnit_Selenium Code Coverage Work?
In the PHPUnit docs, it says that it's possible to get code coverage data:
PHPUnit_Extensions_SeleniumTestCase can collect code coverage information for tests run through Selenium:
Copy ...
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
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 ...
0
votes
0answers
203 views
PHPUnit - Code Coverage ignoreing whitelisted files
I've been having problems with code coverage.
PHPUnit 3.5.14:
Runing the tests ends OK.
Code coverage suddenly halt. Viewing the error log an error: can't redeclare SomeClassOfMine...
Proposed ...
0
votes
2answers
323 views
IntelliJ Ultimate/PhpStorm, showing code coverage results for Symfony2 project
I'm using IntelliJ Ultimate 11.1 which includes the goodies that comes with the latest PhpStorm.
I'm trying to get some things working with the new Code Coverage feature, but having a bit of trouble ...
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 ...
8
votes
1answer
513 views
How to adjust Jenkins weather report for clover coverage on PHP projects
I have a few PHP projects installed for a new team in Jenkins, and I'm trying to lower the expectations initially to help ramp them up on testing and everything. Initially we're shooting for 20% code ...
1
vote
0answers
117 views
PHPUnit & Selenium code coverage - coverage metrics stop halfway through test
I'm just getting started with PHPUnit and Selenium, yet one problem has been bothering me: I can't seem to get correct coverage figures.
My app takes a user through a multi-step process that ...
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
133 views
Unit Testing basic Controllers
I have a number of simple controller classes that use Doctrine's entity manager to retrieve data and pass it to a view.
public function indexAction() {
$pages = ...
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
1answer
845 views
PHPUnit - exclude some directories from code coverage in command line
I am working on project that based on Yii framework, and we have many tests that we added programatically to test suite, so we are not using phpunit.xml file to configure tests.
The question is, how ...
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
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 ...
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 ...
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 ...
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
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 ...
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 ...
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
103 views
PHPUnit code coverage shows code coverage of Unit tests?
I'm using Michael Romer's fantastic ZF-Boilerplate and have hit a snag when testing.
When I view the code coverage reports, it only shows the code coverage for the actual unit tests, not for the code ...
1
vote
0answers
129 views
Code Coverage issue when upgrading PHING and PHPUnit [closed]
I now have PHPUnit 3.6 and PHing 2.4.8 for unit testing my CodeIgniter 1.7 application..
After upgrading PHING and PHPUnit(from 3.4), the execution of my test using build.xml (using phing command), ...
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 ...
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
...
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
3answers
162 views
Code coverage for lines following methods that always throw exceptions
I understand that 100% code coverage is just a goal to shoot for, but it's annoying to have a line containing a closing brace counted as not covered because it follows a method call whose sole purpose ...
0
votes
1answer
155 views
PHPunit, Getting function code coverage for a ZF controller action
I'm using PHPunit to test our Zend Framework project and it works allright but i'm not getting coverage om my action methods in my controllers.
Although I get coverage in number off lines of code but ...