【发布时间】:2013-02-09 19:32:19
【问题描述】:
我正在尝试配置灯具,phpunit 系统返回下一条消息'.E',但我不知道如何解释它:
C:\kyopol\Apache 2.22.22\htdocs\demo\protected\tests>phpunit unit/EntityTest.php
Sebastian Bergmann 的 PHPUnit 3.7.14。
从 C:\kyopol\Apache 读取的配置 2.22.22\htdocs\demo\protected\tests\phpunit.xml
.E
时间:2 秒,内存:6.50Mb
有 1 个错误:
1) EntityTest::testRead 未定义变量:newEntity
C:\kyopol\Apache 2.22.22\htdocs\demo\protected\tests\unit\EntityTest.php:37
失败!测试:2,断言:3,错误:1。
接下来,类测试EntityTest.php数据代码:
class EntityTest extends CDbTestCase
{
public function testCreate()
{
//CREATE a new Entity
$newEntity=new Entity;
$newEntity->setAttributes(
array(
'name' => 'Test Entity 1',
'description' => 'Test entity number one',
'type_id' => 1,
'location_lat' => 77,
'location_lon' => 77,
'create_time' => '2013-02-16 20:36:00',
'create_user_id' => 1,
'update_time' => '0000-00-00 00:00:00',
'update_user_id' => 0,
)
);
$this->assertTrue($newEntity->save(false));
//READ a Entity
$retrievedEntity=Entity::model()->findByPk($newEntity->id);
$this->assertTrue($retrievedEntity instanceof Entity);
$this->assertEquals('Test Entity 1',$retrievedEntity->name);
}
public function testRead()
{
//READ a Entity
$retrievedEntity=Entity::model()->findByPk($newEntity->id);
$this->assertTrue($retrievedEntity instanceof Entity);
$this->assertEquals('Test Entity 1',$retrievedEntity->name);
}
}
大写字母'E'和前一点'.'是什么意思?
一般来说:没有人说我怎么知道在 phpunit 中解释输出消息吗?
干杯。
【问题讨论】:
标签: yii tdd phpunit database-connection fixtures