1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Merge branch '2.6'

# Conflicts:
#	src/Repository/EntryRepository.php
#	src/Twig/WallabagExtension.php
#	src/Wallabag/CoreBundle/Resources/views/Entry/_card_actions.html.twig
#	src/Wallabag/CoreBundle/Resources/views/Entry/_card_list.html.twig
#	tests/Twig/WallabagExtensionTest.php
This commit is contained in:
Yassine Guedidi 2025-03-18 20:59:39 +01:00
commit 2272d3da66
9 changed files with 68 additions and 32 deletions

View file

@ -1561,6 +1561,38 @@ class EntryControllerTest extends WallabagTestCase
$this->assertCount(2, $crawler->filter($this->entryDataTestAttribute));
}
public function testActionInSearchResults()
{
$this->logInAs('admin');
$client = $this->getTestClient();
$config = $this->getLoggedInUser()->getConfig();
$config->setActionMarkAsRead(ConfigEntity::REDIRECT_TO_CURRENT_PAGE);
$this->getEntityManager()->persist($config);
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
$entry->setTitle('ActionInSearchResults');
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->flush();
// Search on unread list
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('form[name=search]')->form();
$data = [
'search_entry[term]' => 'ActionInSearchResults',
];
$crawler = $client->submit($form, $data);
$currentUrl = $client->getRequest()->getUri();
$element = $crawler->filter('a[data-action="delete"]')->link();
$client->click($element);
$client->followRedirect();
$nextUrl = $client->getRequest()->getUri();
$this->assertSame($currentUrl, $nextUrl);
}
public function dataForLanguage()
{
return [

View file

@ -5,6 +5,7 @@ namespace Tests\Wallabag\Twig;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\Repository\AnnotationRepository;
use Wallabag\Repository\EntryRepository;
use Wallabag\Repository\TagRepository;
use Wallabag\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'));
@ -68,6 +77,10 @@ class WallabagExtensionTest extends TestCase
->disableOriginalConstructor()
->getMock();
$annotationRepository = $this->getMockBuilder(AnnotationRepository::class)
->disableOriginalConstructor()
->getMock();
$tagRepository = $this->getMockBuilder(TagRepository::class)
->disableOriginalConstructor()
->getMock();
@ -80,7 +93,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://www.lemonde.fr'));