Пример #1
0
 /**
  * Create the tree by a set of blob ids.
  *
  * @param WordPress_GitHub_Sync_Tree $tree Tree to create.
  *
  * @return stdClass|WP_Error
  */
 protected function create_tree(WordPress_GitHub_Sync_Tree $tree)
 {
     return $this->call('POST', $this->tree_endpoint(), $tree->to_body());
 }
Пример #2
0
 public function test_should_remove_post_by_path()
 {
     $sha = '1234567890qwertyuiop';
     $this->blob->shouldReceive('sha')->andReturn($sha);
     $post_id = $this->factory->post->create();
     $post = new WordPress_GitHub_Sync_Post($post_id, $this->api);
     $this->blob->shouldReceive('path')->andReturn($post->github_path());
     $tree = new WordPress_GitHub_Sync_Tree(new stdClass());
     $tree->add_blob($this->blob);
     $tree->remove_post_from_tree($post);
     $this->assertCount(0, $blobs = $tree->blobs());
     $this->assertTrue($tree->is_changed());
     $body = $tree->to_body();
     $this->assertArrayHasKey('tree', $body);
     $this->assertCount(0, $body['tree']);
 }