1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

Add test on /api/annotations

Fix controller forward in WallabagRestController.
Update PHPDoc so it is sorted the same way as others one
Duplicate all annotations test to use both api & normal way
Also, make annotation tests independent to each other
This commit is contained in:
Jeremy Benoist 2016-10-22 12:09:20 +02:00
parent 3199ec4702
commit aa4741091f
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
3 changed files with 121 additions and 56 deletions

View file

@ -50,7 +50,8 @@ class AnnotationRepository extends EntityRepository
{
return $this->createQueryBuilder('a')
->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId)
->getQuery()->getSingleResult()
->getQuery()
->getSingleResult()
;
}
@ -67,7 +68,8 @@ class AnnotationRepository extends EntityRepository
return $this->createQueryBuilder('a')
->where('a.entry = :entryId')->setParameter('entryId', $entryId)
->andwhere('a.user = :userId')->setParameter('userId', $userId)
->getQuery()->getResult()
->getQuery()
->getResult()
;
}

View file

@ -536,7 +536,7 @@ class WallabagRestController extends FOSRestController
{
$this->validateAuthentication();
return $this->forward('WallabagApiBundle:WallabagRest:getAnnotations', [
return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [
'entry' => $entry,
]);
}
@ -544,10 +544,6 @@ class WallabagRestController extends FOSRestController
/**
* Creates a new annotation.
*
* @param Request $request
* @param Entry $entry
*
* @return JsonResponse
* @ApiDoc(
* requirements={
* {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"},
@ -555,15 +551,20 @@ class WallabagRestController extends FOSRestController
* {"name"="text", "dataType"="string", "required"=true, "description"=""},
* }
* )
*
* @param Request $request
* @param Entry $entry
*
* @return JsonResponse
*/
public function postAnnotationAction(Request $request, Entry $entry)
{
$this->validateAuthentication();
return $this->forward('WallabagApiBundle:WallabagRest:postAnnotation', [
'request' => $request,
'entry' => $entry,
]);
return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [
'request' => $request,
'entry' => $entry,
]);
}
/**
@ -586,10 +587,10 @@ class WallabagRestController extends FOSRestController
{
$this->validateAuthentication();
return $this->forward('WallabagApiBundle:WallabagRest:putAnnotation', [
'annotation' => $annotation,
'request' => $request,
]);
return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [
'annotation' => $annotation,
'request' => $request,
]);
}
/**
@ -611,9 +612,9 @@ class WallabagRestController extends FOSRestController
{
$this->validateAuthentication();
return $this->forward('WallabagApiBundle:WallabagRest:deleteAnnotation', [
'annotation' => $annotation,
]);
return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [
'annotation' => $annotation,
]);
}
/**