/** * @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); }
public function testUnblockReturnsFalseOnNonexistingBlock() { $nonExistingAdapterMock = $this->getNonexistingAdapterMock(); $nonExistingAdapterMock->remove()->shouldNotBeCalled(); $blocker = new Blocker($nonExistingAdapterMock->reveal(), $this->ownerMock->reveal(), $this->getInvalidValidatorMock()->reveal()); $result = $blocker->unblock($this->identifierMock->reveal()); $this->assertFalse($result); }