我正在使用yii框架做一个教程应用程序。当我尝试运行单元测试时,我在命令行中出现了这个错误
Parse error: syntax error, unexpected T_DOUBLE_ARROW in /Applications/MAMP/htdocs/trackstar/protected/tests/unit/ProjectTest.php on line 11
这是我的代码。我在代码中找不到问题。有人可以帮忙吗?
class ProjectTest extends CDbTestCase
{
public function testCRUD()
{
//Create a new project
$newProject=new Project;
$newProjectName = 'Test Project 1';
$newProject->setAttributes(
array(
'name' => $newProjectName,
'description' => 'Test project number one',
'create_time' => '2010-01-01 00:00:00',
'create_user_id' => 1,
'update_time' => '2010-01-01 00:00:00',
'update_user_id' => 1,
)
);
$this->assertTrue($newProject->save(false));
}
}
答案 0 :(得分:3)
在你的“数组”关键字之前有某种不可打印的字符,只需删除那个字符就可以了
class ProjectTest extends CDbTestCase
{
public function testCRUD()
{
//Create a new project
$newProject=new Project;
$newProjectName = 'Test Project 1';
$newProject->setAttributes(
array(
'name' => $newProjectName,
'description' => 'Test project number one',
'create_time' => '2010-01-01 00:00:00',
'create_user_id' => 1,
'update_time' => '2010-01-01 00:00:00',
'update_user_id' => 1,
)
);
$this->assertTrue($newProject->save(false));
}
}
你不会看到差异,但它就在那里