public function testRewrite()
{
$snippet = $this->snippetFromMethod(StorageObject::class, 'rewrite');
$snippet->addLocal('object', $this->object);
$snippet->replace("file_get_contents(__DIR__ . '/key.txt')", "'testKeyData'");
$this->connection->rewriteObject(Argument::any())->shouldBeCalled()->willReturn(['resource' => ['name' => self::OBJECT, 'bucket' => self::BUCKET, 'generation' => 'foo']]);
$this->object->setConnection($this->connection->reveal());
$res = $snippet->invoke('rewrittenObject');
$this->assertInstanceOf(StorageObject::class, $res->returnVal());
}