mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-22 17:11:07 +00:00
Enhanced tests and changed route
This commit is contained in:
parent
0aeaf0e8c2
commit
6dfc031839
8 changed files with 18 additions and 18 deletions
|
@ -69,11 +69,11 @@ security:
|
||||||
- { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
|
- { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
|
||||||
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||||
- { path: ^/resetting, 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: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||||
- { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
- { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||||
- { path: ^/feed, 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: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||||
- { path: ^/settings, roles: ROLE_SUPER_ADMIN }
|
- { path: ^/settings, roles: ROLE_SUPER_ADMIN }
|
||||||
- { path: ^/annotations, roles: ROLE_USER }
|
- { path: ^/annotations, roles: ROLE_USER }
|
||||||
|
|
|
@ -282,13 +282,13 @@ class EntryController extends Controller
|
||||||
*
|
*
|
||||||
* @param int $page
|
* @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
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function showWithAnnotationsEntriesAction(Request $request, $page)
|
public function showWithAnnotationsEntriesAction(Request $request, $page)
|
||||||
{
|
{
|
||||||
return $this->showEntries('with_annotations', $request, $page);
|
return $this->showEntries('annotated', $request, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,7 +296,7 @@ class EntryController extends Controller
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @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
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||||
*/
|
*/
|
||||||
|
@ -577,7 +577,7 @@ class EntryController extends Controller
|
||||||
$qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId());
|
$qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId());
|
||||||
$formOptions['filter_archived'] = true;
|
$formOptions['filter_archived'] = true;
|
||||||
break;
|
break;
|
||||||
case 'with_annotations':
|
case 'annotated':
|
||||||
$qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId());
|
$qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId());
|
||||||
break;
|
break;
|
||||||
case 'unread':
|
case 'unread':
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ExportController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/export/{category}.{format}", name="export_entries", requirements={
|
* @Route("/export/{category}.{format}", name="export_entries", requirements={
|
||||||
* "format": "epub|mobi|pdf|json|xml|txt|csv",
|
* "format": "epub|mobi|pdf|json|xml|txt|csv",
|
||||||
* "category": "all|unread|starred|archive|tag_entries|untagged|search|with_annotations|same_domain"
|
* "category": "all|unread|starred|archive|tag_entries|untagged|search|annotated|same_domain"
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
@ -80,7 +80,7 @@ class ExportController extends Controller
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
$title = 'Search ' . $searchTerm;
|
$title = 'Search ' . $searchTerm;
|
||||||
} elseif ('with_annotations' === $category) {
|
} elseif ('annotated' === $category) {
|
||||||
$entries = $repository->getBuilderForAnnotationsByUser(
|
$entries = $repository->getBuilderForAnnotationsByUser(
|
||||||
$this->getUser()->getId()
|
$this->getUser()->getId()
|
||||||
)->getQuery()
|
)->getQuery()
|
||||||
|
|
|
@ -594,7 +594,7 @@ class EntryRepository extends EntityRepository
|
||||||
$qb->leftJoin('e.tags', 't');
|
$qb->leftJoin('e.tags', 't');
|
||||||
$qb->andWhere('t.id is null');
|
$qb->andWhere('t.id is null');
|
||||||
break;
|
break;
|
||||||
case 'with_annotations':
|
case 'annotated':
|
||||||
$qb->leftJoin('e.annotations', 'a');
|
$qb->leftJoin('e.annotations', 'a');
|
||||||
$qb->andWhere('a.id is not null');
|
$qb->andWhere('a.id is not null');
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{{ 'entry.page_titles.untagged'|trans }}
|
{{ 'entry.page_titles.untagged'|trans }}
|
||||||
{% elseif currentRoute == 'same_domain' %}
|
{% elseif currentRoute == 'same_domain' %}
|
||||||
{{ 'entry.page_titles.same_domain'|trans }}
|
{{ 'entry.page_titles.same_domain'|trans }}
|
||||||
{% elseif currentRoute == 'with_annotations' %}
|
{% elseif currentRoute == 'annotated' %}
|
||||||
{{ 'entry.page_titles.with_annotations'|trans }}
|
{{ 'entry.page_titles.with_annotations'|trans }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ 'entry.page_titles.unread'|trans }}
|
{{ 'entry.page_titles.unread'|trans }}
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
{% set activeRoute = null %}
|
{% set activeRoute = null %}
|
||||||
{% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
|
{% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
|
||||||
{% set activeRoute = 'all' %}
|
{% set activeRoute = 'all' %}
|
||||||
{% elseif currentRoute == 'with_annotations' or currentRouteFromQueryParams == 'with_annotations' %}
|
{% elseif currentRoute == 'annotated' or currentRouteFromQueryParams == 'annotated' %}
|
||||||
{% set activeRoute = 'with_annotations' %}
|
{% set activeRoute = 'annotated' %}
|
||||||
{% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
|
{% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
|
||||||
{% set activeRoute = 'archive' %}
|
{% set activeRoute = 'archive' %}
|
||||||
{% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
|
{% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
|
||||||
|
@ -61,8 +61,8 @@
|
||||||
<li class="bold {% if activeRoute == 'archive' %}active{% endif %}">
|
<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>
|
<a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="bold {% if activeRoute == 'with_annotations' %}active{% endif %}">
|
<li class="bold {% if activeRoute == 'annotated' %}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>
|
<a class="waves-effect" href="{{ path('annotated') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('annotated') }}</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="bold {% if activeRoute == 'all' %}active{% endif %}">
|
<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>
|
<a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a>
|
||||||
|
|
|
@ -95,7 +95,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
|
||||||
case 'unread':
|
case 'unread':
|
||||||
$qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
|
$qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
|
||||||
break;
|
break;
|
||||||
case 'with_annotations':
|
case 'annotated':
|
||||||
$qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId());
|
$qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId());
|
||||||
break;
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
|
|
|
@ -416,9 +416,9 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||||
$this->logInAs('admin');
|
$this->logInAs('admin');
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
$client->request('GET', '/with_annotations/list');
|
$crawler = $client->request('GET', '/annotated/list');
|
||||||
|
|
||||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||||
|
$this->assertCount(2, $crawler->filter('li.entry'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRangeException()
|
public function testRangeException()
|
||||||
|
@ -1600,7 +1600,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||||
$this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random');
|
$this->assertStringContainsString('/view/', $client->getResponse()->getTargetUrl(), 'Untagged random');
|
||||||
|
|
||||||
$client->request('GET', '/with_annotations/random');
|
$client->request('GET', '/annotated/random');
|
||||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||||
$this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'With annotations random');
|
$this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'With annotations random');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue