0

嗨,我是 Zend Framework 2 的新手,这行代码有问题:

$sql = new Sql($this->tableGateway->getAdapter());

如果我使用 Phpunit 进行测试,我会收到错误

Argument 1 passed to Zend\Db\Sql\Sql::__construct() must implement interface 
Zend\Db\Adapter\AdapterInterface, null given, called in C:\xampp\htdocs\zend2
4

1 回答 1

0

检查是否设置了适配器。

var_dump(get_class($this->tableGateway->getAdapter()));

还有你怎么申报的$this->tableGateway

于 2013-03-14T14:28:58.543 回答