Merge remote-tracking branch 'origin/master' into 2.5.0

This commit is contained in:
Jeremy Benoist
2022-03-02 20:03:33 +01:00
178 changed files with 7400 additions and 5225 deletions

View File

@ -207,8 +207,8 @@ class EntryControllerTest extends WallabagCoreTestCase
$authors = $content->getPublishedBy();
$this->assertSame('2017-04-05', $content->getPublishedAt()->format('Y-m-d'));
$this->assertSame('fr', $content->getLanguage());
$this->assertContains('Balenieri', $authors[0]);
$this->assertContains('Autran', $authors[1]);
$this->assertStringContainsString('Balenieri', $authors[0]);
$this->assertStringContainsString('Autran', $authors[1]);
}
public function testPostNewOkUrlExist()
@ -342,7 +342,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$entry = $em
->getRepository('WallabagCoreBundle:Entry')
->findOneByUrl($url);
$tags = $entry->getTags();
$tags = $entry->getTagsLabel();
$this->assertCount(2, $tags);
$this->assertContains('wallabag', $tags);
@ -372,7 +372,7 @@ class EntryControllerTest extends WallabagCoreTestCase
->getRepository('WallabagCoreBundle:Entry')
->findOneByUrl($url);
$tags = $entry->getTags();
$tags = $entry->getTagsLabel();
$this->assertCount(2, $tags);
$this->assertContains('wallabag', $tags);
@ -1387,7 +1387,7 @@ class EntryControllerTest extends WallabagCoreTestCase
{
return [
'ru' => [
'https://www.vtimes.io/2020/12/14/ubiistvo-kotorogo-ne-bilo-a1981',
'https://ru.wikipedia.org/wiki/Открытое_программное_обеспечение',
'ru',
],
'fr' => [
@ -1410,10 +1410,6 @@ class EntryControllerTest extends WallabagCoreTestCase
'https://politica.estadao.com.br/noticias/eleicoes,campanha-catatonica,70002491983',
'pt_BR',
],
'fucked_list_of_languages' => [
'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home',
null,
],
'es-ES' => [
'https://www.20minutos.es/noticia/3360685/0/gobierno-sanchez-primero-historia-mas-mujeres-que-hombres/',
'es_ES',

View File

@ -46,7 +46,7 @@ class TagControllerTest extends WallabagCoreTestCase
// be sure to reload the entry
$entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
$this->assertCount(1, $entry->getTags());
$this->assertContains($this->tagName, $entry->getTags());
$this->assertContains($this->tagName, $entry->getTagsLabel());
// tag already exists and already assigned
$client->submit($form, $data);
@ -127,7 +127,7 @@ class TagControllerTest extends WallabagCoreTestCase
// re-retrieve the entry to be sure to get fresh data from database (mostly for tags)
$entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
$this->assertNotContains($this->tagName, $entry->getTags());
$this->assertNotContains($this->tagName, $entry->getTagsLabel());
$client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId());
@ -195,7 +195,7 @@ class TagControllerTest extends WallabagCoreTestCase
$entry2 = new Entry($this->getLoggedInUser());
$entry2->setUrl('http://0.0.0.0/bar');
$entry2->addTag($tag);
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->persist($entry2);
$this->getEntityManager()->flush();
$this->getEntityManager()->clear();

View File

@ -31,7 +31,6 @@ class DownloadImagesTest extends TestCase
public function testProcessHtml($html, $url)
{
$httpMockClient = new HttpMockClient();
$httpMockClient->addResponse(new Response(200, ['content-type' => 'image/png'], file_get_contents(__DIR__ . '/../fixtures/unnamed.png')));
$logHandler = new TestHandler();
@ -201,4 +200,23 @@ class DownloadImagesTest extends TestCase
);
$this->assertFalse($res);
}
public function testEnsureOnlyFirstOccurenceIsReplaced()
{
$httpMockClient = new HttpMockClient();
$httpMockClient->addResponse(new Response(200, ['content-type' => 'image/png'], file_get_contents(__DIR__ . '/../fixtures/unnamed.png')));
$httpMockClient->addResponse(new Response(200, ['content-type' => 'image/png'], file_get_contents(__DIR__ . '/../fixtures/unnamed.png')));
$logHandler = new TestHandler();
$logger = new Logger('test', [$logHandler]);
$download = new DownloadImages($httpMockClient, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger);
$html = '<img src="https://images.wsj.net/im-410981?width=860&height=573" srcset="https://images.wsj.net/im-410981?width=860&height=573&pixel_ratio=1.5 1290w" height="573" width="860" alt="" referrerpolicy="no-referrer">';
$url = 'https://www.wsj.com/articles/5-interior-design-tips-to-max-out-your-basement-space-11633435201';
$res = $download->processHtml(123, $html, $url);
$this->assertSame('<img src="http://wallabag.io/assets/images/9/b/9b0ead26/6bef06fe.png" srcset="http://wallabag.io/assets/images/9/b/9b0ead26/43cc0123.png 1290w" height="573" width="860" alt="" referrerpolicy="no-referrer">', $res);
}
}

View File

@ -139,6 +139,37 @@ class RuleBasedTaggerTest extends TestCase
$this->assertCount(1, $records);
}
public function testWithMixedCaseTag()
{
$taggingRule = $this->getTaggingRule('rule as string', ['Foo']);
$user = $this->getUser([$taggingRule]);
$entry = new Entry($user);
$tag = new Tag();
$this->rulerz
->expects($this->once())
->method('satisfies')
->with($entry, 'rule as string')
->willReturn(true);
$this->tagRepository
->expects($this->once())
// the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method
// to magically call the `findOneBy` with ['label' => 'foo']
->method('__call')
->with('findOneByLabel', ['foo'])
->willReturn($tag);
$this->tagger->tag($entry);
$this->assertFalse($entry->getTags()->isEmpty());
$tags = $entry->getTags();
$this->assertSame($tag, $tags[0]);
$records = $this->handler->getRecords();
$this->assertCount(1, $records);
}
public function testSameTagWithDifferentfMatchingRules()
{
$taggingRule = $this->getTaggingRule('bla bla', ['hey']);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 KiB

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -121,11 +121,11 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
$this->assertSame('Qualité de code - Intégration de php-git-hooks dans Symfony2 - Choosit - Experts en transformation digitale', $content->getTitle());
$this->assertStringContainsString('Qualité de code - Intégration de php-git-hooks dans Symfony2', $content->getTitle());
$this->assertSame('2015-09-09', $content->getCreatedAt()->format('Y-m-d'));
$this->assertTrue($content->isStarred(), 'Entry is starred');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('tag1', $tags, 'It includes the "tag1" tag');
$this->assertContains('tag2', $tags, 'It includes the "tag2" tag');
}

View File

@ -114,7 +114,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findByUrlAndUserId(
'https://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551',
'https://www.liberation.fr/societe/police-justice/cours-dassises-on-efface-le-peuple-dun-processus-judiciaire-dont-il-est-pourtant-le-coeur-battant-20210414_FYUNIZENHRGHZLAZEKSMKZYEPI/',
$this->getLoggedInUserId()
);
@ -123,7 +123,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.liberation.fr is ok');
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is ok');
$this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
$this->assertContains('foot', $content->getTagsLabel(), 'It includes the "foot" tag');
$this->assertCount(1, $content->getTags());
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
@ -135,8 +135,8 @@ class InstapaperControllerTest extends WallabagCoreTestCase
$this->getLoggedInUserId()
);
$this->assertContains('foot', $content->getTags());
$this->assertContains('test_tag', $content->getTags());
$this->assertContains('foot', $content->getTagsLabel());
$this->assertContains('test_tag', $content->getTagsLabel());
$this->assertCount(2, $content->getTags());
}

View File

@ -123,7 +123,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
$this->assertContains('php', $tags, 'It includes the "php" tag');

View File

@ -123,7 +123,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.20minutes.fr is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.20minutes.fr is ok');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertCount(1, $tags);

View File

@ -124,7 +124,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$this->assertSame($content->getPreviewPicture(), 'http://www.framablog.org/public/_img/framablog/wallaby_baby.jpg');
$this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is empty');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('framabag', $tags, 'It includes the "framabag" tag');
$this->assertCount(2, $tags);

View File

@ -126,7 +126,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$this->assertEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is empty');
$this->assertEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is empty');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertCount(1, $tags);
@ -143,7 +143,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok');
$tags = $content->getTags();
$tags = $content->getTagsLabel();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
$this->assertContains('blog', $tags, 'It includes the "blog" tag');

View File

@ -1,5 +1,5 @@
URL,Title,Selection,Folder
https://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,Unread
https://www.liberation.fr/societe/police-justice/cours-dassises-on-efface-le-peuple-dun-processus-judiciaire-dont-il-est-pourtant-le-coeur-battant-20210414_FYUNIZENHRGHZLAZEKSMKZYEPI/,Cours dassises : «On efface le peuple dun processus judiciaire dont il est pourtant le cœur battant»,,Unread
https://redditblog.com/2016/09/20/amp-and-reactredux/,AMP and React+Redux: Why Not?,,Archive
https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c,Why Foursquare / Swarm is still my favourite social network,,Starred
https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe,"Dis donc Donald Trump, c'est quoi exactement «covfefe»?",,test_tag

1 URL Title Selection Folder
2 https://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551 https://www.liberation.fr/societe/police-justice/cours-dassises-on-efface-le-peuple-dun-processus-judiciaire-dont-il-est-pourtant-le-coeur-battant-20210414_FYUNIZENHRGHZLAZEKSMKZYEPI/ Baumettes : un tour en cellule Cours d’assises : «On efface le peuple d’un processus judiciaire dont il est pourtant le cœur battant» Unread
3 https://redditblog.com/2016/09/20/amp-and-reactredux/ AMP and React+Redux: Why Not? Archive
4 https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c Why Foursquare / Swarm is still my favourite social network Starred
5 https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe Dis donc Donald Trump, c'est quoi exactement «covfefe»? test_tag

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -65,7 +65,7 @@ class ManageControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect();
// Check the user has been delete on the list
$this->assertNotRegExp('/Foo User/', $client->getResponse()->getContent());
$this->assertDoesNotMatchRegularExpression('/Foo User/', $client->getResponse()->getContent());
}
public function testDeleteDisabledForLoggedUser()