1

My phpunit xml:

<phpunit bootstrap="bootstrap.php">
    <testsuites>
        <testsuite name="Phase Unit Tests">
            <directory>./Phase</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">Api/app/library</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="build/report" charset="UTF-8"
            highlight="false" lowUpperBound="35" highLowerBound="70"/>
            <log type="testdox-html" target="build/testdox.html"/>
        </logging>
    </phpunit>

My test run successfully and I am not getting errors. I have checked for any DIE() and EXIT calls and did not find any in my code. When I look at my report it is just the empty folders with no files being scanned.

I am using PHP_CodeCoverage 1.2.7 using PHP 5.4.3 and PHPUnit 3.7.13 on Windows 8 with Wamp server 2.2

Ok so I wrote a small thing to test PHPUnit coverage reporting... Below is my classes:

/**
*   test
*/
class Application
{
    public $testprop;

    function __construct()
    {
        $this->testprop = "Stuff";
    }
}

/**
*  Tests for the application class
*/
class ApplicationTest extends PHPUnit_Framework_TestCase
{



    public function testRunTheThing()
    {
        $app = new Application();
        $this->assertEquals($app->testprop, 'Stuff');
    }
}

I run the following in my command prompt:

phpunit --coverage-html report ApplicationTest.php

The test passes but the code coverage report generated is of the composer ClassLoader file.

4
  • This will sound dumb, but has bitten me before...do you actually have tests that are calling code that should be covered? The directory will show up empty until an actual test calls code. Commented Feb 25, 2014 at 20:10
  • I just double checked. The test instantiates the object and tests if it an object, so definitely being called. Commented Feb 27, 2014 at 8:20
  • Hmm maybe it's just because the constructor. Try to add a method for example for returning the value of your property... Commented Feb 27, 2014 at 14:49
  • Hi, it seems to have been a bug in the version that I was using, after updating phpunit and dependencies, it seems to be working now. Commented Feb 28, 2014 at 6:25

1 Answer 1

1

It seems to have been an issue with the versions of phpunit and its dependencies. I ran an update on phpunit and now it is generating the coverage reports successfully. I am now using PHP_CodeCoverage 1.2.16, PHP 5.4.3 and PHPUnit 3.7.32.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.