Example #1
0
function postCommentVote($self)
{
    if (!$self) {
        // stuff
    }
    $vote = postVote($self);
    $comment = createComment($vote->id);
    // Make a comment vote
    $comment_vote = factory(App\CommentVote::class)->make(['comment_id' => $comment->id, 'vote_id' => $vote->id])->toArray();
    $comment_vote = $self->call('POST', '/api/comment_vote?token=' . $self->token, $comment_vote);
    $self->assertResponseOk();
    return $comment_vote->getOriginalContent();
}
Example #2
0
 /** @test */
 public function it_can_delete_vote()
 {
     // As per the API delete route, you cannot delete a vote, you may only switch to abstain.
     $vote = postVote($this);
     // Delete Vote
     $this->call('DELETE', '/api/vote/' . $vote->id . '?token=' . $this->token);
     $this->assertResponseOk();
     $this->seeInDatabase('votes', ['id' => $vote->id, 'position' => 0, 'user_id' => $this->user->id]);
 }