douzhi9939 2010-04-19 21:27
浏览 71
已采纳

已安装PHPUnit但未找到类PHPUnit_TestCase

Talk about falling at the first hurdle. My test script:

<?php

require_once('PHPUnit/Framework.php');

class TransferResponseTest extends PHPUnit_TestCase {

    ...

}

Running my test case:

$ phpunit TransferResponseTest

Fatal error: Class 'PHPUnit_TestCase' not found in 
/Volumes/Data/greg/code/syndicate/tests/TransferResponseTest.php on line 5
$ php -i | grep include_path
include_path => .:/usr/lib/php => .:/usr/lib/php
$ ls -l /usr/lib/php/PHPUnit/
total 8
drwxr-xr-x  16 root  wheel   544 27 Mar 19:03 Extensions
drwxr-xr-x  28 root  wheel   952 27 Mar 19:03 Framework
-rw-r--r--   1 root  wheel  3193 27 Mar 19:03 Framework.php
drwxr-xr-x   8 root  wheel   272 27 Mar 19:03 Runner
drwxr-xr-x   5 root  wheel   170 27 Mar 19:03 TextUI
drwxr-xr-x  32 root  wheel  1088 27 Mar 19:03 Util

I copied /etc/php.ini-default to /etc/php.ini and explicitly specified the include path as /usr/lib/php/ with an end / but still no success.

$ php -i | grep include_path
include_path => .:/usr/lib/php/ => .:/usr/lib/php/
$ phpunit TransferResponseTest.php 
PHP Fatal error:  Class 'PHPUnit_TestCase' not found in 
/Volumes/Data/greg/code/syndicate/tests/TransferResponseTest.php on line 5
$ phpunit --version
PHPUnit 3.4.11 by Sebastian Bergmann.

Any ideas?

  • 写回答

1条回答 默认 最新

  • duannaiying9662 2010-04-20 07:57
    关注

    It's not PHPUnit_TestCase, but PHPUnit_Framework_TestCase. And you don't have to require 'PHPUnit/Framework.php' which is already loaded by PHPUnit by the time your tests are run.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀