From bca5485946a72942c76dbb65c29e40818dca4976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Mar 2016 16:44:25 +0100 Subject: [PATCH 1/7] Added setting to have a personal reading time --- app/config/config.yml | 1 + data/db/wallabag_test.sqlite-journal | Bin 0 -> 7736 bytes .../CoreBundle/Command/InstallCommand.php | 1 + .../DependencyInjection/Configuration.php | 3 ++ .../WallabagCoreExtension.php | 1 + src/Wallabag/CoreBundle/Entity/Config.php | 31 ++++++++++++++++++ .../CoreBundle/Form/Type/ConfigType.php | 8 +++++ .../themes/material/Config/index.html.twig | 8 +++++ .../themes/material/Entry/entries.html.twig | 5 +-- 9 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 data/db/wallabag_test.sqlite-journal diff --git a/app/config/config.yml b/app/config/config.yml index f0885d9d1..5265be8af 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -44,6 +44,7 @@ wallabag_core: theme: material language: en rss_limit: 50 + reading_speed: 1 wallabag_import: allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain'] diff --git a/data/db/wallabag_test.sqlite-journal b/data/db/wallabag_test.sqlite-journal new file mode 100644 index 0000000000000000000000000000000000000000..153aa1871eda7b25ac07f1d158072b88be1ce8f2 GIT binary patch literal 7736 zcmeI1U2oe|7{~3Ht}E}bL0LD(A#AiE3-e1}oK)53Bu*FQt#OiW;l^@pw>5R_Vml-m znnbzaim$;vUw}`+4L4jMAwB{(lPaE*rEN@;bd`oQb$;TXUHdsc=Q)2LpYvEHh!ZQh z`Y&)6BZv?jUORCFe_dn+=H7zdk;JbAY_L1OeSiL2Ufdl&-d~zuTwW%By5}idrruLb zQ`u5>oFirtYF#xt1N1NQFRk%QF%-XGWaXmkct&S zYNL|ahG8Fxl-!+r@IsP}dfD)Fv~A|A$BtnPO0rmtIDDdhia6nw2Ura5N2X_ri)BCMzu`VXh2Vu?$(L|C}<;v+QiHdL#gPCSot%#-{t^5n*|2qLE=5a@h5S;!WA5!^mAf}`6e zMlj4x$C`(E;1HfSUgNQS4&e3w4)6tlXA26zABhoQ1;9DM+rT`4^MW^lH-H7;GJt2D zMc_l=1Kc1zt`Cet1M)BXVF1rGqu%GX4l1z>eeKdvwNH_rhIY z_jxX1^faEP<23KmJ>KQrogPoSd%d`A@0x0Kpjln6X*=HI=59^eY N6HiRI1o^;U{{kod?Wq6& literal 0 HcmV?d00001 diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index e97ba46ad..c9dad0df7 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -222,6 +222,7 @@ class InstallCommand extends ContainerAwareCommand $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit')); + $config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed')); $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language')); $em->persist($config); diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index bc405fdca..5f3c889bd 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -29,6 +29,9 @@ class Configuration implements ConfigurationInterface ->integerNode('rss_limit') ->defaultValue(50) ->end() + ->integerNode('reading_speed') + ->defaultValue(200) + ->end() ->scalarNode('version') ->end() ->scalarNode('paypal_url') diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index 9b4703e43..84599f0d7 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php @@ -19,6 +19,7 @@ class WallabagCoreExtension extends Extension $container->setParameter('wallabag_core.theme', $config['theme']); $container->setParameter('wallabag_core.language', $config['language']); $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']); + $container->setParameter('wallabag_core.reading_speed', $config['reading_speed']); $container->setParameter('wallabag_core.version', $config['version']); $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']); diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index d3590f35f..e1a2090e5 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -73,6 +73,13 @@ class Config */ private $rssLimit; + /** + * @var float + * + * @ORM\Column(name="reading_speed", type="float", nullable=true) + */ + private $readingSpeed; + /** * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") */ @@ -247,6 +254,30 @@ class Config return $this->rssLimit; } + /** + * Set readingSpeed. + * + * @param int $readingSpeed + * + * @return Config + */ + public function setReadingSpeed($readingSpeed) + { + $this->readingSpeed = $readingSpeed; + + return $this; + } + + /** + * Get readingSpeed. + * + * @return int + */ + public function getReadingSpeed() + { + return $this->readingSpeed; + } + /** * @param TaggingRule $rule * diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index a139f2df0..1218a9331 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\RangeType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -35,6 +36,13 @@ class ConfigType extends AbstractType 'choices_as_values' => true, )) ->add('items_per_page') + ->add('reading_speed', RangeType::class, array( + 'attr' => array( + 'min' => 0.5, + 'max' => 2, + 'step' => 0.5, + ), + )) ->add('language', ChoiceType::class, array( 'choices' => array_flip($this->languages), 'choices_as_values' => true, diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index e388f2c88..31931ca2e 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig @@ -42,6 +42,14 @@ +
+
+ {{ form_label(form.config.reading_speed) }} + {{ form_errors(form.config.reading_speed) }} + {{ form_widget(form.config.reading_speed) }} +
+
+
{{ form_label(form.config.language) }} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index c3fd4d286..371992df4 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -50,8 +50,9 @@
- {% if entry.readingTime > 0 %} - {% trans with {'%readingTime%': entry.readingTime } %}estimated reading time: %readingTime% min{% endtrans %} + {% set readingTime = entry.readingTime / app.user.config.readingSpeed %} + {% if readingTime > 0 %} + {% trans with {'%readingTime%': readingTime } %}estimated reading time: %readingTime% min{% endtrans %} {% else %} {% trans with {'%inferior%': '<'} %}estimated reading time: %inferior% 1 min{% endtrans %} {% endif %} From 889c1cf328d50c032797a007ede313b1ab1b026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Mar 2016 16:48:30 +0100 Subject: [PATCH 2/7] Fixed fixtures for config --- src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php index 850849600..5a3764538 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php @@ -25,6 +25,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface $adminConfig->setTheme('material'); $adminConfig->setItemsPerPage(30); + $adminConfig->setReadingSpeed(1); $adminConfig->setLanguage('en'); $manager->persist($adminConfig); @@ -34,6 +35,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface $bobConfig = new Config($this->getReference('bob-user')); $bobConfig->setTheme('default'); $bobConfig->setItemsPerPage(10); + $bobConfig->setReadingSpeed(1); $bobConfig->setLanguage('fr'); $manager->persist($bobConfig); @@ -43,6 +45,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface $emptyConfig = new Config($this->getReference('empty-user')); $emptyConfig->setTheme('material'); $emptyConfig->setItemsPerPage(10); + $emptyConfig->setReadingSpeed(1); $emptyConfig->setLanguage('en'); $manager->persist($emptyConfig); From db1d4b1e19f58d332bb7d984344cd249eea767b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 10 Mar 2016 13:02:36 +0100 Subject: [PATCH 3/7] Fix default value and add baggy implementation --- .../CoreBundle/DependencyInjection/Configuration.php | 2 +- .../Resources/views/themes/baggy/Config/index.html.twig | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index 5f3c889bd..d1bb9820b 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface ->defaultValue(50) ->end() ->integerNode('reading_speed') - ->defaultValue(200) + ->defaultValue(1) ->end() ->scalarNode('version') ->end() diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index 6ac6decb9..3ed96ab18 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig @@ -24,6 +24,15 @@
+
+
+ {{ form_label(form.config.reading_speed) }} + {{ form_errors(form.config.reading_speed) }} + {{ form_widget(form.config.reading_speed) }} +
+
+ +
{{ form_label(form.config.language) }} From 37b371726be4b8e1fbdd7061196d814c2dd7e811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 10 Mar 2016 13:18:59 +0100 Subject: [PATCH 4/7] Translation and documentation --- docs/en/user/configuration.rst | 6 ++++++ docs/fr/user/configuration.rst | 6 ++++++ .../CoreBundle/Resources/translations/messages.fr.yml | 1 + 3 files changed, 13 insertions(+) diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst index 70d960ff0..415f6317f 100644 --- a/docs/en/user/configuration.rst +++ b/docs/en/user/configuration.rst @@ -21,6 +21,12 @@ Items per page You can change the number of articles displayed on each page. +Reading speed +~~~~~~~~~~~~~ + +wallabag calculates a reading time for each article. You can define here, thanks to the slider, if you are +a fast or a slow reader. wallabag will recalculate the reading time for each article. + Language ~~~~~~~~ diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst index ee5be0521..112d2d584 100644 --- a/docs/fr/user/configuration.rst +++ b/docs/fr/user/configuration.rst @@ -22,6 +22,12 @@ Nombre d'articles par page Vous pouvez définir le nombre d'articles affichés sur chaque page. +Vitesse de lecture +~~~~~~~~~~~~~~~~~~ + +wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à la jauge, si vous lisez plus +ou moins vite. wallabag recalculera la durée de lecture de chaque article. + Langue ~~~~~~ diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index b809f1ab8..f6ac34fd7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -38,6 +38,7 @@ RSS: 'RSS' Add a user: 'Créer un compte' Theme: 'Thème' Items per page: "Nombre d'articles par page" +Reading speed: "Vitesse de lecture" Language: 'Langue' Save: 'Enregistrer' RSS token: 'Jeton RSS' From 6432b9277ed5dcf269590e421bd0aac4ad66f09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 14 Mar 2016 13:49:47 +0100 Subject: [PATCH 5/7] Replace slider with select --- data/db/wallabag_test.sqlite-journal | Bin 7736 -> 0 bytes .../Controller/DeveloperController.php | 2 +- src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 12 ++++++------ .../Resources/translations/messages.fr.yml | 6 ++++++ .../views/themes/material/Config/index.html.twig | 1 + 5 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 data/db/wallabag_test.sqlite-journal diff --git a/data/db/wallabag_test.sqlite-journal b/data/db/wallabag_test.sqlite-journal deleted file mode 100644 index 153aa1871eda7b25ac07f1d158072b88be1ce8f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7736 zcmeI1U2oe|7{~3Ht}E}bL0LD(A#AiE3-e1}oK)53Bu*FQt#OiW;l^@pw>5R_Vml-m znnbzaim$;vUw}`+4L4jMAwB{(lPaE*rEN@;bd`oQb$;TXUHdsc=Q)2LpYvEHh!ZQh z`Y&)6BZv?jUORCFe_dn+=H7zdk;JbAY_L1OeSiL2Ufdl&-d~zuTwW%By5}idrruLb zQ`u5>oFirtYF#xt1N1NQFRk%QF%-XGWaXmkct&S zYNL|ahG8Fxl-!+r@IsP}dfD)Fv~A|A$BtnPO0rmtIDDdhia6nw2Ura5N2X_ri)BCMzu`VXh2Vu?$(L|C}<;v+QiHdL#gPCSot%#-{t^5n*|2qLE=5a@h5S;!WA5!^mAf}`6e zMlj4x$C`(E;1HfSUgNQS4&e3w4)6tlXA26zABhoQ1;9DM+rT`4^MW^lH-H7;GJt2D zMc_l=1Kc1zt`Cet1M)BXVF1rGqu%GX4l1z>eeKdvwNH_rhIY z_jxX1^faEP<23KmJ>KQrogPoSd%d`A@0x0Kpjln6X*=HI=59^eY N6HiRI1o^;U{{kod?Wq6& diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index f519bdbcc..e5cfd83c6 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -43,7 +43,7 @@ class DeveloperController extends Controller $clientForm->handleRequest($request); if ($clientForm->isValid()) { - $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password','refresh_token')); + $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password', 'refresh_token')); $em->persist($client); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 1218a9331..0a5ea6cc8 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -4,7 +4,6 @@ namespace Wallabag\CoreBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\RangeType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -36,11 +35,12 @@ class ConfigType extends AbstractType 'choices_as_values' => true, )) ->add('items_per_page') - ->add('reading_speed', RangeType::class, array( - 'attr' => array( - 'min' => 0.5, - 'max' => 2, - 'step' => 0.5, + ->add('reading_speed', ChoiceType::class, array( + 'choices' => array( + 'I read ~100 words per minute' => '0.5', + 'I read ~200 words per minute' => '1', + 'I read ~300 words per minute' => '1.5', + 'I read ~400 words per minute' => '2', ), )) ->add('language', ChoiceType::class, array( diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index f6ac34fd7..7c6ad07e8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -57,6 +57,12 @@ Repeat new password: 'Confirmez votre nouveau mot de passe' Username: "Nom d'utilisateur" Two factor authentication: "Double authentification" "Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion": "Activer l'authentification double-facteur veut dire que vous allez recevoir un code par email à chaque nouvelle connexion non approuvée." +"I read ~100 words per minute": "Je lis environ 100 mots par minute" +"I read ~200 words per minute": "Je lis environ 200 mots par minute" +"I read ~300 words per minute": "Je lis environ 300 mots par minute" +"I read ~400 words per minute": "Je lis environ 400 mots par minute" +"You can use online tools to estimate your reading speed": "Vous pouvez utiliser un outil en ligne pour estimer votre vitesse de lecture" +"like this one": "comme celui-ci" # Tagging rules Tagging rules: "Règles de tag automatiques" diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 31931ca2e..2b0b08289 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig @@ -47,6 +47,7 @@ {{ form_label(form.config.reading_speed) }} {{ form_errors(form.config.reading_speed) }} {{ form_widget(form.config.reading_speed) }} +

{% trans %}You can use online tools to estimate your reading speed{% endtrans %} ({% trans %}like this one{%endtrans%}).

From 78becd5401e9300fc8e1b54dc93422ddfcc4eb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 18 Mar 2016 12:36:52 +0100 Subject: [PATCH 6/7] Fix documentation and add help message in Baggy --- docs/en/user/configuration.rst | 2 +- docs/fr/user/configuration.rst | 3 +-- .../Resources/views/themes/baggy/Config/index.html.twig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst index 415f6317f..f681d8745 100644 --- a/docs/en/user/configuration.rst +++ b/docs/en/user/configuration.rst @@ -24,7 +24,7 @@ You can change the number of articles displayed on each page. Reading speed ~~~~~~~~~~~~~ -wallabag calculates a reading time for each article. You can define here, thanks to the slider, if you are +wallabag calculates a reading time for each article. You can define here, thanks to this list, if you are a fast or a slow reader. wallabag will recalculate the reading time for each article. Language diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst index 112d2d584..893059989 100644 --- a/docs/fr/user/configuration.rst +++ b/docs/fr/user/configuration.rst @@ -25,8 +25,7 @@ Vous pouvez définir le nombre d'articles affichés sur chaque page. Vitesse de lecture ~~~~~~~~~~~~~~~~~~ -wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à la jauge, si vous lisez plus -ou moins vite. wallabag recalculera la durée de lecture de chaque article. +wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à cette liste déroulante, si vous lisez plus ou moins vite. wallabag recalculera la durée de lecture de chaque article. Langue ~~~~~~ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index 3ed96ab18..54faa788c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig @@ -29,10 +29,10 @@ {{ form_label(form.config.reading_speed) }} {{ form_errors(form.config.reading_speed) }} {{ form_widget(form.config.reading_speed) }} +

{% trans %}You can use online tools to estimate your reading speed{% endtrans %} ({% trans %}like this one{%endtrans%}).

-
{{ form_label(form.config.language) }} From 1b64a84b782090d8748bef0e9c390f491669e30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 18 Mar 2016 13:12:09 +0100 Subject: [PATCH 7/7] Improved tests --- src/Wallabag/CoreBundle/Entity/Config.php | 4 ++-- .../Tests/Controller/ConfigControllerTest.php | 1 + var/SymfonyRequirements.php | 20 ++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index e1a2090e5..e18b543b1 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -257,7 +257,7 @@ class Config /** * Set readingSpeed. * - * @param int $readingSpeed + * @param float $readingSpeed * * @return Config */ @@ -271,7 +271,7 @@ class Config /** * Get readingSpeed. * - * @return int + * @return float */ public function getReadingSpeed() { diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 2af93ffec..51425fe1c 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php @@ -46,6 +46,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $data = array( 'config[theme]' => 'baggy', 'config[items_per_page]' => '30', + 'config[reading_speed]' => '0.5', 'config[language]' => 'en', ); diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php index 28b0dcdbf..841338f44 100644 --- a/var/SymfonyRequirements.php +++ b/var/SymfonyRequirements.php @@ -425,11 +425,13 @@ class SymfonyRequirements extends RequirementCollection 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' ); - $this->addPhpIniRequirement( - 'date.timezone', true, false, - 'date.timezone setting must be set', - 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' - ); + if (version_compare($installedPhpVersion, '7.0.0', '<')) { + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + } if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { $timezones = array(); @@ -677,6 +679,14 @@ class SymfonyRequirements extends RequirementCollection 'Upgrade your intl extension with a newer ICU version (4+).' ); + if (class_exists('Symfony\Component\Intl\Intl')) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system (%s) should match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.' + ); + } + $this->addPhpIniRecommendation( 'intl.error_level', create_function('$cfgValue', 'return (int) $cfgValue === 0;'),