Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions spec/Event/PushEventSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ public function it_exposes_constructor_arguments(
$this->getSender()->shouldReturn($sender);
}

public function it_exposes_if_push_event_is_for_a_branch(Ref $ref)
{
$ref->isBranchReference()->shouldBeCalled()->willReturn(true);
$this->isBranch()->shouldReturn(true);
}

public function it_exposes_if_push_event_is_for_a_tag(Ref $ref)
{
$ref->isTagReference()->shouldBeCalled()->willReturn(true);
$this->isTag()->shouldReturn(true);
}

public function it_exposes_if_this_is_a_delete_push_event(PushEventState $state)
{
$state->isDeleted()->shouldBeCalled()->willReturn(true);
$this->isDeleted()->shouldReturn(true);
}

public function it_has_no_after_and_head_commit_for_delete(
Ref $ref,
GitHubCommitSha $before,
Expand Down
15 changes: 15 additions & 0 deletions src/Event/PushEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,19 @@ public function getSender(): Sender
{
return $this->sender;
}

public function isBranch(): bool
{
return $this->ref->isBranchReference();
}

public function isTag(): bool
{
return $this->ref->isTagReference();
}

public function isDeleted(): bool
{
return $this->state->isDeleted();
}
}