diff --git a/app/config/routing.yml b/app/config/routing.yml index 81fd63067..1a781dbce 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,8 +1,3 @@ -wallabag_annotation: - resource: "@WallabagAnnotationBundle/Controller/" - type: annotation - prefix: / - wallabag_import: resource: "@WallabagImportBundle/Controller/" type: annotation diff --git a/app/config/services.yml b/app/config/services.yml index 06faebfd2..8ce454d07 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -46,10 +46,6 @@ services: # controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class - Wallabag\AnnotationBundle\Controller\: - resource: '../../src/Wallabag/AnnotationBundle/Controller/' - tags: ['controller.service_arguments'] - Wallabag\ApiBundle\Controller\: resource: '../../src/Wallabag/ApiBundle/Controller/' tags: ['controller.service_arguments'] diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bb6e3ac10..d3a0c1aec 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,14 +1,14 @@ parameters: ignoreErrors: - - message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\\\.$#" + message: "#^Method Wallabag\\\\CoreBundle\\\\Controller\\\\AnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\\\.$#" count: 1 - path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php + path: src/Wallabag/CoreBundle/Controller/AnnotationController.php - - message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:putAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\\\.$#" + message: "#^Method Wallabag\\\\CoreBundle\\\\Controller\\\\AnnotationController\\:\\:putAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\\\.$#" count: 1 - path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php + path: src/Wallabag/CoreBundle/Controller/AnnotationController.php - message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#" diff --git a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php index ef57f4851..b55e8fcf9 100644 --- a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php +++ b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php @@ -42,7 +42,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::getAnnotationsAction', [ + return $this->forward('Wallabag\CoreBundle\Controller\AnnotationController::getAnnotationsAction', [ 'entry' => $entry, ]); } @@ -108,7 +108,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::postAnnotationAction', [ + return $this->forward('Wallabag\CoreBundle\Controller\AnnotationController::postAnnotationAction', [ 'request' => $request, 'entry' => $entry, ]); @@ -144,7 +144,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::putAnnotationAction', [ + return $this->forward('Wallabag\CoreBundle\Controller\AnnotationController::putAnnotationAction', [ 'annotation' => $annotation, 'request' => $request, ]); @@ -180,7 +180,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::deleteAnnotationAction', [ + return $this->forward('Wallabag\CoreBundle\Controller\AnnotationController::deleteAnnotationAction', [ 'annotation' => $annotation, ]); } diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/CoreBundle/Controller/AnnotationController.php similarity index 97% rename from src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php rename to src/Wallabag/CoreBundle/Controller/AnnotationController.php index e5ffc6fdf..0cb199f27 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/CoreBundle/Controller/AnnotationController.php @@ -1,6 +1,6 @@ client = $this->createAuthorizedClient(); - } - - public function logInAs($username) - { - $crawler = $this->client->request('GET', '/login'); - $form = $crawler->filter('button[type=submit]')->form(); - $data = [ - '_username' => $username, - '_password' => 'mypassword', - ]; - - $this->client->submit($form, $data); - } - - /** - * @return KernelBrowser - */ - protected function createAuthorizedClient() - { - $client = static::createClient(); - $container = $client->getContainer(); - - /** @var UserManager $userManager */ - $userManager = $container->get('fos_user.user_manager.test'); - $firewallName = $container->getParameter('fos_user.firewall_name'); - - $this->user = $userManager->findUserBy(['username' => 'admin']); - - $client->loginUser($this->user, $firewallName); - - return $client; - } -} diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/CoreBundle/Controller/AnnotationControllerTest.php similarity index 96% rename from tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php rename to tests/Wallabag/CoreBundle/Controller/AnnotationControllerTest.php index 90abf0235..97c6b08a1 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/AnnotationControllerTest.php @@ -1,15 +1,30 @@ logInAs('admin'); + + $this->client = $this->getTestClient(); + } + /** * This data provider allow to tests annotation from the : * - API POV (when user use the api to manage annotations)