Fix tests

This commit is contained in:
Jeremy Benoist 2018-06-06 17:34:20 +02:00
parent def73759ae
commit 778543311f
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
9 changed files with 30 additions and 32 deletions

View file

@ -12,7 +12,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\UserBundle\Entity\User;

View file

@ -419,7 +419,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testPostEntry()
{
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'tags' => 'google',
'title' => 'New title for my article',
'content' => 'my content',
@ -434,7 +434,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame(0, $content['is_archived']);
$this->assertSame(0, $content['is_starred']);
$this->assertNull($content['starred_at']);
@ -455,7 +455,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
{
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$entry = new Entry($em->getReference(User::class, 1));
$entry->setUrl('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html');
$entry->setUrl('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html');
$entry->setArchived(true);
$entry->addTag((new Tag())->setLabel('google'));
$entry->addTag((new Tag())->setLabel('apple'));
@ -464,7 +464,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$em->clear();
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'archive' => '1',
'tags' => 'google, apple',
]);
@ -474,7 +474,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame(1, $content['is_archived']);
$this->assertSame(0, $content['is_starred']);
$this->assertCount(3, $content['tags']);
@ -519,7 +519,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
{
$now = new \DateTime();
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'archive' => '1',
'starred' => '1',
]);
@ -529,7 +529,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
$this->assertSame(1, $content['is_archived']);
$this->assertSame(1, $content['is_starred']);
$this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
@ -539,7 +539,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testPostArchivedAndStarredEntryWithoutQuotes()
{
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'archive' => 0,
'starred' => 1,
]);
@ -549,7 +549,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
$this->assertSame(0, $content['is_archived']);
$this->assertSame(1, $content['is_starred']);
}
@ -557,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testPostEntryWithOriginUrl()
{
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'tags' => 'google',
'title' => 'New title for my article',
'content' => 'my content',
@ -573,7 +573,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
$this->assertSame('http://mysource.tld', $content['origin_url']);
}
@ -1013,7 +1013,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testReloadEntry()
{
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
'archive' => '1',
'tags' => 'google, apple',
]);
@ -1117,7 +1117,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testPostEntriesListAction()
{
$list = [
'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
'https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
'http://0.0.0.0/entry2',
];
@ -1128,7 +1128,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertInternalType('int', $content[0]['entry']);
$this->assertSame('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']);
$this->assertSame('https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']);
$this->assertInternalType('int', $content[1]['entry']);
$this->assertSame('http://0.0.0.0/entry2', $content[1]['url']);
@ -1209,14 +1209,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
$entry = new Entry($em->getReference(User::class, 1));
$entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
$entry->setContent('hihi');
$entry->setUrl('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html');
$entry->setUrl('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html');
$entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200'));
$em->persist($entry);
$em->flush();
$em->clear();
$this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html',
'url' => 'https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html',
]);
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
@ -1224,6 +1224,6 @@ class EntryRestControllerTest extends WallabagApiTestCase
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertGreaterThan(0, $content['id']);
$this->assertSame('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']);
$this->assertSame('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']);
}
}

View file

@ -60,7 +60,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
public function testDuplicate()
{
$url = 'http://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
$url = 'https://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
$client = $this->getClient();
$em = $client->getContainer()->get('doctrine.orm.entity_manager');

View file

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\Entry;
class ReloadEntryCommandTest extends WallabagCoreTestCase
{
public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
public $url = 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
/**
* @var entry

View file

@ -742,7 +742,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$em->persist($tag);
$entry = new Entry($user);
$entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setContent('Youhou');
$entry->setTitle('Youhou');
$entry->addTag($tag);
@ -827,7 +827,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$em->persist($tag);
$entry = new Entry($user);
$entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setContent('Youhou');
$entry->setTitle('Youhou');
$entry->addTag($tag);
@ -845,7 +845,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$em->persist($tagArchived);
$entryArchived = new Entry($user);
$entryArchived->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entryArchived->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entryArchived->setContent('Youhou');
$entryArchived->setTitle('Youhou');
$entryArchived->addTag($tagArchived);
@ -903,7 +903,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$em->persist($tag);
$entry = new Entry($user);
$entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
$entry->setContent('Youhou');
$entry->setTitle('Youhou');
$entry->addTag($tag);

View file

@ -11,9 +11,9 @@ use Wallabag\CoreBundle\Helper\ContentProxy;
class EntryControllerTest extends WallabagCoreTestCase
{
const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'http://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html';
const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'https://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html';
public $downloadImagesEnabled = false;
public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
public $url = 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
/**
* @after
@ -1143,7 +1143,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$client = $this->getClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl('http://www.lemonde.fr/incorrect-url/');
$entry->setUrl('https://www.lemonde.fr/incorrect-url/');
$entry->setHttpStatus(404);
$this->getEntityManager()->persist($entry);
@ -1342,8 +1342,8 @@ class EntryControllerTest extends WallabagCoreTestCase
null,
],
'es-ES' => [
'https://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google/',
'es_ES',
'https://www.20minutos.es/noticia/3360685/0/gobierno-sanchez-primero-historia-mas-mujeres-que-hombres/',
'es',
],
];
}

View file

@ -11,7 +11,6 @@ use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Validator\RecursiveValidator;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\UserBundle\Entity\User;

View file

@ -129,7 +129,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findByUrlAndUserId(
'https://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe',
'https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe',
$this->getLoggedInUserId()
);

View file

@ -2,4 +2,4 @@ URL,Title,Selection,Folder
http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,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-dis-donc-donald-trump-quoi-exactement-covfefe,"Dis donc Donald Trump, c'est quoi exactement «covfefe»?",,test_tag
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 http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551 Baumettes : un tour en cellule 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-dis-donc-donald-trump-quoi-exactement-covfefe 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