mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
If reload content failed, don’t update it
In case user wants a fresh version of the current one and the website isn’t available, don’t erase it with a boring message saying wallabag wasn’t able to refresh the content.
This commit is contained in:
parent
7180aaed45
commit
2297d60f10
6 changed files with 55 additions and 2 deletions
|
@ -359,11 +359,51 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$content = $em
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
->find($content->getId());
|
||||
|
||||
$this->assertNotEmpty($content->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testPostNewOk
|
||||
*
|
||||
* This test will require an internet connection.
|
||||
*/
|
||||
public function testReloadWithFetchingFailed()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
$content = $em
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
|
||||
// put a known failed url
|
||||
$content->setUrl('http://0.0.0.0/failed.html');
|
||||
$em->persist($content);
|
||||
$em->flush();
|
||||
|
||||
$client->request('GET', '/reload/'.$content->getId());
|
||||
|
||||
$this->assertEquals(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
// force EntityManager to clear previous entity
|
||||
// otherwise, retrieve the same entity will retrieve change from the previous request :0
|
||||
$em->clear();
|
||||
$newContent = $em
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->find($content->getId());
|
||||
|
||||
$newContent->setUrl($this->url);
|
||||
$em->persist($newContent);
|
||||
$em->flush();
|
||||
|
||||
$this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
|
||||
}
|
||||
|
||||
public function testEdit()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue