/**
  * @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);
 }
Example #2
0
 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);
 }