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']); }