I try to use Infection to evaluate my testcase using php, I have 2 file (Displayuser.php, displayuserTest.php)
for the first file Displayuser.php the code like this, this file under func folder
<?php
namespace func;
include 'config.php';
class Displayuser
{
public function add($num1, $num2) {
return $num1 + $num2;
}
}
?>
and the second file displayuserTest.php
<?php
include 'config.php';
include 'func/Displayuser.php';
use func\Displayuser;
class DisplayuserTest extends PHPUnit\Framework\TestCase
{
public function testAdd()
{
$dispUser = new func\Displayuser;
$result = $dispUser->add(1,2);
$this->assertEquals(3,$result);
}
}
?>
if I use PHPUnit to test with this command "./vendor/bin/phpunit --testdox" it doesnt matter, no error comes up, but when I use infection command like "infection --filter=Displayuser.php" there is error message
**Processing source code files: 0/1 In CoreClassReflection.php line 55:
Class "func\Displayuser" does not exist
**
why it happen, any master can help me. Thanks
I have create func namespace at Displayuser.php, and actually $dispUser->add can be called but I still get that error.