/** * */ public function testApiCreateFile_ThrowsException_WhenLegueWriteThrowsException() { $path = 'path'; $contents = 'contents'; $visibility = 'visibility'; $expected = new Exception(); $ex = null; $this->expect('put', [$path, $contents, $this->prepareConfig($visibility)])->willThrow($expected); try { $this->fs->createFile($path, $contents, $visibility); } catch (Exception $ex) { } $this->assertInstanceOf(WriteException::class, $ex); $this->assertSame($expected, $ex->getPrevious()); }