mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-29 20:41:03 +00:00
Migrate ParamConverter class parameter
This commit is contained in:
parent
8b7b4975d6
commit
1c880883e2
4 changed files with 18 additions and 18 deletions
|
@ -72,7 +72,7 @@ class WallabagAnnotationController extends AbstractFOSRestController
|
||||||
*
|
*
|
||||||
* @see Wallabag\ApiBundle\Controller\WallabagRestController
|
* @see Wallabag\ApiBundle\Controller\WallabagRestController
|
||||||
*
|
*
|
||||||
* @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
|
* @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation")
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +104,7 @@ class WallabagAnnotationController extends AbstractFOSRestController
|
||||||
*
|
*
|
||||||
* @see Wallabag\ApiBundle\Controller\WallabagRestController
|
* @see Wallabag\ApiBundle\Controller\WallabagRestController
|
||||||
*
|
*
|
||||||
* @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
|
* @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation")
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -63,7 +63,7 @@ class AnnotationRestController extends WallabagRestController
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
|
* @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation")
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@ -86,7 +86,7 @@ class AnnotationRestController extends WallabagRestController
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
|
* @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation")
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,7 +25,7 @@ class FeedController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page"=1, "_format"="xml"})
|
* @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page"=1, "_format"="xml"})
|
||||||
*
|
*
|
||||||
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
|
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||||
*
|
*
|
||||||
* @param $page
|
* @param $page
|
||||||
*
|
*
|
||||||
|
@ -41,7 +41,7 @@ class FeedController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page"=1, "_format"="xml"})
|
* @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page"=1, "_format"="xml"})
|
||||||
*
|
*
|
||||||
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
|
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||||
*
|
*
|
||||||
* @param $page
|
* @param $page
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,7 @@ class FeedController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page"=1, "_format"="xml"})
|
* @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page"=1, "_format"="xml"})
|
||||||
*
|
*
|
||||||
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
|
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||||
*
|
*
|
||||||
* @param $page
|
* @param $page
|
||||||
*
|
*
|
||||||
|
@ -73,7 +73,7 @@ class FeedController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/feed/{username}/{token}/all/{page}", name="all_feed", defaults={"page"=1, "_format"="xml"})
|
* @Route("/feed/{username}/{token}/all/{page}", name="all_feed", defaults={"page"=1, "_format"="xml"})
|
||||||
*
|
*
|
||||||
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
|
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
|
@ -87,7 +87,7 @@ class FeedController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/feed/{username}/{token}/tags/{slug}/{page}", name="tag_feed", defaults={"page"=1, "_format"="xml"})
|
* @Route("/feed/{username}/{token}/tags/{slug}/{page}", name="tag_feed", defaults={"page"=1, "_format"="xml"})
|
||||||
*
|
*
|
||||||
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
|
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
|
|
@ -104,7 +104,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$em->expects($this->once())
|
$em->expects($this->once())
|
||||||
->method('getClassMetadata')
|
->method('getClassMetadata')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($meta);
|
->willReturn($meta);
|
||||||
|
|
||||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||||
|
@ -117,10 +117,10 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$registry->expects($this->once())
|
$registry->expects($this->once())
|
||||||
->method('getManagerForClass')
|
->method('getManagerForClass')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($em);
|
->willReturn($em);
|
||||||
|
|
||||||
$params = new ParamConverter(['class' => 'WallabagUserBundle:User']);
|
$params = new ParamConverter(['class' => User::class]);
|
||||||
$converter = new UsernameFeedTokenConverter($registry);
|
$converter = new UsernameFeedTokenConverter($registry);
|
||||||
|
|
||||||
$this->assertTrue($converter->supports($params));
|
$this->assertTrue($converter->supports($params));
|
||||||
|
@ -156,7 +156,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$em->expects($this->once())
|
$em->expects($this->once())
|
||||||
->method('getRepository')
|
->method('getRepository')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($repo);
|
->willReturn($repo);
|
||||||
|
|
||||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||||
|
@ -165,10 +165,10 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$registry->expects($this->once())
|
$registry->expects($this->once())
|
||||||
->method('getManagerForClass')
|
->method('getManagerForClass')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($em);
|
->willReturn($em);
|
||||||
|
|
||||||
$params = new ParamConverter(['class' => 'WallabagUserBundle:User']);
|
$params = new ParamConverter(['class' => User::class]);
|
||||||
$converter = new UsernameFeedTokenConverter($registry);
|
$converter = new UsernameFeedTokenConverter($registry);
|
||||||
$request = new Request([], [], ['username' => 'test', 'token' => 'test']);
|
$request = new Request([], [], ['username' => 'test', 'token' => 'test']);
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$em->expects($this->once())
|
$em->expects($this->once())
|
||||||
->method('getRepository')
|
->method('getRepository')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($repo);
|
->willReturn($repo);
|
||||||
|
|
||||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||||
|
@ -203,10 +203,10 @@ class UsernameFeedTokenConverterTest extends TestCase
|
||||||
|
|
||||||
$registry->expects($this->once())
|
$registry->expects($this->once())
|
||||||
->method('getManagerForClass')
|
->method('getManagerForClass')
|
||||||
->with('WallabagUserBundle:User')
|
->with(User::class)
|
||||||
->willReturn($em);
|
->willReturn($em);
|
||||||
|
|
||||||
$params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']);
|
$params = new ParamConverter(['class' => User::class, 'name' => 'user']);
|
||||||
$converter = new UsernameFeedTokenConverter($registry);
|
$converter = new UsernameFeedTokenConverter($registry);
|
||||||
$request = new Request([], [], ['username' => 'test', 'token' => 'test']);
|
$request = new Request([], [], ['username' => 'test', 'token' => 'test']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue