diff --git a/src/CoreBundle/Controller/Admin/PluginsController.php b/src/CoreBundle/Controller/Admin/PluginsController.php index a7264fdbec..0416c844f2 100644 --- a/src/CoreBundle/Controller/Admin/PluginsController.php +++ b/src/CoreBundle/Controller/Admin/PluginsController.php @@ -8,18 +8,17 @@ namespace Chamilo\CoreBundle\Controller\Admin; use AppPlugin; use Chamilo\CoreBundle\Controller\BaseController; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +#[Route('/plugins')] class PluginsController extends BaseController { - /** - * @Security("is_granted('ROLE_ADMIN')") - * - * @Route("/plugins") - */ - public function pluginsAction(): Response + #[IsGranted('ROLE_ADMIN')] + #[Route('/', name: 'chamilo_core_plugins', methods:['GET', 'POST'])] + public function index(): Response { $appPlugin = new AppPlugin(); $installedPlugins = $appPlugin->getInstalledPlugins(); @@ -35,7 +34,7 @@ class PluginsController extends BaseController /** * @Security("is_granted('ROLE_ADMIN')") * - * @Route("/plugins/add") + * @Route("/add") */ public function pluginsAddAction(): Response { diff --git a/src/CoreBundle/Resources/views/Admin/Settings/plugins.html.twig b/src/CoreBundle/Resources/views/Admin/Settings/plugins.html.twig index 06db57c1ab..05372e9443 100644 --- a/src/CoreBundle/Resources/views/Admin/Settings/plugins.html.twig +++ b/src/CoreBundle/Resources/views/Admin/Settings/plugins.html.twig @@ -1,13 +1,6 @@ -{% extends "::layout.html.twig" %} +{% extends "@ChamiloCore/Layout/layout_one_col.html.twig" %} -{% block page_title %} - {{ 'Plugins' | trans }} -{% endblock %} - -{% block page_subtitle %} -{% endblock %} - -{% block page_content %} +{% block content %} Add diff --git a/tests/CoreBundle/Controller/Admin/AdminControllerTest.php b/tests/CoreBundle/Controller/Admin/AdminControllerTest.php index 7395a5605c..940aa91336 100644 --- a/tests/CoreBundle/Controller/Admin/AdminControllerTest.php +++ b/tests/CoreBundle/Controller/Admin/AdminControllerTest.php @@ -16,11 +16,7 @@ class AdminControllerTest extends WebTestCase public function testIndex(): void { $client = static::createClient(); - - // retrieve the admin $admin = $this->getUser('admin'); - - // simulate $testUser being logged in $client->loginUser($admin); $client->request('GET', '/main/admin/index.php'); diff --git a/tests/CoreBundle/Controller/Admin/PluginControllerTest.php b/tests/CoreBundle/Controller/Admin/PluginControllerTest.php new file mode 100644 index 0000000000..4fd35a2b46 --- /dev/null +++ b/tests/CoreBundle/Controller/Admin/PluginControllerTest.php @@ -0,0 +1,29 @@ +getUser('admin'); + $client->loginUser($admin); + + $client->request('GET', '/plugins/'); + $this->assertResponseIsSuccessful(); + + $content = (string) $client->getResponse()->getContent(); + + $this->assertStringContainsString('Plugin', $content); + } +}