Magento2 单元测试错误“Error: Call to a member function getDirectoryWrite() on null”

问题描述 投票:0回答:0

管理网格扩展 Magento\Backend\Block\Widget\Grid\Extended 的块文件的 Magento2 单元测试给出错误“错误:在 null 上调用成员函数 getDirectoryWrite()”

在模拟下面添加,仍然错误继续。

$this->_filesystem = $this->createMock(Filesystem::class);
$this->_directory = $this->createMock(DirectoryWrite::class);
$this->_filesystem->method('getDirectoryWrite')->willReturn($this->_directory);

有人可以帮忙吗?

phpunit magento2
© www.soinside.com 2019 - 2024. All rights reserved.