/** * @vcr media/test-upload-file-with-attachment-vcr.yml */ public function testUploadFileWithAttachment() { $post = $this->client->newPost('Attachment post', ''); $content = file_get_contents("tests/image.jpg"); $mime = mime_content_type("tests/image.jpg"); $file = $this->client->uploadFile('baz image.jpg', $mime, $content, null, $post); $this->assertArrayHasKey('id', $file); $this->assertArrayHasKey('file', $file); $this->assertArrayHasKey('url', $file); $this->assertArrayHasKey('type', $file); $file = $this->client->getMediaItem($file['id']); $this->assertEquals($post, $file['parent']); }