forked from wallabag/wallabag
Fix entries counter for annotated entries in the menu
The query were badly made and return all annotations for the current user instead of the total of entries with annotation(s).
This commit is contained in:
@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Twig;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\AnnotationBundle\Repository\AnnotationRepository;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\CoreBundle\Repository\TagRepository;
|
||||
use Wallabag\CoreBundle\Twig\WallabagExtension;
|
||||
@ -17,6 +18,10 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$annotationRepository = $this->getMockBuilder(AnnotationRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -29,7 +34,7 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
$extension = new WallabagExtension($entryRepository, $annotationRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
|
||||
$this->assertSame('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
|
||||
$this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr'));
|
||||
@ -42,6 +47,10 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$annotationRepository = $this->getMockBuilder(AnnotationRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -54,7 +63,7 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
$extension = new WallabagExtension($entryRepository, $annotationRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
|
||||
$this->assertSame('lemonde.fr', $extension->removeScheme('lemonde.fr'));
|
||||
$this->assertSame('gist.github.com', $extension->removeScheme('gist.github.com'));
|
||||
@ -67,6 +76,10 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$annotationRepository = $this->getMockBuilder(AnnotationRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -79,7 +92,7 @@ class WallabagExtensionTest extends TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
$extension = new WallabagExtension($entryRepository, $annotationRepository, $tagRepository, $tokenStorage, 0, $translator, '');
|
||||
|
||||
$this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('www.lemonde.fr'));
|
||||
$this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('http://lemonde.fr'));
|
||||
|
||||
Reference in New Issue
Block a user