sebastianbergmann / phpcov

TextUI frontend for php-code-coverage
BSD 3-Clause "New" or "Revised" License
226 stars 58 forks source link

How to use 'execute'? #64

Closed leberknecht closed 7 years ago

leberknecht commented 7 years ago

Hi, i'm confused about how to use the execute command:

<?php
// TestClass.php
class TestClass
{
    public function method1()
    {
        echo "method 1 triggered";
    }

    public function method2()
    {
        echo "method 2 triggered";
        return 'yeehaa';
    }
}

script:

<?php
//script.php
require_once 'TestClass.php';

$testClass = new TestClass();
$testClass->method1();

then i fire phpcov execute script.php --clover coverage.xml and the contents of the clover file is:

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1497445956">
  <project timestamp="1497445956">
    <metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
  </project>
</coverage>

i expected that method 1 will be covered..what am i missing here?

leberknecht commented 7 years ago

Uh, forgot: PHP 7.0.20-1~ubuntu16.04.1+deb.sury.org+1, xdebug v2.5.4

leberknecht commented 7 years ago

Ah, found that i'have to pass --whitelist

leberknecht commented 7 years ago

Refs https://github.com/sebastianbergmann/phpcov/pull/65