/**
  * @vcr posts/test-new-post-with-utf8-content-vcr.yml
  */
 public function testNewPostWithUtf8Content()
 {
     $postId = (int) $this->client->newPost('Đây là một tiêu đề ở định dạng UTF-8', 'Lorem Ipsum chỉ đơn giản là một đoạn văn bản giả, được dùng vào việc trình bày và dàn trang phục vụ cho in ấn');
     $this->assertGreaterThan(0, $postId);
     $post = $this->client->getPost($postId);
     $this->assertSame('Đây là một tiêu đề ở định dạng UTF-8', $post['post_title']);
     $this->assertSame('Lorem Ipsum chỉ đơn giản là một đoạn văn bản giả, được dùng vào việc trình bày và dàn trang phục vụ cho in ấn', $post['post_content']);
 }
Esempio n. 2
0
 /**
  * @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']);
 }