public function testWriteAndReadFile() { $path = $this->tmpDir . '/new.txt'; // Creating new file. $this->assertEquals(true, $this->sftp->write($path, 'MyContent')); $this->assertEquals('MyContent', $this->sftp->read($path)); // Overwriting. $this->assertEquals(true, $this->sftp->write($path, 'AnotherContent')); $this->assertEquals('AnotherContent', $this->sftp->read($path)); }
/** * @param \Ssh\Sftp $sftp */ function it_should_write_file($sftp) { $sftp->write('/home/l3l0/filename', 'some content')->shouldBeCalled()->willReturn(12); $this->write('filename', 'some content')->shouldReturn(12); }
/** * @param \Ssh\Sftp $sftp */ function it_writes_file($sftp) { $sftp->getUrl('/home/l3l0')->willReturn('ssh+ssl://localhost/home/l3l0'); $sftp->write('/home/l3l0/filename', 'some content')->shouldBeCalled()->willReturn(12); $this->write('filename', 'some content')->shouldReturn(12); }