]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Enhanced tests and changed route with-annotations-route 4341/head
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 26 Apr 2020 12:09:16 +0000 (14:09 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 26 Apr 2020 12:09:16 +0000 (14:09 +0200)
app/config/security.yml
src/Wallabag/CoreBundle/Controller/EntryController.php
src/Wallabag/CoreBundle/Controller/ExportController.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
src/Wallabag/CoreBundle/Twig/WallabagExtension.php
tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php

index 894bb83f12b7127b9f874fb1157bbe1daaebe685..b06ff5cdcfc07b66d332406b5349a4e0e04b764f 100644 (file)
@@ -69,11 +69,11 @@ security:
         - { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
         - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
-        - { path: /(unread|starred|archive|with_annotations|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: /(unread|starred|archive|annotated|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY }
-        - { path: /(unread|starred|archive|with_annotations).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
+        - { path: /(unread|starred|archive|annotated).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
         - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
         - { path: ^/annotations, roles: ROLE_USER }
index 2c4b5536edc634f1a41087a385222cf1859b0f13..13b23b6116c7d4c537b7bb482875423c3eb02f43 100644 (file)
@@ -240,13 +240,13 @@ class EntryController extends Controller
      *
      * @param int $page
      *
-     * @Route("/with_annotations/list/{page}", name="with_annotations", defaults={"page" = "1"})
+     * @Route("/annotated/list/{page}", name="annotated", defaults={"page" = "1"})
      *
      * @return \Symfony\Component\HttpFoundation\Response
      */
     public function showWithAnnotationsEntriesAction(Request $request, $page)
     {
-        return $this->showEntries('with_annotations', $request, $page);
+        return $this->showEntries('annotated', $request, $page);
     }
 
     /**
@@ -254,7 +254,7 @@ class EntryController extends Controller
      *
      * @param string $type
      *
-     * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|with_annotations|all"})
+     * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|annotated|all"})
      *
      * @return \Symfony\Component\HttpFoundation\RedirectResponse
      */
@@ -517,7 +517,7 @@ class EntryController extends Controller
             case 'archive':
                 $qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId());
                 break;
-            case 'with_annotations':
+            case 'annotated':
                 $qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId());
                 break;
             case 'unread':
index 8517e7a91763dd6b5761bdbfa89395a806087ea3..55b94f0ac32c3988039f53d292af151930f30ffb 100644 (file)
@@ -47,7 +47,7 @@ class ExportController extends Controller
      *
      * @Route("/export/{category}.{format}", name="export_entries", requirements={
      *     "format": "epub|mobi|pdf|json|xml|txt|csv",
-     *     "category": "all|unread|starred|archive|tag_entries|untagged|search|with_annotations"
+     *     "category": "all|unread|starred|archive|tag_entries|untagged|search|annotated"
      * })
      *
      * @return \Symfony\Component\HttpFoundation\Response
@@ -80,7 +80,7 @@ class ExportController extends Controller
              ->getResult();
 
             $title = 'Search ' . $searchTerm;
-        } elseif ('with_annotations' === $category) {
+        } elseif ('annotated' === $category) {
             $entries = $repository->getBuilderForAnnotationsByUser(
                 $this->getUser()->getId()
             )->getQuery()
index 9f25ad4c030147bf5c241b26b5116f55fc0617ac..dab846351d21e77483095361c9533e1054e3f31a 100644 (file)
@@ -535,7 +535,7 @@ class EntryRepository extends EntityRepository
                 $qb->leftJoin('e.tags', 't');
                 $qb->andWhere('t.id is null');
                 break;
-            case 'with_annotations':
+            case 'annotated':
                 $qb->leftJoin('e.annotations', 'a');
                 $qb->andWhere('a.id is not null');
                 break;
index d93e5a674077230fdea0a99dc0ecb67d1c8b359b..ffb070cbdbea8b16a4f636b498cb38276009ba0f 100644 (file)
@@ -12,7 +12,7 @@
     {{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
 {% elseif currentRoute == 'untagged' %}
     {{ 'entry.page_titles.untagged'|trans }}
-{% elseif currentRoute == 'with_annotations' %}
+{% elseif currentRoute == 'annotated' %}
     {{ 'entry.page_titles.with_annotations'|trans }}
 {% else %}
     {{ 'entry.page_titles.unread'|trans }}
index 6c4ae40b34d4424aa786a291591725f3dc98a8e0..e726db5a2b65ac63ef61cb589a3dd8770d4a18ab 100644 (file)
@@ -40,8 +40,8 @@
             {% set activeRoute = null %}
             {% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
                {% set activeRoute = 'all' %}
-            {% elseif currentRoute == 'with_annotations' or currentRouteFromQueryParams == 'with_annotations' %}
-               {% set activeRoute = 'with_annotations' %}
+            {% elseif currentRoute == 'annotated' or currentRouteFromQueryParams == 'annotated' %}
+               {% set activeRoute = 'annotated' %}
             {% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
                {% set activeRoute = 'archive' %}
             {% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
@@ -61,8 +61,8 @@
             <li class="bold {% if activeRoute == 'archive' %}active{% endif %}">
                 <a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a>
             </li>
-            <li class="bold {% if activeRoute == 'with_annotations' %}active{% endif %}">
-                <a class="waves-effect" href="{{ path('with_annotations') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('with_annotations') }}</span></a>
+            <li class="bold {% if activeRoute == 'annotated' %}active{% endif %}">
+                <a class="waves-effect" href="{{ path('annotated') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('annotated') }}</span></a>
             </li>
             <li class="bold {% if activeRoute == 'all' %}active{% endif %}">
                 <a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a>
index e0f67375fb14da7c84678eeaa161683ed01dd334..64f54bfb7e6f58400d89c94046bc3b2a4f0096d5 100644 (file)
@@ -94,7 +94,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
             case 'unread':
                 $qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
                 break;
-            case 'with_annotations':
+            case 'annotated':
                 $qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId());
                 break;
             case 'all':
index 65c65ff15480c65250abf0292c9a9080d2928772..07e075d419d39498c00a0bdfb1f790274dd1e334 100644 (file)
@@ -404,9 +404,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
-        $client->request('GET', '/with_annotations/list');
-
+        $crawler = $client->request('GET', '/annotated/list');
         $this->assertSame(200, $client->getResponse()->getStatusCode());
+        $this->assertCount(2, $crawler->filter('li.entry'));
     }
 
     public function testRangeException()
@@ -1563,7 +1563,7 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertSame(302, $client->getResponse()->getStatusCode());
         $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random');
 
-        $client->request('GET', '/with_annotations/random');
+        $client->request('GET', '/annotated/random');
         $this->assertSame(302, $client->getResponse()->getStatusCode());
         $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'With annotations random');