Magento2 unit test error "Error: Call to a member function getDirectoryWrite() on null"
Magento2 unit test for block file for admin grid extending MagentoBackendBlockWidgetGridExtended is giving error "Error: Call to a member function getDirectoryWrite() on null" added below mocks, still error continues. $this->_filesystem = $this->createMock(Filesystem::class); $this->_directory = $this->createMock(DirectoryWrite::class); $this->_filesystem->method('getDirectoryWrite')->willReturn($this->_directory); Can anyone help here?