public function testCanUpdateFile() { $this->setupFileService($this->cfg); $data = self::TEST_BASE_PATH; $path = 'test'; $fileName = 'test.txt'; $this->fs->save($path, $fileName, $data); $success = $this->fs->update($path . DIRECTORY_SEPARATOR . $fileName, $data . '1'); $this->assertTrue($success, 'Unable to update file'); $res = $this->fs->load($path . DIRECTORY_SEPARATOR . $fileName); $this->assertEquals(self::TEST_BASE_PATH . '1', stream_get_contents($res), 'Updated file did not contain correct string'); }
public function testCanUpdateFileFromResource() { $this->setupFileService(); $this->withPutObjectReturning(); $file1 = tmpfile(); fwrite($file1, self::TEST_BASE_PATH); rewind($file1); $data = self::TEST_BASE_PATH; $path = 'test'; $fileName = 'test.txt'; $this->fs->save($path, $fileName, $data); $success = $this->fs->update($path, $file1); $this->assertNotEmpty($success, 'Could not save file'); }