duanpenpan5796 2013-07-19 08:51
浏览 31
已采纳

PHPUnit-Netbeans类未找到异常

I integrated PHPUnit into netbeans and now want to generate tests for my code.

<?php

/**
     * Action User
     *
     * user api
     *
     * @link http://getfrapi.com
     * @author Frapi <frapi@getfrapi.com>
     * @link rsmobile/user/:id
     */
    class Action_User extends Frapi_Action implements Frapi_Action_Interface
    {

    }
?>

I tried to do that by right clicking and selecting Tools->Create PHPUnit Tests. But it gave this error :

Fatal error: Class 'Frapi_Action' not found in /Users/username/Documents/.../src/   
frapi/custom/Action/User.php on line 12

Then I added dummy Frapi_Action class in file User.php and then it generated skeleton class.

<?php

/**
     * Action User
     *
     * user api
     *
     * @link http://getfrapi.com
     * @author Frapi <frapi@getfrapi.com>
     * @link rsmobile/user/:id
     */

    class  Frapi_Action {} 

    class Action_User extends Frapi_Action implements Frapi_Action_Interface
    {

    }
?>

Why it gave that Class not found error? How do I solve it?

  • 写回答

2条回答 默认 最新

  • dql1978dql1978 2013-07-19 09:43
    关注

    I solved it by adding path of the file containing Frapi_Action class.

    require_once 'path/of/file';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 unity脚本挂不上
  • ¥15 数学建模数学建模需要
  • ¥20 Java Sound Api 调用Mixer.getLine偶现Line unsupported错误。
  • ¥15 使用cuda加速opencv运算但是报错AttributeError: module 'cv2.cuda' has no attribute 'getCudaEnabledDeviceCount'
  • ¥15 java输入输出异常
  • ¥15 三子连珠对弈小游戏制作
  • ¥15 C++扑克牌游戏的编程
  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程