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

Upgrade to Symfony 4.4

- disable autowiring for Event (because the Entry entity was injected)
- rename `getClient()` for test to `getTestClient()` to avoid error while overriding (from `BrowserKitAssertionsTrait`)
This commit is contained in:
Jeremy Benoist 2022-11-23 17:09:32 +01:00
parent 655ec5e07a
commit aa5c7f05b8
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
43 changed files with 966 additions and 1239 deletions

View file

@ -39,7 +39,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testLogin()
{
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/new');
@ -53,7 +53,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testQuickstart()
{
$this->logInAs('empty');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/unread/list');
$this->assertSame(302, $client->getResponse()->getStatusCode());
@ -86,7 +86,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testGetNew()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -102,7 +102,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewViaBookmarklet()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/');
@ -127,7 +127,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewEmpty()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -148,7 +148,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewOk()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->getContainer()->get(Config::class)->set('store_article_headers', 1);
@ -187,7 +187,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewOkWithTaggingRules()
{
$this->logInAs('empty');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -224,7 +224,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
$url = 'https://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768';
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -262,7 +262,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->flush();
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -286,7 +286,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewOkUrlExistWithAccent()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$url = 'https://www.aritylabs.com/post/106091708292/des-contr%C3%B4leurs-optionnels-gr%C3%A2ce-%C3%A0-constmissing';
@ -324,7 +324,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewOkUrlExistWithRedirection()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$url = 'https://wllbg.org/test-redirect/c51c';
@ -362,7 +362,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewThatWillBeTagged()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -426,7 +426,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testArchive()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/archive/list');
@ -436,7 +436,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testUntagged()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/untagged/list');
@ -446,7 +446,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testStarred()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/starred/list');
@ -456,7 +456,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testWithAnnotations()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/annotated/list');
$this->assertSame(200, $client->getResponse()->getStatusCode());
@ -466,7 +466,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testRangeException()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/all/list/900');
@ -477,7 +477,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testView()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl('http://example.com/foo');
@ -499,7 +499,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testReload()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -523,7 +523,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testReloadWithFetchingFailed()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl('http://0.0.0.0/failed.html');
@ -547,7 +547,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testEdit()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -565,7 +565,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testEditUpdate()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -598,7 +598,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testEditRemoveOriginUrl()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -634,7 +634,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testToggleArchive()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -657,7 +657,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testToggleStar()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -680,7 +680,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testDelete()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -706,7 +706,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testViewAndDelete()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$em = $client->getContainer()
->get(EntityManagerInterface::class);
@ -742,7 +742,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testViewOtherUserEntry()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$content = $client->getContainer()
->get(EntityManagerInterface::class)
@ -757,7 +757,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnReadingTime()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
$entry->setReadingTime(22);
@ -781,7 +781,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnReadingTimeWithNegativeValue()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
@ -801,7 +801,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnReadingTimeOnlyUpper()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/all/list');
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
@ -829,7 +829,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnReadingTimeOnlyLower()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
@ -856,7 +856,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnUnreadStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/all/list');
@ -884,7 +884,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnCreationDate()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$em = $this->getEntityManager();
@ -933,7 +933,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnAnnotatedStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/all/list');
@ -950,7 +950,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
$em = $this->getClient()->getContainer()->get(EntityManagerInterface::class);
$em = $this->getTestClient()->getContainer()->get(EntityManagerInterface::class);
$user = $em
->getRepository(User::class)
->findOneByUserName('admin');
@ -971,7 +971,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPaginationWithFilter()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/config');
$form = $crawler->filter('button[id=config_save]')->form();
@ -1000,7 +1000,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnDomainName()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1032,7 +1032,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1054,7 +1054,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterPreselectedStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1078,7 +1078,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnIsPublic()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1091,7 +1091,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPreviewPictureFilter()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1104,7 +1104,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnLanguage()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -1133,7 +1133,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testShareEntryPublicly()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
// sharing is enabled
$client->getContainer()->get(Config::class)->set('share_public', 1);
@ -1159,11 +1159,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$client->request('GET', $shareUrl);
// @TODO: understand why public & max-age are override after the response is return in the controller
$this->assertSame(200, $client->getResponse()->getStatusCode());
$this->assertStringContainsString('max-age=25200', $client->getResponse()->headers->get('cache-control'));
$this->assertStringContainsString('public', $client->getResponse()->headers->get('cache-control'));
// $this->assertStringContainsString('max-age=25200', $client->getResponse()->headers->get('cache-control'));
// $this->assertStringContainsString('public', $client->getResponse()->headers->get('cache-control'));
$this->assertStringContainsString('s-maxage=25200', $client->getResponse()->headers->get('cache-control'));
$this->assertStringNotContainsString('no-cache', $client->getResponse()->headers->get('cache-control'));
// $this->assertStringNotContainsString('no-cache', $client->getResponse()->headers->get('cache-control'));
$this->assertStringContainsString('og:title', $client->getResponse()->getContent());
$this->assertStringContainsString('og:type', $client->getResponse()->getContent());
$this->assertStringContainsString('og:url', $client->getResponse()->getContent());
@ -1190,7 +1191,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
$this->downloadImagesEnabled = true;
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
$client->getContainer()->get(Config::class)->set('download_images_enabled', 1);
@ -1232,7 +1233,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
$this->downloadImagesEnabled = true;
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
$client->getContainer()->get(Config::class)->set('download_images_enabled', 1);
@ -1266,7 +1267,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testRedirectToHomepage()
{
$this->logInAs('empty');
$client = $this->getClient();
$client = $this->getTestClient();
// Redirect to homepage
$config = $this->getLoggedInUser()->getConfig();
@ -1289,7 +1290,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testRedirectToCurrentPage()
{
$this->logInAs('empty');
$client = $this->getClient();
$client = $this->getTestClient();
// Redirect to current page
$config = $this->getLoggedInUser()->getConfig();
@ -1312,7 +1313,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnHttpStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl('https://www.lemonde.fr/incorrect-url/');
@ -1370,7 +1371,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testSearch()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -1514,7 +1515,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testLanguageValidation($url, $expectedLanguage)
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/new');
@ -1547,7 +1548,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
$url = 'https://www.monde-diplomatique.fr/2017/05/BONNET/57476';
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$em = $client->getContainer()->get(EntityManagerInterface::class);
// enable restricted access
@ -1596,7 +1597,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
$url = 'http://example.com/papers/email_tracking.pdf';
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$container = $client->getContainer();
$contentProxy = $this->getMockBuilder(ContentProxy::class)
@ -1643,7 +1644,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testEntryDeleteTagLink()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$em = $client->getContainer()->get(EntityManagerInterface::class);
$entry = $em->getRepository(Entry::class)->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
@ -1662,7 +1663,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testRandom()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$client->request('GET', '/unread/random');
$this->assertSame(302, $client->getResponse()->getStatusCode());
@ -1692,7 +1693,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testMass()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$entry1 = new Entry($this->getLoggedInUser());
$entry1->setUrl($this->url);
@ -1803,7 +1804,7 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testGetSameDomainEntries()
{
$this->logInAs('admin');
$client = $this->getClient();
$client = $this->getTestClient();
$crawler = $client->request('GET', '/domain/1');
$this->assertSame(200, $client->getResponse()->getStatusCode());