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

Add isNotParsed field on Entry entity

Fix #4350
This commit is contained in:
Nicolas Lœuillet 2023-07-28 14:58:43 +02:00 committed by Nicolas Lœuillet
parent 85065b509f
commit 20578f0b8e
16 changed files with 299 additions and 6 deletions

View file

@ -21,6 +21,16 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
*/
public $bobEntry;
/**
* @var Entry
*/
public $bobParsedEntry;
/**
* @var Entry
*/
public $bobNotParsedEntry;
protected function setUp(): void
{
parent::setUp();
@ -41,6 +51,19 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
$this->bobEntry->setContent('');
$this->getEntityManager()->persist($this->bobEntry);
$this->bobParsedEntry = new Entry($user);
$this->bobParsedEntry->setUrl($this->url);
$this->bobParsedEntry->setTitle('title foo');
$this->bobParsedEntry->setContent('');
$this->getEntityManager()->persist($this->bobParsedEntry);
$this->bobNotParsedEntry = new Entry($user);
$this->bobNotParsedEntry->setUrl($this->url);
$this->bobNotParsedEntry->setTitle('title foo');
$this->bobNotParsedEntry->setContent('');
$this->bobNotParsedEntry->setNotParsed(true);
$this->getEntityManager()->persist($this->bobNotParsedEntry);
$this->getEntityManager()->flush();
}
@ -95,6 +118,27 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
$this->assertStringContainsString('Done', $tester->getDisplay());
}
public function testRunReloadEntryWithNotParsedOption()
{
$application = new Application($this->getTestClient()->getKernel());
$command = $application->find('wallabag:entry:reload');
$tester = new CommandTester($command);
$tester->execute([
'--only-not-parsed' => true,
]);
$entryRepository = $this->getTestClient()->getContainer()->get('wallabag_core.entry_repository.test');
$reloadedBobParsedEntry = $entryRepository->find($this->bobParsedEntry->getId());
$this->assertEmpty($reloadedBobParsedEntry->getContent());
$reloadedBobNotParsedEntry = $entryRepository->find($this->bobNotParsedEntry->getId());
$this->assertNotEmpty($reloadedBobNotParsedEntry->getContent());
$this->assertStringContainsString('Done', $tester->getDisplay());
}
public function testRunReloadEntryWithoutEntryCommand()
{
$application = new Application($this->getTestClient()->getKernel());