【发布时间】:2016-02-07 10:32:35
【问题描述】:
我刚开始学习 PHPUnit。我有一个看似很简单的测试;
namespace stats\Test;
use stats\Fetch;
class FetchTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->fetch = new Fetch;
}
public function testStoresListOfAssets()
{
$this->assertClassHasStaticAttribute('paths', 'Fetch'); //line 17
}
}
我的 Fetch 类是;
namespace stats;
class Fetch
{
public static $paths = array(
'jquery' => 'http://code.jquery.com/jquery.js'
);
}
我在运行 PHPUnit 时遇到的错误;
PHPUnit_Framework_Exception: Argument #2 (string#Fetch)of PHPUnit_Framework_Assert::assertClassHasStaticAttribute() must be a class name
这可能是非常愚蠢的事情,但我无法理解问题
【问题讨论】: