1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Fix redirection after action in search results

This commit is contained in:
Nicolas Lœuillet 2024-11-18 15:24:29 +01:00
parent 89db5690a0
commit 82430b50c6
4 changed files with 35 additions and 3 deletions

View file

@ -1475,6 +1475,38 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(1, $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 [