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_read_file($sftp) { $sftp->read('/home/l3l0/filename')->shouldBeCalled()->willReturn('some content'); $this->read('filename')->shouldReturn('some content'); }
/** * @param \Ssh\Sftp $sftp */ function it_reads_file($sftp) { $sftp->getUrl('/home/l3l0')->willReturn('ssh+ssl://localhost/home/l3l0'); $sftp->read('/home/l3l0/filename')->shouldBeCalled()->willReturn('some content'); $this->read('filename')->shouldReturn('some content'); }