【发布时间】:2014-03-06 13:46:53
【问题描述】:
我有一个这样的单元测试:
namespace My\WebBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use My\WebBundle\Controller\SynMCController;
use My\WebBundle\Entity\Users;
class MyControllerTest extends \PHPUnit_Framework_TestCase
{
public function testFunction()
{
$user1 = new Users();
...
}
}
但是当我尝试用 PHP Unit 测试它时,我得到了这个错误:
类'My\WebBundle\Entity\Users;'在第 13 行的 ...\MyControllerTest.php 中找不到
第 13 行是:
$user1 = new Users();
¿在我的测试用例中使用实体有什么问题?当然我的实体用户在这条路径中,我在很多类中都使用过这条路径。
谢谢!!!
【问题讨论】:
-
您确定您的实体没有被称为
User而不是Users? -
谢谢,但是是的,有“s”的用户。
标签: php unit-testing symfony testing phpunit