コード例 #1
0
ファイル: PushHandler.php プロジェクト: brankol/devboard
 /**
  * @param PushPayload $pushPayload
  *
  * @throws Exception
  *
  * @return BranchHandler|TagHandler
  */
 private function getHandler(PushPayload $pushPayload)
 {
     if ($pushPayload->isBranch()) {
         return $this->branchHandler;
     } elseif ($pushPayload->isTag()) {
         return $this->tagHandler;
     }
     throw new Exception('Unsupported push payload: payload should be branch or tag!');
 }
コード例 #2
0
ファイル: PushPayloadTest.php プロジェクト: brankol/devboard
 /**
  * @dataProvider provideDeletedBranch
  *
  * @param $data
  *
  * @throws \Exception
  */
 public function testDeleteBranch($data)
 {
     $payload = new PushPayload($data);
     $this->assertTrue($payload->isBranch());
     $this->assertTrue($payload->isDelete());
     $this->assertSame(PushPayload::DELETED, $payload->getType());
     $this->assertFalse($payload->isTag());
     $this->assertFalse($payload->isCreate());
     $this->assertFalse($payload->isUpdate());
 }
コード例 #3
0
 public function it_will_throw_exception_if_not_branch_or_tag_push_event(PushPayload $pushPayload)
 {
     $pushPayload->isBranch()->willReturn(false);
     $pushPayload->isTag()->willReturn(false);
     $this->shouldThrow('Exception')->duringProcess($pushPayload);
 }