doufen1933 2011-12-15 11:32
浏览 39

PHP单元测试 - 包括项目类的一次错误

I created some test but there is problem with running them

In bootstrap I have:

    define("BASE_PATH",str_replace("\\","/",dirname(__FILE__)));

//Get an array of your include paths
$include_parts = explode(PATH_SEPARATOR,get_include_path());

//Extend the paths
$include_parts[] = dirname(dirname(BASE_PATH)); //this is ../../

//recompile the paths and set them
set_include_path(implode(PATH_SEPARATOR,$include_parts));
/**
 * Test if phpunit running on php 5.3 or newer
 */
version_compare(PHP_VERSION, '5.3', '<') and exit('Test requires PHP 5.3 or newer.');
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors', TRUE);
define('DOC_ROOT','');

When running test I get warning

Warning: include_once(): Failed opening '/private/config/abc.php' for inclusion (include_path='/usr/local/bin:/usr/local/lib/php/:.:/opt/docroot/shared:/export/home/john/public_html/sports') in /export/home/john/public_html/sports/private/tests/Football/Match/LineupTest.php on line 3

What is wrong because I see that included path I see my dir.

  • 写回答

2条回答 默认 最新

  • dongmu5920 2011-12-15 17:09
    关注

    You are including abc.php using an absolute path so the include path is ignored. Do you really have /private/config/abc.php in your filesystem?

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么