【问题标题】:Class '<full path to class>' could not be found in '<full path to class.php>' phpunit testing在“<class.php 的完整路径>”phpunit 测试中找不到类“<class 的完整路径>”
【发布时间】:2016-03-10 13:38:05
【问题描述】:

我正在尝试使用 phpunit 进行测试。

我有一个看起来像这样的文件(试用版):

<?php
class NewController {
    protected $name;

    public function __construct($name)
    {
        $this->name = $name;
    }


}

当我运行 phpunit (v. 5.2) - 我看到以下错误:

Class 'C:\xampp\htdocs\test\NewController' could not be found in 'C:\xampp\htdocs\test\NewController.php'.

我确定我缺少一些简单的东西 - 但另一双眼睛可能会有所帮助。

【问题讨论】:

  • 你如何加载你的类?你使用 composer 和它的自动加载器吗?

标签: php unit-testing testing phpunit


【解决方案1】:

看来phpunit的安装有问题。一旦卸载/重新安装,它就可以正常工作了。

【讨论】:

    猜你喜欢
    • 2016-08-19
    • 2021-12-23
    • 1970-01-01
    • 1970-01-01
    • 2017-03-16
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    相关资源
    最近更新 更多