コード例 #1
0
 /**
  * @param string $type
  * @param string $id
  *
  * @return JsonResponse
  */
 public function unblockAction($type, $id)
 {
     $identifier = new Identifier($type, $id);
     try {
         $this->blocker->unblock($identifier);
         $result = array('success' => true, 'type' => $type, 'id' => $id);
     } catch (\Exception $e) {
         $result = array('success' => false, 'message' => $e->getMessage(), 'type' => $type, 'id' => $id);
     }
     return new JsonResponse($result);
 }
コード例 #2
0
ファイル: BlockerTest.php プロジェクト: brainbits/blocking
 public function testGetBlockReturnsBlockOnExistingBlock()
 {
     $blocker = new Blocker($this->getExistingAdapterMock()->reveal(), $this->ownerMock->reveal(), $this->getValidValidatorMock()->reveal());
     $result = $blocker->getBlock($this->identifierMock->reveal());
     $this->assertInstanceOf(BlockInterface::class, $result);
 }