我有这样一个类:
namespace MyFirmPlatformBundleEntityDestinationContent;
class Event extends Content //this is line 18
{
...
我试图通过这个生成它的骨架测试类:
$ phpunit --skeleton-test "MyFirmPlatformBundleEntityDestinationContentEvent" Event.php
但是我得到这个错误:
PHP Fatal error: Class 'MyFirmPlatformBundleEntityDestinationContentContent' not found in /home/me/mf/myfirm/src/MyFirm/PlatformBundle/Entity/Destination/Content/Event.php on line 18
这是Content类:
namespace MyFirmPlatformBundleEntityDestinationContent;
abstract class Content
{
...
我没有遇到任何问题,首先为Content类生成骨架测试类。
任何想法?
php 5.3/phpunit 3.5
标签:继承
只要您不使用phpunit命令将您的类名解析为可以自动加载的实际文件,这将无法工作,因为在加载文件以创建骨架的时候,没有声明MyFirmPlatformBundleEntityDestinationContentContent
。
将您的项目自动加载器添加到一个引导文件中,并使用启用了该引导文件的phpunit构建骨架文件。然后你就不会再得到这个致命的错误,因为PHP也能找到MyFirmPlatformBundleEntityDestinationContentContent
的声明。