我收到此错误
D:\Projects\Tickle\tests>phpunit
PHPUnit 3.5.5 by Sebastian Bergmann.
..........ok1
Fatal error: Doctrine\Common\ClassLoader::loadClass(): Failed opening required 'D:\Projects\Tickle\Application\Models\Ap
plication\Models\User.php' (include_path='D:\Projects\Tickle\application/../library;D:\Projects\Tickle\application;D:\Pr
ojects\Tickle\library;D:\ResourceLibrary\Frameworks\PHPFrameworks;C:\Program Files (x86)\PHP\pear;.;c:\php\includes') in
D:\ResourceLibrary\Frameworks\PHPFrameworks\Doctrine\Common\ClassLoader.php on line 148
注意它的重复“ D:\Projects\Tickle\Application\Models\Application\Models\User.php
” Application\Models
。echo
在一些语句的帮助下,我将其缩小到单元测试的 1 个功能
protected function isAllowed($userId, $taskId, $privilege) {
$user = $this->em->find('Application\Models\User', $userId);
echo 'ok1'; // this gets printed
$task = $this->em->find('Application\Models\Task', $taskId); // this seem to be the cause of the problem
echo 'ok2'; // this doesn't get printed
return $this->acl->isAllowed($user, $task, $privilege);
}
全班http://pastebin.com/rJungFvP
所以我尝试在 Tasks 类中查找使用 User 的东西……唯一可能使用 User 类的东西是
/**
* @ManyToOne(targetEntity="User", inversedBy="ownedTasks")
*/
protected $owner;
/**
* @ManyToOne(targetEntity="User", inversedBy="assignedTasks")
*/
protected $assigned;
除此之外,我看不到任何用户的使用。全班http://pastebin.com/wDPXUPSV。
我做错了什么?