forked from wallabag/wallabag
Merge branch '2.6' into merge-2.6-in-master
This commit is contained in:
@ -1330,8 +1330,10 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$client->request('GET', '/view/' . $entry->getId());
|
||||
$client->request('GET', '/archive/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$link = $crawler->filter('a[id="markAsRead"]')->link();
|
||||
$client->click($link);
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('/view/' . $entry->getId(), $client->getResponse()->headers->get('location'));
|
||||
@ -1707,7 +1709,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
// the deletion link of the first tag
|
||||
$link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract(['href'])[1];
|
||||
|
||||
$this->assertSame(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
|
||||
$this->assertStringStartsWith(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
|
||||
}
|
||||
|
||||
public function testRandom()
|
||||
|
||||
@ -123,9 +123,11 @@ class TagControllerTest extends WallabagCoreTestCase
|
||||
$this->getEntityManager()->clear();
|
||||
|
||||
// We make a first request to set an history and test redirection after tag deletion
|
||||
$client->request('GET', '/view/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
$entryUri = $client->getRequest()->getRequestUri();
|
||||
$client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId());
|
||||
|
||||
$link = $crawler->filter('a[href^="/remove-tag/' . $entry->getId() . '/' . $tag->getId() . '"]')->link();
|
||||
$client->click($link);
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame($entryUri, $client->getResponse()->getTargetUrl());
|
||||
|
||||
@ -34,7 +34,7 @@ class RedirectTest extends TestCase
|
||||
$this->routerMock->expects($this->any())
|
||||
->method('generate')
|
||||
->with('homepage')
|
||||
->willReturn('homepage');
|
||||
->willReturn('/');
|
||||
|
||||
$this->user = new User();
|
||||
$this->user->setName('youpi');
|
||||
@ -60,18 +60,11 @@ class RedirectTest extends TestCase
|
||||
$this->redirect = new Redirect($this->routerMock, $tokenStorage);
|
||||
}
|
||||
|
||||
public function testRedirectToNullWithFallback()
|
||||
{
|
||||
$redirectUrl = $this->redirect->to(null, 'fallback');
|
||||
|
||||
$this->assertSame('fallback', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testRedirectToNullWithoutFallback()
|
||||
public function testRedirectToNull()
|
||||
{
|
||||
$redirectUrl = $this->redirect->to(null);
|
||||
|
||||
$this->assertSame($this->routerMock->generate('homepage'), $redirectUrl);
|
||||
$this->assertSame('/', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testRedirectToValidUrl()
|
||||
@ -81,6 +74,13 @@ class RedirectTest extends TestCase
|
||||
$this->assertSame('/unread/list', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testRedirectToAbsoluteUrl()
|
||||
{
|
||||
$redirectUrl = $this->redirect->to('https://www.google.com/');
|
||||
|
||||
$this->assertSame('/', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testWithNotLoggedUser()
|
||||
{
|
||||
$redirect = new Redirect($this->routerMock, new TokenStorage());
|
||||
@ -95,24 +95,24 @@ class RedirectTest extends TestCase
|
||||
|
||||
$redirectUrl = $this->redirect->to('/unread/list');
|
||||
|
||||
$this->assertSame($this->routerMock->generate('homepage'), $redirectUrl);
|
||||
$this->assertSame('/', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testUserForRedirectWithIgnoreActionMarkAsRead()
|
||||
{
|
||||
$this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
|
||||
|
||||
$redirectUrl = $this->redirect->to('/unread/list', '', true);
|
||||
$redirectUrl = $this->redirect->to('/unread/list', true);
|
||||
|
||||
$this->assertSame('/unread/list', $redirectUrl);
|
||||
}
|
||||
|
||||
public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead()
|
||||
public function testUserForRedirectNullWithIgnoreActionMarkAsRead()
|
||||
{
|
||||
$this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
|
||||
|
||||
$redirectUrl = $this->redirect->to(null, 'fallback', true);
|
||||
$redirectUrl = $this->redirect->to(null, true);
|
||||
|
||||
$this->assertSame('fallback', $redirectUrl);
|
||||
$this->assertSame('/', $redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user