/** * @expectedException \Magento\Framework\Exception\FileSystemException */ public function testWriteException() { $data = 'data'; $emptyTranslation = ''; $this->driver->expects($this->once())->method('fileWrite')->with($this->resource, $data)->willThrowException(new FileSystemException(new Phrase($emptyTranslation))); $this->file->write($data); }
/** * Write closing tag and close stream * * @param string $type * @return void */ protected function _finalizeSitemap($type = self::TYPE_URL) { if ($this->_stream) { $this->_stream->write(sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type)); $this->_stream->close(); } // Reset all counters $this->_lineCount = 0; $this->_fileSize = 0; }
/** * @expectedException \Magento\Framework\Filesystem\FilesystemException */ public function testWriteException() { $data = 'data'; $this->driver->expects($this->once())->method('fileWrite')->with($this->resource, $data)->will($this->throwException(new \Magento\Framework\Filesystem\FilesystemException())); $this->file->write($data); }