aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-22 12:09:20 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-22 12:09:20 +0200
commitaa4741091f3f2cc7e4a7ef061a04678597ddeca8 (patch)
treee5a41f21c2c182bc198c9aa6d3c37f380d3d597c /src/Wallabag
parent3199ec4702cec9c10ad0c663bcf6ce799068c9aa (diff)
downloadwallabag-aa4741091f3f2cc7e4a7ef061a04678597ddeca8.tar.gz
wallabag-aa4741091f3f2cc7e4a7ef061a04678597ddeca8.tar.zst
wallabag-aa4741091f3f2cc7e4a7ef061a04678597ddeca8.zip
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
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php6
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php33
2 files changed, 21 insertions, 18 deletions
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
index 5f7da70e..8cccffba 100644
--- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
+++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
@@ -50,7 +50,8 @@ class AnnotationRepository extends EntityRepository
50 { 50 {
51 return $this->createQueryBuilder('a') 51 return $this->createQueryBuilder('a')
52 ->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId) 52 ->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId)
53 ->getQuery()->getSingleResult() 53 ->getQuery()
54 ->getSingleResult()
54 ; 55 ;
55 } 56 }
56 57
@@ -67,7 +68,8 @@ class AnnotationRepository extends EntityRepository
67 return $this->createQueryBuilder('a') 68 return $this->createQueryBuilder('a')
68 ->where('a.entry = :entryId')->setParameter('entryId', $entryId) 69 ->where('a.entry = :entryId')->setParameter('entryId', $entryId)
69 ->andwhere('a.user = :userId')->setParameter('userId', $userId) 70 ->andwhere('a.user = :userId')->setParameter('userId', $userId)
70 ->getQuery()->getResult() 71 ->getQuery()
72 ->getResult()
71 ; 73 ;
72 } 74 }
73 75
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index 0c709ca0..a73d44ca 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -536,7 +536,7 @@ class WallabagRestController extends FOSRestController
536 { 536 {
537 $this->validateAuthentication(); 537 $this->validateAuthentication();
538 538
539 return $this->forward('WallabagApiBundle:WallabagRest:getAnnotations', [ 539 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [
540 'entry' => $entry, 540 'entry' => $entry,
541 ]); 541 ]);
542 } 542 }
@@ -544,10 +544,6 @@ class WallabagRestController extends FOSRestController
544 /** 544 /**
545 * Creates a new annotation. 545 * Creates a new annotation.
546 * 546 *
547 * @param Request $request
548 * @param Entry $entry
549 *
550 * @return JsonResponse
551 * @ApiDoc( 547 * @ApiDoc(
552 * requirements={ 548 * requirements={
553 * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"}, 549 * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"},
@@ -555,15 +551,20 @@ class WallabagRestController extends FOSRestController
555 * {"name"="text", "dataType"="string", "required"=true, "description"=""}, 551 * {"name"="text", "dataType"="string", "required"=true, "description"=""},
556 * } 552 * }
557 * ) 553 * )
554 *
555 * @param Request $request
556 * @param Entry $entry
557 *
558 * @return JsonResponse
558 */ 559 */
559 public function postAnnotationAction(Request $request, Entry $entry) 560 public function postAnnotationAction(Request $request, Entry $entry)
560 { 561 {
561 $this->validateAuthentication(); 562 $this->validateAuthentication();
562 563
563 return $this->forward('WallabagApiBundle:WallabagRest:postAnnotation', [ 564 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [
564 'request' => $request, 565 'request' => $request,
565 'entry' => $entry, 566 'entry' => $entry,
566 ]); 567 ]);
567 } 568 }
568 569
569 /** 570 /**
@@ -586,10 +587,10 @@ class WallabagRestController extends FOSRestController
586 { 587 {
587 $this->validateAuthentication(); 588 $this->validateAuthentication();
588 589
589 return $this->forward('WallabagApiBundle:WallabagRest:putAnnotation', [ 590 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [
590 'annotation' => $annotation, 591 'annotation' => $annotation,
591 'request' => $request, 592 'request' => $request,
592 ]); 593 ]);
593 } 594 }
594 595
595 /** 596 /**
@@ -611,9 +612,9 @@ class WallabagRestController extends FOSRestController
611 { 612 {
612 $this->validateAuthentication(); 613 $this->validateAuthentication();
613 614
614 return $this->forward('WallabagApiBundle:WallabagRest:deleteAnnotation', [ 615 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [
615 'annotation' => $annotation, 616 'annotation' => $annotation,
616 ]); 617 ]);
617 } 618 }
618 619
619 /** 620 /**