drfif48428 2015-10-01 06:49
浏览 347
已采纳

PHPUnit - 找不到测试类

When I am trying to test a class, it can't find the class to be tested.

Under the following line you see the test:

    <?php

class FacebookRestTest extends \PHPUnit_Framework_TestCase
{
    public function testFacebookFirstTest()
    {
        $pageid = 634336563297055;
        $since = 1438387200;
        $until = 1443052800;

        $facebook = new FacebookRest(new DataReader(new Report($pageid, $since, $until)));
        $page = $facebook->getPage();
        $this->assertTrue(!empty($page));
    }
}

But when I run the test in the terminal, it throws an error that it can't find the FacebookRest class.

Here is the error:

Fatal error: Class 'FacebookRest' not found in /Applications/MAMP/htdocs/faceboo1/tests/FacebookRestTest.php on line 11

Anyone know how to solve this?

  • 写回答

1条回答 默认 最新

  • dpleylxzx47207117 2015-10-01 07:15
    关注

    You haven't included your class.

    Add on top of your FacebookRestTest file:

    include_once __DIR__.'/../classes/FacebookRest.php'; 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器