Move Annotation controller to Core
This commit is contained in:
parent
eb36d692aa
commit
2ed8c219cc
@ -1,8 +1,3 @@
|
||||
wallabag_annotation:
|
||||
resource: "@WallabagAnnotationBundle/Controller/"
|
||||
type: annotation
|
||||
prefix: /
|
||||
|
||||
wallabag_import:
|
||||
resource: "@WallabagImportBundle/Controller/"
|
||||
type: annotation
|
||||
|
@ -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']
|
||||
|
@ -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\\<mixed\\>\\.$#"
|
||||
message: "#^Method Wallabag\\\\CoreBundle\\\\Controller\\\\AnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<mixed\\>\\.$#"
|
||||
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\\<null\\>\\.$#"
|
||||
message: "#^Method Wallabag\\\\CoreBundle\\\\Controller\\\\AnnotationController\\:\\:putAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<null\\>\\.$#"
|
||||
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\\(\\)\\.$#"
|
||||
|
@ -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,
|
||||
]);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\AnnotationBundle\Controller;
|
||||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use FOS\RestBundle\Controller\AbstractFOSRestController;
|
||||
@ -17,7 +17,7 @@ use Wallabag\AnnotationBundle\Repository\AnnotationRepository;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class WallabagAnnotationController extends AbstractFOSRestController
|
||||
class AnnotationController extends AbstractFOSRestController
|
||||
{
|
||||
protected EntityManagerInterface $entityManager;
|
||||
protected SerializerInterface $serializer;
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Wallabag\AnnotationBundle;
|
||||
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use FOS\UserBundle\Model\UserManager;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var KernelBrowser
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->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;
|
||||
}
|
||||
}
|
@ -1,15 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Wallabag\AnnotationBundle\Controller;
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class AnnotationControllerTest extends WallabagAnnotationTestCase
|
||||
class AnnotationControllerTest extends WallabagCoreTestCase
|
||||
{
|
||||
/**
|
||||
* @var KernelBrowser
|
||||
*/
|
||||
private $client;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->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)
|
Loading…
x
Reference in New Issue
Block a user