/**
  * Deletes  a language from content repository
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
  *         if language can not be deleted
  *         because it is still assigned to some content / type / (...).
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Language $language
  */
 public function deleteLanguage(Language $language)
 {
     if ($this->repository->hasAccess('content', 'translations') !== true) {
         throw new UnauthorizedException('content', 'translations');
     }
     $loadedLanguage = $this->loadLanguageById($language->id);
     $this->repository->beginTransaction();
     try {
         $this->languageHandler->delete($loadedLanguage->id);
         $this->repository->commit();
     } catch (LogicException $e) {
         $this->repository->rollback();
         throw new InvalidArgumentException("language", $e->getMessage(), $e);
     } catch (Exception $e) {
         $this->repository->rollback();
         throw $e;
     }
 }
 /**
  * Test delete function throwing LogicException
  *
  * @expectedException \LogicException
  * @covers eZ\Publish\Core\Persistence\InMemory\LanguageHandler::delete
  */
 public function testDeleteThrowsLogicException()
 {
     $language = $this->handler->loadByLanguageCode('eng-GB');
     $this->handler->delete($language->id);
 }