From: Nicolas Lœuillet Date: Wed, 31 May 2017 09:48:42 +0000 (+0200) Subject: Merge pull request #3138 from Kdecherf/2835-tags X-Git-Tag: 2.3.0~31^2~81 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=d61fd8be4ffdbba8d0fd02468075602a26dfde1a;hp=31485bddb98a2a1b434e62e02ffd79614eca9db8;p=github%2Fwallabag%2Fwallabag.git Merge pull request #3138 from Kdecherf/2835-tags Ignore ActionMarkAsRead when removing tag from entry --- diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 08a67c34..9a7dd4e7 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -550,7 +550,7 @@ class Entry } /** - * @return ArrayCollection + * @return ArrayCollection */ public function getTags() { @@ -685,7 +685,7 @@ class Entry } /** - * @return int + * @return string */ public function getHttpStatus() { @@ -693,7 +693,7 @@ class Entry } /** - * @param int $httpStatus + * @param string $httpStatus * * @return Entry */ diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index c712bb26..1c56fa9f 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -5,7 +5,6 @@ namespace Wallabag\CoreBundle\GuzzleSiteAuthenticator; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; -use OutOfRangeException; use Psr\Log\LoggerInterface; class GrabySiteConfigBuilder implements SiteConfigBuilder @@ -38,13 +37,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder } /** - * Builds the SiteConfig for a host. - * - * @param string $host The "www." prefix is ignored - * - * @return SiteConfig - * - * @throws OutOfRangeException If there is no config for $host + * {@inheritdoc} */ public function buildForHost($host) { diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php index add27db2..509d0dec 100644 --- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php +++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php @@ -15,6 +15,7 @@ class RuleBasedTagger private $rulerz; private $tagRepository; private $entryRepository; + private $logger; public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository, LoggerInterface $logger) { diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php index d2a89d79..3e085ecf 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php @@ -36,8 +36,8 @@ class WallabagV2Import extends WallabagImport return [ 'html' => $entry['content'], 'content_type' => $entry['mimetype'], - 'is_archived' => (int) ($entry['is_archived'] || $this->markAsRead), - 'is_starred' => false, + 'is_archived' => (bool) ($entry['is_archived'] || $this->markAsRead), + 'is_starred' => (bool) $entry['is_starred'], ] + $entry; } diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index 122a87d4..71c2ffc6 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -67,18 +67,14 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - $question->expects($this->any()) - ->method('ask') - ->will($this->returnValue('yes_'.uniqid('', true))); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); + $tester->setInputs([ + 'y', // dropping database + 'y', // create super admin + 'username_'.uniqid('', true), // username + 'password_'.uniqid('', true), // password + 'email_'.uniqid('', true).'@wallabag.it', // email + ]); $tester->execute([ 'command' => $command->getName(), ]); @@ -97,18 +93,13 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - $question->expects($this->any()) - ->method('ask') - ->will($this->returnValue('yes_'.uniqid('', true))); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); + $tester->setInputs([ + 'y', // create super admin + 'username_'.uniqid('', true), // username + 'password_'.uniqid('', true), // password + 'email_'.uniqid('', true).'@wallabag.it', // email + ]); $tester->execute([ 'command' => $command->getName(), '--reset' => true, @@ -150,18 +141,13 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - $question->expects($this->any()) - ->method('ask') - ->will($this->returnValue('yes_'.uniqid('', true))); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); + $tester->setInputs([ + 'y', // create super admin + 'username_'.uniqid('', true), // username + 'password_'.uniqid('', true), // password + 'email_'.uniqid('', true).'@wallabag.it', // email + ]); $tester->execute([ 'command' => $command->getName(), ]); @@ -183,23 +169,12 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - - $question->expects($this->exactly(3)) - ->method('ask') - ->will($this->onConsecutiveCalls( - false, // don't want to reset the entire database - true, // do want to reset the schema - false // don't want to create a new user - )); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); + $tester->setInputs([ + 'n', // don't want to reset the entire database + 'y', // do want to reset the schema + 'n', // don't want to create a new user + ]); $tester->execute([ 'command' => $command->getName(), ]); @@ -239,22 +214,11 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - - $question->expects($this->exactly(2)) - ->method('ask') - ->will($this->onConsecutiveCalls( - false, // don't want to reset the entire database - false // don't want to create a new user - )); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); + $tester->setInputs([ + 'n', // don't want to reset the entire database + 'n', // don't want to create a new user + ]); $tester->execute([ 'command' => $command->getName(), ]); @@ -275,21 +239,11 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the QuestionHelper - $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') - ->disableOriginalConstructor() - ->getMock(); - $question->expects($this->any()) - ->method('ask') - ->will($this->returnValue('yes_'.uniqid('', true))); - - // We override the standard helper with our mock - $command->getHelperSet()->set($question, 'question'); - $tester = new CommandTester($command); $tester->execute([ 'command' => $command->getName(), - '--no-interaction' => true, + ], [ + 'interactive' => false, ]); $this->assertContains('Checking system requirements.', $tester->getDisplay()); diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index 556ab1bd..335115fe 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php @@ -138,6 +138,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $this->assertEquals(3, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); + $this->assertTrue($content->isStarred(), 'Entry is starred'); } public function testImportWallabagWithEmptyFile() diff --git a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json index efa8faf2..1bdff7f5 100644 --- a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json +++ b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json @@ -6,7 +6,7 @@ "is_archived": false, "created_at": "2016-09-08T11:55:58+0200", "updated_at": "2016-09-08T11:57:16+0200", - "is_starred": false, + "is_starred": true, "content": "
Édition CAMédia\n

Deux nouvelles éditions pour débattre dans le club sur la laïcité et sur la démocratie

\n

18 janv. 2016 | Par

\n

CAMédia après un échange sur « l'éthique du débat » a lancé deux discussions , l'une sur le thème de la laïcité, l'autre ( encore en cours) sur celui de la démocratie. Nous sommes heureux de pouvoir signaler la création de deux nouvelles éditions participatives sur ces thèmes. Nous vous invitons à les lire et à participer à leurs débats.

\n
\n

De l'importance de rêver, éloge du merveilleux

\n

17 janv. 2016 | Par

\n

Je parlerai ici des rêves comme moteur de vie, de ces rêves qui vous rattachent et vous font espérer à ce qu’il y a de plus humain dans l’homme, même au milieu de la plus noire des détresses.

\n
\n

Fin(s) d'une toute-puissance

\n

18 janv. 2016 | Par

\n

En ce début d’année, je recommande la lecture du dernier ouvrage de Guillaume Duval, La France ne sera jamais plus une grande puissance ? Tant mieux !

\n
\n

L’Allier, département de destruction massive du tissu culturel

\n

18 janv. 2016 | Par

\n

Les temps sont durs pour les petites structures, les associations culturelles qui, de bourgades en villages, travaillent au cœur des régions. Leurs subventions sont souvent revues à la baisse. Le département de l’Allier les a carrément supprimées. Pour favoriser « l’événementiel ».

\n
Édition Les invités de Mediapart\n

La démocratie déjà attaquée par la coopération réglementaire transatlantique

\n

18 janv. 2016 | Par

\n

Lora Verheecke et David Lundy travaillent pour Corporate Europe Observatory, une ONG basée à Bruxelles qui enquête sur le pouvoir des lobbies des grandes entreprises sur la politique de l’Union européenne. Ils révèlent que depuis 25 ans le projet de « coopération réglementaire » mené par l’Union européenne et les États-Unis a été dominé par les grandes entreprises. ET que le TTIP cherche à entériner ce projet.

\n
\n

2016, une année test pour Jacob Zuma et son gouvernement

\n

18 janv. 2016 | Par

\n

Les turbulences de l’an passé ont toutes les chances de continuer à troubler le climat politique et social de l’Afrique du Sud en 2016. La situation exige des changements profonds dans la conduite des affaires du pays. Jacob Zuma tout en admettant la nécessité de ces changements, est-il l’homme de la situation ? Son gouvernement répondra-t-il aux attentes des citoyens sud-africains ?

\n
\n

Un mal fou (janvier 2016)

\n

14 janv. 2016 | Par

\n

J’ai une fringale d’aventure, d’aventures à venir. J’ai la fringale de la fringale des aventures et soudain, rupture. Je n’y arrive plus, tout est bloqué, tout empêché. Faut dire que depuis un an environ, tout est devenu plus compliqué. Ecrire va de moins en moins de soi.

\n
\n

Redoublement : le changement à bas bruit ?

\n

17 janv. 2016 | Par

\n

S’il est une caractéristique de la forme scolaire française bien établie dans la culture des personnels, des élèves et des parents, c’est bien le redoublement, censé sanctionner des résultats insuffisants pour envisager le passage dans la classe supérieure. Or, en ce domaine, l’évolution est nette.

\n
\n

Samedi-sciences (196): des chasseurs de mammouths en Arctique il y a 45 000 ans

\n

16 janv. 2016 | Par Michel de Pracontal

\n

Les restes d’un mammouth retrouvés en Arctique sibérien, datés de 45 000 ans, portent les traces de blessures infligées par des chasseurs humains. Les scientifiques pensaient jusqu’ici que notre espèce ne s’était pas aventurée dans cette région glaciale il y a plus de 30 000 ou 35 0000 ans. En réalité, des hommes ont réussi à survivre en Arctique au moins 10 000 ans plus tôt que l’on croyait.

\n
\n

De la démocratie, du citoyen et de l'éthique

\n

14 janv. 2016 | Par

\n

Trois ouvrages sont parus au Seuil, qui font état de la nécessité d’intégrer le citoyen dans la gouvernance de la nation. Non pas à titre consultatif mais doté d’un pouvoir délibératif pour constituer une contre-force face aux clans politico-financiers qui dominent la vie publique.

\n
", "mimetype": "text/html", "language": "fr",