Closed deyvisonrocha closed 5 years ago
Thank you for your report.
Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.
Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.
Let's go:
In app/MyClass.php
<?php
namespace App;
class MyClass
{
public function sayHello($name)
{
return "Hello $name";
}
}
In src/AnotherClass.php
<?php
namespace MyPackage;
class AnotherClass
{
public function sayHello()
{
return "Hello";
}
}
My tests:
In tests/app/MyClassTest.php
<?php
namespace Tests;
use PHPUnit\Framework\TestCase;
class MyClassTest extends TestCase
{
public function testSayHello()
{
$myClass = new \App\MyClass('Deyvison');
$this->assertEquals('Hello Deyvison', $myClass->sayHello());
}
}
In tests/src/AnotherClassTest.php
<?php
namespace Tests;
use PHPUnit\Framework\TestCase;
class AnotherClassTest extends TestCase
{
public function testSayHello()
{
$myClass = new \MyPackage\AnotherClass(');
$this->assertEquals('Hello', $myClass->sayHello());
}
}
Where is the phpunit.xml
? How do you invoke PHPUnit?
In the root folder. I use vendor/bin/phpunit
to execute the tests.
It is a large project. Last week this started to happen after installing pcov and pcov/clobber
to run faster coverage.
I run vendor/bin/pcov clobber
after run vendor/bin/phpunit
.
I asked for a minimal, self-contained, reproducing test case. This includes the phpunit.xml
. Without this I am not able to investigate this issue.
I solved the problem.
By default, pcov-clobber find the folders in the order: src
, lib
or app
.
For multi-folder operation I used the @krakjoe tip itself at the link below: https://github.com/krakjoe/pcov/issues/17#issuecomment-498041469
No have problem with php-code-coverage. Issue closed.
Hi. I have the same problem.
See my phpunit.xml:
The folder './src' has coverage but the './app' doesn't has coverage. See the screenshot: