我正在尝试测试包含上下文对象的模块,如下所示:
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Catalog\Model\Product\ImageFactory $productImageFactory,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\View\ConfigInterface $viewConfig,
ProductRepository $productRepo
)
{
parent::__construct($context, $productImageFactory, $assetRepo, $viewConfig);
$this->productRepo = $productRepo;
}
当我运行单元测试时,它会显示以下错误消息:
PHPUnit_Framework_Error : Argument 1 passed to Magento\Catalog\Model\Product::__construct() must be an instance of Magento\Framework\Model\Context, none given, called in ...
如何模拟该对象或解决此错误?