forked from wallabag/wallabag
Merge remote-tracking branch 'origin/master' into 2.5.0
This commit is contained in:
@ -15,6 +15,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
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 = 'https://www.lemonde.fr/pixels/article/2019/06/18/ce-qu-il-faut-savoir-sur-le-libra-la-cryptomonnaie-de-facebook_5477887_4408996.html';
|
||||
private $entryDataTestAttribute = '[data-test="entry"]';
|
||||
|
||||
/**
|
||||
* @after
|
||||
@ -101,14 +102,14 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->request('GET', '/');
|
||||
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
// Good URL
|
||||
$client->request('GET', '/bookmarklet', ['url' => $this->url]);
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$client->followRedirect();
|
||||
$crawler = $client->request('GET', '/');
|
||||
$this->assertCount(5, $crawler->filter('li.entry'));
|
||||
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
@ -176,6 +177,42 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$client->getContainer()->get('craue_config')->set('store_article_headers', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group NetworkCalls
|
||||
*/
|
||||
public function testPostNewOkWithTaggingRules()
|
||||
{
|
||||
$this->logInAs('empty');
|
||||
$client = $this->getClient();
|
||||
|
||||
$crawler = $client->request('GET', '/new');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$form = $crawler->filter('form[name=entry]')->form();
|
||||
|
||||
$data = [
|
||||
'entry[url]' => $this->url,
|
||||
];
|
||||
|
||||
$client->submit($form, $data);
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
|
||||
$tags = $content->getTagsLabel();
|
||||
|
||||
/*
|
||||
* Without the custom reading speed of `empty` user, it'll be inversed
|
||||
*/
|
||||
$this->assertContains('longread', $tags);
|
||||
$this->assertNotContains('shortread', $tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group NetworkCalls
|
||||
*/
|
||||
@ -734,7 +771,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnReadingTimeWithNegativeValue()
|
||||
@ -754,7 +791,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
// forcing negative value results in no entry displayed
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnReadingTimeOnlyUpper()
|
||||
@ -763,7 +800,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$client = $this->getClient();
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$this->assertCount(5, $crawler->filter('li.entry'));
|
||||
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl($this->url);
|
||||
@ -772,7 +809,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$this->assertCount(6, $crawler->filter('li.entry'));
|
||||
$this->assertCount(6, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
|
||||
@ -782,7 +819,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(5, $crawler->filter('li.entry'));
|
||||
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnReadingTimeOnlyLower()
|
||||
@ -800,7 +837,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl($this->url);
|
||||
@ -809,7 +846,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnUnreadStatus()
|
||||
@ -827,7 +864,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl($this->url);
|
||||
@ -837,7 +874,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(5, $crawler->filter('li.entry'));
|
||||
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnCreationDate()
|
||||
@ -868,7 +905,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$data = [
|
||||
'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'),
|
||||
@ -877,7 +914,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$data = [
|
||||
'entry_filter[createdAt][left_date]' => '1970-01-01',
|
||||
@ -886,7 +923,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnAnnotatedStatus()
|
||||
@ -968,7 +1005,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
];
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$crawler = $client->request('GET', '/unread/list');
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
@ -977,7 +1014,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
];
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
$data = [
|
||||
@ -985,7 +1022,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
];
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnStatus()
|
||||
@ -1000,14 +1037,14 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$form['entry_filter[isUnread]']->untick();
|
||||
|
||||
$crawler = $client->submit($form);
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
$form['entry_filter[isArchived]']->untick();
|
||||
$form['entry_filter[isStarred]']->tick();
|
||||
|
||||
$crawler = $client->submit($form);
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterPreselectedStatus()
|
||||
@ -1044,7 +1081,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$form['entry_filter[isPublic]']->tick();
|
||||
|
||||
$crawler = $client->submit($form);
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testPreviewPictureFilter()
|
||||
@ -1057,7 +1094,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
$form['entry_filter[previewPicture]']->tick();
|
||||
|
||||
$crawler = $client->submit($form);
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testFilterOnLanguage()
|
||||
@ -1078,7 +1115,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
];
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(3, $crawler->filter('li.entry'));
|
||||
$this->assertCount(3, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
$data = [
|
||||
@ -1086,7 +1123,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
];
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$this->assertCount(2, $crawler->filter('li.entry'));
|
||||
$this->assertCount(2, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testShareEntryPublicly()
|
||||
@ -1289,7 +1326,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl($this->url);
|
||||
@ -1312,7 +1349,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(2, $crawler->filter('li.entry'));
|
||||
$this->assertCount(2, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$form = $crawler->filter('button[id=submit-filter]')->form();
|
||||
@ -1323,7 +1360,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(8, $crawler->filter('li.entry'));
|
||||
$this->assertCount(8, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function testSearch()
|
||||
@ -1347,7 +1384,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
// Search on starred list
|
||||
$crawler = $client->request('GET', '/starred/list');
|
||||
@ -1366,7 +1403,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$crawler = $client->request('GET', '/archive/list');
|
||||
|
||||
@ -1385,7 +1422,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
$client->request('GET', '/delete/' . $entry->getId());
|
||||
|
||||
// test on list of all articles
|
||||
@ -1398,7 +1435,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(0, $crawler->filter('li.entry'));
|
||||
$this->assertCount(0, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
// test url search on list of all articles
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
@ -1417,7 +1454,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
// same as previous test but for case-sensitivity
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
@ -1429,7 +1466,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter('li.entry'));
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
}
|
||||
|
||||
public function dataForLanguage()
|
||||
|
||||
Reference in New Issue
Block a user