我正在开发一个带有代码的symfony项目。除了代码覆盖率,一切正常。我写了一个执行函数的测试。当我使用XDebug设置断点并运行CLI时,断点被击中,但是当我查看报告时,它说代码没有被击中。测试已经完成并给出了正确的结果
我在本地运行测试时没有使用c3.php。
/**
* @ORM\Entity
* @ORM\Table(name="`user`")
*/
class User extends BaseUser implements ParticipantInterface
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
}
这是测试
public function testGetId()
{
$user = new User();
$this->invokeProperty($user, 'id', 1);
$this->assertEquals(1, $user->getId());
}
Codeception.yml
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
include:
- src/*Bundle
coverage:
enabled: true
remote: false
include:
- src/*
exclude:
- src/AppBundle/Resources/*
- src/AppBundle/Tests/*
我的套房。
class_name: FunctionalTester
modules:
enabled:
- Symfony2:
app_path: '../../app'
var_path: '../../app'
- Doctrine2:
depends: Symfony2
- AppBundle\Helper\Functional